diff --git a/admin/communication.inc.php b/admin/communication.inc.php index 122e2de..8d9bfae 100644 --- a/admin/communication.inc.php +++ b/admin/communication.inc.php @@ -142,13 +142,21 @@ */ "school_principals"=>array("name"=>"School principals","query"=> - "SELECT school, principal AS firstname, schoolemail AS email FROM schools WHERE schools.year='".$config['FAIRYEAR']."' AND schoolemail!=''"), + "SELECT school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools + JOIN users ON schools.principal_uid=users.uid AND users.id=(SELECT id FROM users WHERE users.uid=schools.principal_uid ORDER BY `year` DESC LIMIT 1) + WHERE schools.year='".$config['FAIRYEAR']."' AND email!=''"), + "school_scienceheads"=>array("name"=>"School science heads","query"=> - "SELECT school, sciencehead AS firstname, scienceheademail AS email FROM schools WHERE schools.year='".$config['FAIRYEAR']."' AND scienceheademail!=''"), + "SELECT school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools + JOIN users ON schools.sciencehead_uid=users.uid AND users.id=(SELECT id FROM users WHERE users.uid=schools.sciencehead_uid ORDER BY `year` DESC LIMIT 1) + WHERE schools.year='".$config['FAIRYEAR']."' AND email!=''"), + "school_teachers_thisyear"=>array("name"=>"Teachers (as entered by students) this year","query"=> "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".$config['FAIRYEAR']."' AND teacheremail!=''"), + "school_teachers_lastyear"=>array("name"=>"Teachers (as entered by students) last year","query"=> "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE year='".($config['FAIRYEAR']-1)."' AND teacheremail!=''"), + "school_teachers_allyears"=>array("name"=>"Teachers (as entered by students) all years","query"=> "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE teacheremail!=''"), /* Volunteers */