diff --git a/admin/registration_list.php b/admin/registration_list.php index ace62d7..a30f75b 100644 --- a/admin/registration_list.php +++ b/admin/registration_list.php @@ -22,33 +22,35 @@ */ ?> 'committee_main.php', - 'Administration' => 'admin/index.php', - 'Participant Registration' => 'admin/registration.php') - ); - ?> - - 'committee_main.php', + 'Administration' => 'admin/index.php', + 'Participant Registration' => 'admin/registration.php') + ); + ?> + + + + + + +"; echo i18n("Choose Status").":"; echo "
"; @@ -82,26 +277,53 @@ function openstudentinfo(id) echo ""; echo "
"; -$q=mysql_query("SELECT * FROM projectcategories WHERE year='$year' ORDER BY id"); -while($r=mysql_fetch_object($q)) - $cats[$r->id]=$r->category; - -$q=mysql_query("SELECT * FROM projectdivisions WHERE year='$year' ORDER BY id"); -while($r=mysql_fetch_object($q)) - $divs[$r->id]=$r->division; - if($showstatus) $wherestatus="AND status='$showstatus' "; else $wherestatus=""; - switch($_GET['sort']) - { - case 'status': $ORDERBY="registrations.status DESC, projects.title"; break; - case 'num': $ORDERBY="registrations.num"; break; - case 'projnum': $ORDERBY="projects.projectsort, projects.projectnumber"; break; - case 'title': $ORDERBY="projects.title, registrations.status DESC"; break; - case 'cat': $ORDERBY="projects.projectcategories_id, projects.title"; break; - case 'div': $ORDERBY="projects.projectdivisions_id, projects.title"; break; - default: $ORDERBY="registrations.status DESC, projects.title"; break; +$q = list_query($year, $wherestatus, $_GET['sort'], false); + +echo ""; +echo ""; +if($showstatus) $stat="&showstatus=".$showstatus; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; +echo ""; + +while($r=mysql_fetch_object($q)) { + echo "reg_id}\">"; + print_row($r); + echo ""; +} +echo "
".i18n("Status")."".i18n("Email Address")."".i18n("Reg Num")."".i18n("Proj Num")."".i18n("Project Title")."".i18n("Age Category")."".i18n("Division")."".i18n("School(s)")."".i18n("Student(s)")."".i18n("Action")."
"; + +echo "The statistics have move here: Registration Statistics"; + +send_footer(); + +/* Now some helper fucntions we call more than once */ +function list_query($year, $wherestatus, $sort, $reg_id) +{ + if($reg_id != false) + $reg = "AND registrations.id='$reg_id'"; + else + $reg = ''; + + switch($sort) { + case 'status': $ORDERBY="registrations.status DESC, projects.title"; break; + case 'num': $ORDERBY="registrations.num"; break; + case 'projnum': $ORDERBY="projects.projectsort, projects.projectnumber"; break; + case 'title': $ORDERBY="projects.title, registrations.status DESC"; break; + case 'cat': $ORDERBY="projects.projectcategories_id, projects.title"; break; + case 'div': $ORDERBY="projects.projectdivisions_id, projects.title"; break; + default: $ORDERBY="registrations.status DESC, projects.title"; break; } $q=mysql_query("SELECT registrations.id AS reg_id, @@ -119,210 +341,84 @@ else $wherestatus=""; 1 AND registrations.year='$year' $wherestatus + $reg ORDER BY $ORDERBY "); - echo mysql_error(); - - echo ""; - echo ""; - if($showstatus) $stat="&showstatus=".$showstatus; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - $stats_totalprojects=0; - $stats_totalstudents=0; - $stats_divisions=array(); - $stats_categories=array(); - $stats_students_catdiv=array(); - $stats_projects_catdiv=array(); - $stats_students_schools=array(); - $stats_projects_schools=array(); - $schools_names=array(); + echo mysql_error(); + return $q; +} - while($r=mysql_fetch_object($q)) + + +function print_row($r) +{ + global $cats, $divs, $config, $year; + switch($r->status) { + case "new": $status_text="New"; break; + case "open": $status_text="Open"; break; + case "paymentpending": $status_text="Payment Pending"; break; + case "complete": $status_text="Complete"; break; + } + + $status_text=i18n($status_text); + +// $cl = ($r->award_source_fairs_id) ? externalaward : ''; + $scl = "style=\"cursor:pointer;\" onclick=\"popup_editor('{$r->reg_id}','');\""; + $pcl = "style=\"cursor:pointer;\" onclick=\"popup_editor('{$r->reg_id}','projects');\""; + + echo ""; + echo ""; + echo ""; + $pn = str_replace(' ', ' ', $r->projectnumber); + echo ""; + echo ""; + + echo ""; + echo ""; + + $sq=mysql_query("SELECT students.firstname, + students.lastname, + students.id, + schools.school, + schools.board, + schools.id AS schools_id + FROM + students,schools + WHERE + students.registrations_id='$r->reg_id' + AND + students.schools_id=schools.id + "); + echo mysql_error(); + + $studnum=1; + $schools=""; + $students=""; + while($studentinfo=mysql_fetch_object($sq)) { - $stats_totalprojects++; - $stats_divisions[$r->projectdivisions_id]++; - $stats_categories[$r->projectcategories_id]++; - $stats_projects_catdiv[$r->projectcategories_id][$r->projectdivisions_id]++; - - switch($r->status) - { - case "new": $status_text="New"; break; - case "open": $status_text="Open"; break; - case "paymentpending": $status_text="Payment Pending"; break; - case "complete": $status_text="Complete"; break; - } - $status_text=i18n($status_text); - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - echo ""; - echo ""; - - $sq=mysql_query("SELECT students.firstname, - students.lastname, - students.id, - schools.school, - schools.board, - schools.id AS schools_id - FROM - students,schools - WHERE - students.registrations_id='$r->reg_id' - AND - students.schools_id=schools.id - "); - echo mysql_error(); - - $studnum=1; - $schools=""; - $students=""; - while($studentinfo=mysql_fetch_object($sq)) - { - $students.="reg_id\">$studentinfo->firstname $studentinfo->lastname
"; - $schools.="$studentinfo->school
"; - $stats_totalstudents++; - $stats_students_catdiv[$r->projectcategories_id][$r->projectdivisions_id]++; - $stats_students_schools[$r->projectcategories_id][$studentinfo->schools_id]++; - $schools_names[$studentinfo->schools_id]=$studentinfo->school." ($studentinfo->board)"; - $lastschoolid=$studentinfo->schools_id; - } - //this really isnt right, its only taking the school from the last student in the project to count towards the school's project totals - //but there's really no other way - $stats_projects_schools[$r->projectcategories_id][$lastschoolid]++; - echo ""; - echo ""; - echo ""; - echo ""; + $students.="$studentinfo->firstname $studentinfo->lastname
"; + $schools.="$studentinfo->school
"; } - echo "
".i18n("Status")."".i18n("Email Address")."".i18n("Reg Num")."".i18n("Proj Num")."".i18n("Project Title")."".i18n("Age Category")."".i18n("Division")."".i18n("School(s)")."".i18n("Student(s)")."".i18n("Action")."
{$status_text}{$r->email}{$r->reg_num}$pn{$r->title}".i18n($cats[$r->projectcategories_id])."".i18n($divs[$r->projectdivisions_id])."
$status_text$r->email$r->reg_num$r->projectnumberreg_id\">$r->title".i18n($cats[$r->projectcategories_id])."".i18n($divs[$r->projectdivisions_id])."$schools$students"; - if($year==$config['FAIRYEAR']) { - echo "reg_id\" onclick=\"return confirmClick('".i18n("Are you sure you want to completely delete this registration?")."');\">"; - echo ""; - echo ""; - - echo "
"; - echo ""; - echo "email\">"; - echo "reg_num\">"; - echo ""; - echo "
"; - - - } - echo "
\n"; - echo "
"; - echo ""; - echo ""; - echo ""; - - echo ""; - echo ""; - echo ""; - echo "

{$status_str[$showstatus]} - ".i18n("Students / projects per age category / division")."

"; - echo ""; - echo ""; - foreach($cats AS $c=>$cn) { - echo ""; + echo ""; + echo ""; + echo ""; - echo ""; - foreach($divs AS $d=>$dn) { - echo ""; - $tstud=0; - $tproj=0; - foreach($cats AS $c=>$cn) - { - echo ""; - $tstud+=$stats_students_catdiv[$c][$d]; - $tproj+=$stats_projects_catdiv[$c][$d]; + echo ""; - $tstudcat[$c]+=$stats_students_catdiv[$c][$d]; - $tprojcat[$c]+=$stats_projects_catdiv[$c][$d]; - } - echo ""; - echo ""; - } - echo ""; - $tstud=0; - $tproj=0; - foreach($cats AS $c=>$cn) { - echo ""; - $tstud+=$tstudcat[$c]; - $tproj+=$tprojcat[$c]; - } - echo ""; - echo ""; - - echo "
$cn
".i18n("Stud | Proj")."
$schools$students"; + if($year==$config['FAIRYEAR']) { + echo "reg_id});return false\" >"; + echo ""; + echo ""; + + echo "
"; + echo ""; + echo "email\">"; + echo "reg_num\">"; + echo ""; + echo "
"; + + } - echo "
".i18n("Total")."
".i18n("Stud | Proj")."
$dn"; - echo ($stats_students_catdiv[$c][$d]?$stats_students_catdiv[$c][$d]:0); - echo "    "; - echo ($stats_projects_catdiv[$c][$d]?$stats_projects_catdiv[$c][$d]:0); - echo ""; - echo ($tstud?$tstud:0); - echo "    "; - echo ($tproj?$tproj:0); - echo "
".i18n("Total").""; - echo ($tstudcat[$c]?$tstudcat[$c]:0); - echo "    "; - echo ($tprojcat[$c]?$tprojcat[$c]:0); - echo ""; - echo ($tstud); - echo "    "; - echo ($tproj); - echo "
"; - echo "

{$status_str[$showstatus]} - ".i18n("Students / projects per age category / school")."

"; - echo ""; - echo ""; - foreach($cats AS $c=>$cn) { - echo ""; - } - echo ""; - echo ""; - - asort($schools_names); - foreach($schools_names AS $id=>$sn) - { - echo ""; - $tstud=0; - $tproj=0; - foreach($cats AS $c=>$cn) { - echo ""; - $tstud+=$stats_students_schools[$c][$id]; - $tproj+=$stats_projects_schools[$c][$id]; - } - echo ""; - echo ""; - } - echo "
$cn
".i18n("Stud | Proj")."
".i18n("Total")."
".i18n("Stud | Proj")."
$sn".($stats_students_schools[$c][$id]?$stats_students_schools[$c][$id]:0); - echo "    "; - echo ($stats_projects_schools[$c][$id]?$stats_projects_schools[$c][$id]:0)."".($tstud?$tstud:0); - echo "    "; - echo ($tproj?$tproj:0)."
"; - echo i18n("%1 schools total",array(count($schools_names))); - - echo "
"; - - echo "
"; - echo i18n("Note: statistics reflect the numbers of the current 'Status' selected at the top of the page"); - echo "
"; - echo "
"; - - send_footer(); +} ?> diff --git a/admin/student_editor.php b/admin/student_editor.php index d289091..f6e5ebc 100644 --- a/admin/student_editor.php +++ b/admin/student_editor.php @@ -70,7 +70,6 @@ function students_save() { global $registrations_id, $config; $x=1; - happy_("here!"); while($_POST["num"][$x]) { if($_POST['id'][$x]==0) { //if they use schoolpassword or singlepassword, then we need to set the school based on the school stored in the registration record. for anything else they can school the school on their own.