diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php index 0f16e8b..0a1bd52 100644 --- a/admin/reports_students.inc.php +++ b/admin/reports_students.inc.php @@ -588,7 +588,87 @@ $report_students_fields = array( 'width' => 4, 'table' => "CONCAT(tours.num,': ', tours.name)", 'components' => array('tours')), + + 'mentor_name_proj' => array( + 'name' => 'Mentor -- Project and Name (Distinct for each Project+Mentor pair)', + 'header' => 'Mentor Name', + 'width' => 1.75, + 'scalable' => true, + 'table' => "CONCAT('projects.projectnumber', ' - ', mentors.firstname, ', ', mentors.lastname)", + 'table_sort'=> 'mentors.lastname', + 'components' => array('mentors')), + + 'mentor_last_name' => array( + 'name' => 'Mentor -- Last Name', + 'header' => 'Last Name', + 'width' => 1.0, + 'table' => 'mentors.lastname', + 'components' => array('mentors')), + + 'mentor_first_name' => array( + 'name' => 'Mentor -- First Name', + 'header' => 'First Name', + 'width' => 1.0, + 'table' => 'mentors.firstname', + 'components' => array('mentors')), + + 'mentor_name' => array( + 'name' => 'Mentor -- Full Name (last, first)', + 'header' => 'Mentor Name', + 'width' => 1.75, + 'scalable' => true, + 'table' => "CONCAT(mentors.lastname, ', ', mentors.firstname)", + 'table_sort'=> 'mentors.lastname', + 'components' => array('mentors')), + + 'mentor_namefl' => array( + 'name' => 'Mentor -- Full Name (first last)', + 'header' => 'Mentor Name', + 'width' => 1.75, + 'scalable' => true, + 'table' => "CONCAT(mentors.firstname, ' ', mentors.lastname)", + 'table_sort'=> 'mentors.lastname', + 'components' => array('mentors')), + 'mentor_email' => array( + 'name' => 'Mentor -- Email', + 'header' => 'Mentor Email', + 'width' => 2.0, + 'scalable' => true, + 'table' => 'mentors.email', + 'components' => array('mentors')), + + 'mentor_phone' => array( + 'name' => 'Mentor -- Phone', + 'header' => 'Mentor Phone', + 'width' => 1, + 'table' => 'mentors.phone', + 'components' => array('mentors')), + + 'mentor_organization' => array( + 'name' => 'Mentor -- Organization', + 'header' => 'Mentor Org.', + 'width' => 1.5, + 'scalable' => true, + 'table' => 'mentors.organization', + 'components' => array('mentors')), + + 'mentor_position' => array( + 'name' => 'Mentor -- Position', + 'header' => 'Position', + 'width' => 1, + 'scalable' => true, + 'table' => 'mentors.position', + 'components' => array('mentors')), + + 'mentor_description' => array( + 'name' => 'Mentor -- Description of Help', + 'header' => 'Description of Help', + 'width' => 3.0, + 'scalable' => true, + 'table' => 'mentors.description', + 'components' => array('mentors')), + 'fair_year' => array ( 'name' => 'Fair -- Year', 'header' => 'Year', @@ -677,7 +757,6 @@ $report_students_fields = array( $tour_join = "LEFT JOIN tours_choice ON (students.id=tours_choice.students_id AND tours_choice.rank=0), tours"; $tour_where = "AND tours.year='$year' AND tours.id=tours_choice.tour_id"; - } $emergencycontact_join = ''; @@ -687,6 +766,16 @@ $report_students_fields = array( emergencycontact.students_id=students.id "; } + $mentor_join = ''; + $mentor_where = ''; + if(in_array('mentors', $components)) { + $mentor_join = "LEFT JOIN mentors ON + mentors.registrations_id=students.registrations_id"; + $mentor_where = "AND mentors.year='$year'"; + } + + + $q = " FROM students LEFT JOIN registrations ON registrations.id=students.registrations_id LEFT JOIN schools ON schools.id=students.schools_id @@ -697,6 +786,7 @@ $report_students_fields = array( $tour_join $awards_join $partner_join + $mentor_join WHERE students.year='$year' AND projects.year='$year' @@ -706,6 +796,7 @@ $report_students_fields = array( AND (registrations.status='complete' OR registrations.status='paymentpending') $awards_where $tour_where + $mentor_where "; return $q;