|
|
|
|
@@ -65,7 +65,7 @@ $report_students_fields = array(
|
|
|
|
|
'header' => 'Student(s)',
|
|
|
|
|
'width' => 3.0,
|
|
|
|
|
'table' => "CONCAT(students.firstname, ' ', students.lastname, IF(students2.lastname IS NULL,'', CONCAT(', ', students2.firstname, ' ', students2.lastname)))",
|
|
|
|
|
'table_sort' => 'students.lastnmae'),
|
|
|
|
|
'table_sort' => 'students.lastname'),
|
|
|
|
|
|
|
|
|
|
'grade' => array(
|
|
|
|
|
'name' => 'Student -- Grade',
|
|
|
|
|
@@ -209,10 +209,11 @@ $report_students_fields = array(
|
|
|
|
|
'width' => 0.75,
|
|
|
|
|
'table' => 'schools.postalcode' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'school_board' => array(
|
|
|
|
|
'name' => 'School -- Board ID',
|
|
|
|
|
'header' => 'Board',
|
|
|
|
|
'width' => 0.75,
|
|
|
|
|
'table' => 'schools.board' ),
|
|
|
|
|
|
|
|
|
|
'paid' => array(
|
|
|
|
|
'name' => 'Paid',
|
|
|
|
|
@@ -235,14 +236,32 @@ $report_students_fields = array(
|
|
|
|
|
'width' => 4,
|
|
|
|
|
'table' => "CONCAT(IF(award_types.type='Other','Special',award_types.type),
|
|
|
|
|
' ', award_awards.name)",
|
|
|
|
|
'table_sort' => 'award_awards.order'),
|
|
|
|
|
'table_sort' => 'award_awards.order',
|
|
|
|
|
'select_component' => array('awards')),
|
|
|
|
|
|
|
|
|
|
'pn_awards' => array(
|
|
|
|
|
'name' => 'Project Num + Award (will be unique)',
|
|
|
|
|
'header' => 'Award Name',
|
|
|
|
|
'width' => 4,
|
|
|
|
|
'table' => "CONCAT(projects.projectnumber,' ', award_awards.name)",
|
|
|
|
|
'table_sort' => 'award_awards.order'),
|
|
|
|
|
'table_sort' => 'award_awards.order',
|
|
|
|
|
'select_component' => array('awards')),
|
|
|
|
|
|
|
|
|
|
'nom_awards' => array(
|
|
|
|
|
'name' => 'Award Nominations -- Award Name (warning: duplicates student for multiple awards!)',
|
|
|
|
|
'header' => 'Award Name',
|
|
|
|
|
'width' => 4,
|
|
|
|
|
'table' => "CONCAT(award_types.type,' ',award_awards.name)",
|
|
|
|
|
'table_sort' => 'award_awards.order',
|
|
|
|
|
'select_component' => array('awards_nominations')),
|
|
|
|
|
|
|
|
|
|
'nom_pn_awards' => array(
|
|
|
|
|
'name' => 'Award Nominations -- Project Num + Award Name(will be unique)',
|
|
|
|
|
'header' => 'Award Name',
|
|
|
|
|
'width' => 4,
|
|
|
|
|
'table' => "CONCAT(projects.projectnumber,' ', award_awards.name)",
|
|
|
|
|
'table_sort' => 'award_awards.order',
|
|
|
|
|
'select_component' => array('awards_nominations')),
|
|
|
|
|
|
|
|
|
|
'req_elec' => array(
|
|
|
|
|
'name' => 'If the project requires electricity',
|
|
|
|
|
@@ -268,19 +287,22 @@ $report_students_fields = array(
|
|
|
|
|
'name' => 'Emergency Contact -- Name',
|
|
|
|
|
'header' => 'Emerg. Name',
|
|
|
|
|
'width' => 1.5,
|
|
|
|
|
'table' => "CONCAT(emergencycontact.firstname, ' ', emergencycontact.lastname)"),
|
|
|
|
|
'table' => "CONCAT(emergencycontact.firstname, ' ', emergencycontact.lastname)",
|
|
|
|
|
'select_component' => array('emergencycontacts')),
|
|
|
|
|
|
|
|
|
|
'emerg_relation' => array(
|
|
|
|
|
'name' => 'Emergency Contact -- Relationship',
|
|
|
|
|
'header' => 'Emerg. Rlt',
|
|
|
|
|
'width' => 1,
|
|
|
|
|
'table' => "emergencycontact.relation"),
|
|
|
|
|
'table' => "emergencycontact.relation",
|
|
|
|
|
'select_component' => array('emergencycontacts')),
|
|
|
|
|
|
|
|
|
|
'emerg_phone' => array(
|
|
|
|
|
'name' => 'Emergency Contact -- Phone',
|
|
|
|
|
'header' => 'Emerg. Phone',
|
|
|
|
|
'width' => 1,
|
|
|
|
|
'table' => "CONCAT(emergencycontact.phone1, ' ', emergencycontact.phone2, ' ', emergencycontact.phone3, ' ', emergencycontact.phone4)"),
|
|
|
|
|
'table' => "CONCAT(emergencycontact.phone1, ' ', emergencycontact.phone2, ' ', emergencycontact.phone3, ' ', emergencycontact.phone4)",
|
|
|
|
|
'select_component' => array('emergencycontacts')),
|
|
|
|
|
|
|
|
|
|
'static_text' => array (
|
|
|
|
|
'name' => 'Static Text (useful for labels)',
|
|
|
|
|
@@ -298,7 +320,7 @@ $report_students_fields = array(
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
function report_students_fromwhere($report)
|
|
|
|
|
function report_students_fromwhere($report, $components)
|
|
|
|
|
{
|
|
|
|
|
global $config, $report_students_fields;
|
|
|
|
|
|
|
|
|
|
@@ -308,8 +330,7 @@ $report_students_fields = array(
|
|
|
|
|
$awards_join = '';
|
|
|
|
|
$awards_where = '';
|
|
|
|
|
|
|
|
|
|
if(in_array('awards', $report['col']) || in_array('pn_awards', $report['col'])
|
|
|
|
|
|| in_array('awards', $report['group']) || in_array('pn_awards', $report['group']) ) {
|
|
|
|
|
if(in_array('awards', $components)) {
|
|
|
|
|
/* This requires some extra gymnastics */
|
|
|
|
|
$awards_join = "LEFT JOIN winners ON(winners.projects_id = projects.id),award_prizes,award_awards,award_types";
|
|
|
|
|
$awards_where = " AND winners.awards_prizes_id=award_prizes.id
|
|
|
|
|
@@ -321,6 +342,16 @@ $report_students_fields = array(
|
|
|
|
|
AND award_types.year='$year' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(in_array('awards_nominations', $components)) {
|
|
|
|
|
$awards_join = "LEFT JOIN project_specialawards_link
|
|
|
|
|
ON(projects.id=project_specialawards_link.projects_id),
|
|
|
|
|
award_awards,award_types";
|
|
|
|
|
$awards_where = " AND project_specialawards_link.award_awards_id=award_awards_id
|
|
|
|
|
AND award_types.id=award_awards.award_types_id
|
|
|
|
|
AND award_awards.year='$year'
|
|
|
|
|
AND award_types.year='$year' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$partner_join = '';
|
|
|
|
|
if(in_array('bothnames', $report['col']) || in_array('partner', $report['col'])) {
|
|
|
|
|
$partner_join = "LEFT JOIN students AS students2
|
|
|
|
|
@@ -328,10 +359,18 @@ $report_students_fields = array(
|
|
|
|
|
AND students2.id != students.id)";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$emergencycontact_join = '';
|
|
|
|
|
if(in_array('emergencycontacts', $components)) {
|
|
|
|
|
/* No need to put the year in here, students.id is unique across years */
|
|
|
|
|
$emergencycontact_join = "LEFT JOIN emergencycontact ON (
|
|
|
|
|
students.id=emergencycontact.students_id )";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$q = " FROM
|
|
|
|
|
students $partner_join,
|
|
|
|
|
schools, projects $awards_join, projectdivisions,
|
|
|
|
|
projectcategories, registrations, emergencycontact
|
|
|
|
|
projectcategories, registrations
|
|
|
|
|
$emergencycontact_join
|
|
|
|
|
WHERE
|
|
|
|
|
schools.id=students.schools_id
|
|
|
|
|
AND projects.registrations_id=students.registrations_id
|
|
|
|
|
@@ -339,13 +378,11 @@ $report_students_fields = array(
|
|
|
|
|
AND projectcategories.id=projects.projectcategories_id
|
|
|
|
|
AND registrations.id=students.registrations_id
|
|
|
|
|
AND (registrations.status='complete' OR registrations.status='paymentpending')
|
|
|
|
|
AND emergencycontact.students_id=students.id
|
|
|
|
|
AND students.year='$year'
|
|
|
|
|
AND projects.year='$year'
|
|
|
|
|
AND registrations.year='$year'
|
|
|
|
|
AND projectcategories.year='$year'
|
|
|
|
|
AND projectdivisions.year='$year'
|
|
|
|
|
AND emergencycontact.year='$year'
|
|
|
|
|
$awards_where
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
|