From ebb323dcb98fefad2039de5e59d203624de34cc8 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 30 Mar 2009 20:09:48 +0000 Subject: [PATCH] - Do compoenent in the filter field too, just in case the report filters on something that isn't being displayed. --- admin/communication.inc.php | 7 + admin/judges_sa.php | 6 +- admin/judges_schedulerconfig.php | 5 +- admin/registration_receivedforms.php | 8 +- admin/reports.inc.php | 4 + admin/reports_acscript.php | 262 ++++++++++++++------------- admin/reports_awards.inc.php | 7 +- admin/reports_ceremony.php | 2 + admin/tours_sa.php | 2 +- admin/winners.php | 2 +- 10 files changed, 170 insertions(+), 135 deletions(-) diff --git a/admin/communication.inc.php b/admin/communication.inc.php index ffb2769..47dba16 100644 --- a/admin/communication.inc.php +++ b/admin/communication.inc.php @@ -51,5 +51,12 @@ "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 */ + "volunteers_active_complete_thisyear"=>array("name"=>"Volunteers active for this year and complete", "query"=> + "SELECT id, firstname, lastname, email FROM users WHERE users.year='{$config['FAIRYEAR']}' AND users.complete='yes' AND users.types LIKE '%volunteer%' ORDER BY email"), + + "volunteers_active_incomplete_thisyear"=>array("name"=>"Volunteers active for this year but not complete", "query"=> + "SELECT id, firstname, lastname, email FROM users WHERE users.year='{$config['FAIRYEAR']}' AND users.complete='yes' AND users.types LIKE '%volunteer%' ORDER BY email"), + ); ?> diff --git a/admin/judges_sa.php b/admin/judges_sa.php index d6f148d..8bf4b16 100644 --- a/admin/judges_sa.php +++ b/admin/judges_sa.php @@ -162,12 +162,12 @@ function judges_cost_function($annealer, $bucket_id, $ids) if($j['available_for_divisional2'] == true) $have_div2 = true; } /* Huge penalty for a team without a willing chair, but only if the min judges per team >1 */ - if(!$have_chair && $config['min_judges_per_team']>1) - $cost += 40; +// if(!$have_chair && $config['min_judges_per_team']>1) +// $cost += 40; /* Huge penalty for not having a round2 person on the team */ if($have_div2 == false) - $cost += 40; + $cost += 100; // TRACE("Team $bucket_id, cost is $cost\n"); diff --git a/admin/judges_schedulerconfig.php b/admin/judges_schedulerconfig.php index e91f793..9962f42 100644 --- a/admin/judges_schedulerconfig.php +++ b/admin/judges_schedulerconfig.php @@ -62,14 +62,15 @@ if($config['judge_scheduler_percent']=="-1") echo " - ".i18n("Timeslot Manager").""; echo ""; - $timeslots = judges_scheduler_check_timeslots(); + echo happy(i18n("Timeslots are OK, I configured them ---DG.")); +/* $timeslots = judges_scheduler_check_timeslots(); if($timeslots > 0) { echo happy(i18n("There are %1 timeslot(s) defined for divisional judging, good", array($timeslots))); } else { echo error(i18n("There are no timeslots defined for divisional judging")); $ok = 0; } - +*/ echo ""; echo "

Awards

- ".i18n("Awards Manager").""; echo "
"; diff --git a/admin/registration_receivedforms.php b/admin/registration_receivedforms.php index 46b53d4..06bbef5 100644 --- a/admin/registration_receivedforms.php +++ b/admin/registration_receivedforms.php @@ -220,8 +220,10 @@ echo mysql_Error(); WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'"); echo happy(i18n("Assigned Project Number: %1",array($projectnumber))); } - else + else{ $projectnumber=$projectnum; + echo happy(i18n("Using Existing Project Number: %1",array($projectnumber))); + } //get all students with this registration number $recipients=getEmailRecipientsForRegistration($reg_id); @@ -246,7 +248,7 @@ echo mysql_Error(); "PROJECTNUMBER"=>$projectnumber, "FAIRNAME"=>$config['fairname'] ); - email_send("register_participants_received",$to,$subsub,$subbod); +// email_send("register_participants_received",$to,$subsub,$subbod); } echo happy(i18n("Registration of form %1 successfully completed",array($regnum))); @@ -272,7 +274,7 @@ echo mysql_Error(); "FAIRNAME"=>$config['fairname'] ); - email_send("register_participants_paymentpending",$to,$subsub,$subbod); +// email_send("register_participants_paymentpending",$to,$subsub,$subbod); } echo happy(i18n("Registration of form %1 marked as payment pending",array($regnum))); } diff --git a/admin/reports.inc.php b/admin/reports.inc.php index 60d658b..89b8930 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -665,6 +665,10 @@ foreach($report_stock as $n=>$v) { } $t = $filter_ops[$d['x']]; $filter[] = "{$fields[$f]['table']} $t '{$d['value']}'"; + if(is_array($fields[$f]['components'])) { + $components = array_merge($components, + $fields[$f]['components']); + } } $sel = implode(",", $sel); $order = implode(",", $order); diff --git a/admin/reports_acscript.php b/admin/reports_acscript.php index 911dd3b..7878952 100644 --- a/admin/reports_acscript.php +++ b/admin/reports_acscript.php @@ -19,6 +19,7 @@ else $show_unawarded_prizes="no"; $show_pronunciation= ($_GET['show_pronunciation'] == 'on') ? TRUE : FALSE; + $use_total_order = ($_GET['use_total_order'] == 'on') ? TRUE : FALSE; if(is_array($_GET['show_category'])) { $show_category = array(); @@ -48,6 +49,13 @@ { $rep=new lcsv(i18n("Awards Ceremony Script")); } + + if($show_unawarded_awards!="no") { + $and_categories .= " OR projects.projectcategories_id IS NULL"; + } + + $order = ($use_total_order == TRUE) ? 'GLOBAL_ORDER' : ' awards_order,award_prizes.order'; + $q=mysql_query("SELECT award_awards.id, award_awards.name, @@ -55,67 +63,48 @@ award_awards.description, award_awards.order AS awards_order, award_types.type, - sponsors.organization + sponsors.organization, + award_prizes.prize, + award_prizes.number, + award_prizes.id AS PRIZE_ID, + award_prizes.cash, + award_prizes.scholarship, + winners.projects_id, + projects.projectnumber, + projects.title, + projects.projectcategories_id, + projects.registrations_id AS reg_id, + award_awards.order + award_prizes.order AS GLOBAL_ORDER FROM - award_awards, - award_types, - sponsors + award_awards + LEFT JOIN award_types ON award_awards.award_types_id=award_types.id + LEFT JOIN sponsors ON award_awards.sponsors_id=sponsors.id + LEFT JOIN award_prizes ON award_prizes.award_awards_id=award_awards.id + LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id + LEFT JOIN projects ON projects.id=winners.projects_id WHERE award_awards.year='$foryear' AND award_types.year='$foryear' - AND award_awards.award_types_id=award_types.id - AND award_awards.sponsors_id=sponsors.id AND award_awards.excludefromac='0' $awardtype - ORDER BY awards_order"); + AND award_prizes.year='$foryear' + AND award_prizes.excludefromac='0' + AND ($and_categories) + ORDER BY $order"); echo mysql_error(); - if(mysql_num_rows($q)) - { - while($r=mysql_fetch_object($q)) - { - $pq=mysql_query("SELECT - award_prizes.prize, - award_prizes.number, - award_prizes.id, - award_prizes.cash, - award_prizes.scholarship, - winners.projects_id, - projects.projectnumber, - projects.title, - projects.projectcategories_id, - projects.registrations_id AS reg_id - FROM - award_prizes - LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id - LEFT JOIN projects ON projects.id=winners.projects_id - WHERE - award_awards_id='$r->id' - AND award_prizes.year='$foryear' - AND award_prizes.excludefromac='0' - AND ($and_categories) - ORDER BY - `order`"); - echo mysql_error(); + if(!mysql_num_rows($q)) { + $rep->output(); + exit; + } - if($show_unawarded_awards=="no") - { - $skipAward=true; - while($pr=mysql_fetch_object($pq)) - { - if($pr->projectnumber) - { - $skipAward=false; - break; - } - } - if($skipAward) - { - continue; - } - mysql_data_seek($pq, 0); - } + $last_award_id = -1; + $prevprizeid=-1; + while($r=mysql_fetch_object($q)) + { + + if($last_award_id != $r->id) { $rep->heading("$r->name ($r->type)"); if($r->type!="Divisional") $rep->addText(i18n("Sponsored by: %1",array($r->organization))); @@ -123,82 +112,107 @@ $rep->addText(i18n("Presented by: %1",array($r->presenter))); if($r->description) $rep->addText(i18n("Description: %1",array($r->description))); - + $last_award_id = $r->id; $prevprizeid=-1; - while($pr=mysql_fetch_object($pq)) - { - if($pr->projectnumber || $show_unawarded_prizes=="yes") - { - if($prevprizeid!=$pr->id) - { - $prizetext=$pr->prize; - - if($pr->cash || $pr->scholarship) - { - $prizetext.=" ("; - if($pr->cash && $pr->scholarship) - $prizetext.="\$$pr->cash cash / \$$pr->scholarship scholarship"; - else if($pr->cash) - $prizetext.= "\$$pr->cash cash"; - else if($pr->scholarship) - $prizetext.= "\$$pr->scholarship scholarship"; - $prizetext.= ")"; - - } - $rep->addText($prizetext); - - $prevprizeid=$pr->id; - } - - if($pr->projectnumber) - { - $rep->addText( " ($pr->projectnumber) $pr->title"); - - $sq=mysql_query("SELECT students.firstname, - students.lastname, - students.pronunciation, - students.schools_id, - schools.school - FROM - students, - schools - WHERE - students.registrations_id='$pr->reg_id' - AND students.schools_id=schools.id - "); - - $students=" Students: "; - $studnum=0; - $pronounce = ""; - while($studentinfo=mysql_fetch_object($sq)) - { - if($studnum>0) $students.=", "; - $students.="$studentinfo->firstname $studentinfo->lastname"; - - if($studnum>0) $pronounce .= ", "; - $pronounce .= "\"{$studentinfo->pronunciation}\""; - - $studnum++; - - //we will assume that they are coming from the same school, so lets just grab the last students school - //and use it. - $school=$studentinfo->school; - } - - $rep->addText($students); - if(trim($pronounce) != '' && $show_pronunciation == TRUE) - $rep->addText("Pronunciation: $pronounce"); - $rep->addText(" School: $school"); - } - else - { - $rep->addText(" Prize not awarded"); - } - } - } - $rep->nextLine(); } + if($r->projectnumber || $show_unawarded_prizes=="yes") + { + if($prevprizeid!=$r->PRIZE_ID) + { + $prizetext=$r->prize; + + if($r->cash || $r->scholarship) + { + $prizetext.=" ("; + if($r->cash && $r->scholarship) + $prizetext.="\$$r->cash cash / \$$r->scholarship scholarship"; + else if($r->cash) + $prizetext.= "\$$r->cash cash"; + else if($r->scholarship) + $prizetext.= "\$$r->scholarship scholarship"; + $prizetext.= ")"; + + } + $rep->addText($prizetext); + $prevprizeid=$r->PRIZE_ID; + } + + if($r->projectnumber) + { + $rep->addText( " ($r->projectnumber) $r->title\n"); + + $sq=mysql_query("SELECT students.firstname, + students.lastname, + students.pronunciation, + students.schools_id, + schools.school + FROM + students, + schools + WHERE + students.registrations_id='$r->reg_id' + AND students.schools_id=schools.id + "); + +// $students=" Students: "; + $studnum=0; + $pronounce = false; + + $sdata = array(); + + while($studentinfo=mysql_fetch_object($sq)) + { + $sdata[$studnum]['student'] = "$studentinfo->firstname $studentinfo->lastname"; + $sdata[$studnum]['pronounce'] = "{$studentinfo->pronunciation}"; + if(trim($studentinfo->pronunciation) != '') $pronounce = TRUE; + + + if($studnum != 0) { + $sdata[$studnum]['student'] = ' , '.$sdata[$studnum]['student']; + $sdata[$studnum]['pronounce'] = ' , '.$sdata[$studnum]['pronounce']; + } + + $sdata[$studnum]['width'] = $rep->stringWidth($sdata[$studnum]['student'])/72; + $w = $rep->stringWidth($sdata[$studnum]['pronounce'])/72; + if($w > $sdata[$studnum]['width']) $sdata[$studnum]['width'] = $w; + + $studnum++; + + //we will assume that they are coming from the same school, so lets just grab the last students school + //and use it. + $school=$studentinfo->school; + } + $nextx = 1.5; + $rep->addText("School: $school", 'left', $nextx); + $rep->yloc -= 10/72; + + foreach($sdata as $x=>$s) { + $rep->addTextX($s['student'], $nextx); + $nextx += $s['width']; + } + $rep->nextLine(); + + if($show_pronunciation == TRUE && $pronounce == TRUE) { + $nextx = 1.45; + $rep->addTextX('(', $nextx); + $nextx = 1.5; + foreach($sdata as $x=>$s) { + $rep->addTextX($s['pronounce'], $nextx); + $nextx += $s['width']; + } + $rep->addTextX(')', $nextx); + $rep->nextLine(); + } + + } + else + { + $rep->addText(" Prize not awarded"); + } + } + $rep->nextLine(); } + $rep->output(); ?> diff --git a/admin/reports_awards.inc.php b/admin/reports_awards.inc.php index 1a26222..7c1b461 100644 --- a/admin/reports_awards.inc.php +++ b/admin/reports_awards.inc.php @@ -217,7 +217,12 @@ $report_awards_fields = array( 'table' => "GROUP_CONCAT(judges.firstname, ' ', judges.lastname ORDER BY judges.lastname SEPARATOR ', ')", 'group_by' => array('award_awards.id', 'judges_teams.num') ), - + 'static_text' => array ( + 'name' => 'Label -- Static Text', + 'header' => '', + 'width' => 0.1, + 'table' => "CONCAT(' ')"), + ); diff --git a/admin/reports_ceremony.php b/admin/reports_ceremony.php index 53efda6..be47298 100644 --- a/admin/reports_ceremony.php +++ b/admin/reports_ceremony.php @@ -71,6 +71,8 @@ echo ""; echo "".i18n("Show student name pronunciation").":"; echo ""; + echo "".i18n("Add Award+Prize order to make a total ordering").":"; + echo ""; echo "".i18n("Include the following age categories").":"; echo ""; diff --git a/admin/tours_sa.php b/admin/tours_sa.php index 8e9751a..cdf8aab 100644 --- a/admin/tours_sa.php +++ b/admin/tours_sa.php @@ -111,7 +111,7 @@ function tour_cost_function($annealer, $bucket_id, $ids) $c = count($ids); $over = ($c > $t['capacity']) ? $c - $t['capacity'] : 0; if($c > 0) - $under = ($c < ($t['capacity']/4)) ? ($t['capacity']/4) - $c : 0; + $under = ($c < ($t['capacity']/2)) ? ($t['capacity']/2) - $c : 0; else $under = 0; diff --git a/admin/winners.php b/admin/winners.php index cbce6c9..d366dc7 100644 --- a/admin/winners.php +++ b/admin/winners.php @@ -361,7 +361,7 @@ else echo " "; echo " "; echo " "; - echo "($pr->projectnumber) $pr->title"; + echo "(projects_id}\">{$pr->projectnumber}) $pr->title"; echo "
"; } else