diff --git a/admin/communication.inc.php b/admin/communication.inc.php index 612f109..75dd027 100644 --- a/admin/communication.inc.php +++ b/admin/communication.inc.php @@ -120,18 +120,57 @@ "SELECT DISTINCT(award_sponsors.id), organization, firstname, lastname, award_contacts.email FROM award_sponsors, award_awards, award_contacts WHERE award_awards.sponsors_id=award_sponsors.id AND award_contacts.award_sponsors_id=award_sponsors.id AND award_awards.award_types_id='2' AND award_contacts.year='".$config['FAIRYEAR']."'"), */ - "school_principals"=>array("name"=>"School principals","query"=> - "SELECT school, principal AS firstname, schoolemail AS email FROM schools WHERE schools.conferences_id='".$conference['id']."' AND schoolemail!=''"), - "school_scienceheads"=>array("name"=>"School science heads","query"=> - "SELECT school, sciencehead AS firstname, scienceheademail AS email FROM schools WHERE schools.conferences_id='".$conference['id']."' AND scienceheademail!=''"), + "school_principals"=>array("name"=>"School principals this conference","query"=> + "SELECT school, accounts.email, users.firstname, users.lastname FROM schools + JOIN users ON users.id=schools.principal_uid + JOIN accounts ON users.accounts_id=accounts.id + WHERE schools.conferences_id='".$conference['id']."' + AND accounts.email!='' + "), + "school_scienceheads"=>array("name"=>"School science heads this conference","query"=> + "SELECT school, accounts.email, users.firstname, users.lastname FROM schools + JOIN users ON users.id=schools.sciencehead_uid + JOIN accounts ON users.accounts_id=accounts.id + WHERE schools.conferences_id='".$conference['id']."' + AND accounts.email!='' + "), + + "teachers_with_school"=>array("name"=>"Teachers with a confirmed school this conference","query"=> + "SELECT schools.school, accounts.email, users.firstname, users.lastname + FROM users + JOIN schools ON users.schools_id=schools.id + JOIN accounts ON users.accounts_id=accounts.id + JOIN user_roles ON users.id=user_roles.users_id + JOIN roles ON user_roles.roles_id=roles.id + WHERE schools.conferences_id='".$conference['id']."' + AND roles.type='teacher' + AND accounts.email!='' + "), + + "teachers_without_school"=>array("name"=>"Teachers without a confirmed school this conference","query"=> + "SELECT accounts.email, users.firstname, users.lastname + FROM users + JOIN accounts ON users.accounts_id=accounts.id + JOIN user_roles ON users.id=user_roles.users_id + JOIN roles ON user_roles.roles_id=roles.id + WHERE roles.type='teacher' + AND users.conferences_id='".$conference['id']."' + AND (users.schools_id='' OR users.schools_id=0) + AND accounts.email!='' + "), + +/* "school_teachers_thisconference"=>array("name"=>"Teachers (as entered by students) for this conference","query"=> "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE conferences_id='".$conference['id']."' AND teacheremail!=''"), + */ /* // FIXME again, not sure that this has a sensible equivalent with conferences "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_allconferences"=>array("name"=>"Teachers (as entered by students) all conferences","query"=> "SELECT DISTINCT(teacheremail) AS email, teachername AS firstname FROM students WHERE teacheremail!=''"), + */ /* Volunteers */ "volunteers_active_complete_thisconference"=>array("name"=>"Volunteers active for this conference and complete", "query"=> "SELECT users.id, firstname, lastname, email