diff --git a/admin/project_editor.php b/admin/project_editor.php
index 9e7aced..03bd527 100644
--- a/admin/project_editor.php
+++ b/admin/project_editor.php
@@ -55,7 +55,7 @@ if($auth_type == 'fair') {
switch($action) {
case 'project_load':
- project_load();
+ project_load2();
break;
case 'project_regenerate_number':
/* Save first */
@@ -123,7 +123,7 @@ function project_save()
"projectsort='".mysql_escape_string(stripslashes($_POST['projectsort']))."'".
"WHERE id='".intval($_POST['id'])."'");
echo mysql_error();
- happy_("Project information successfully updated");
+ happy_('Project Information Saved');
//check if they changed the project number
if($_POST['projectnumber']!=$projectinfo->projectnumber) {
@@ -141,31 +141,24 @@ function project_save()
}
-function project_load()
+function project_load2()
{
global $registrations_id, $config, $conference;
- //now lets find out their MAX grade, so we can pre-set the Age Category
- $q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$registrations_id."'");
- $gradeinfo=mysql_fetch_object($q);
-
- //now lets grab all the age categories, so we can choose one based on the max grade
- $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
- while($r=mysql_fetch_object($q)) {
- //save these in an array, just incase we need them later (FIXME: remove this array if we dont need it)
- $agecategories[$r->id]['category']=$r->category;
- $agecategories[$r->id]['mingrade']=$r->mingrade;
- $agecategories[$r->id]['maxgrade']=$r->maxgrade;
-
- if($gradeinfo->maxgrade >= $r->mingrade && $gradeinfo->maxgrade <= $r->maxgrade)
- $projectcategories_id=$r->id;
- }
-
+ $projectcategories_id=getProjectCategory($registrations_id);
//now select their project info
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND conferences_id='".$conference['id']."'");
//check if it exists, if we didnt find any record, lets insert one
$projectinfo=mysql_fetch_object($q);
+ $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id");
+ while($r=mysql_fetch_object($q)) {
+ //save these in an array, so we can use them below
+ $agecategories[$r->id]['category']=$r->category;
+ $agecategories[$r->id]['mingrade']=$r->mingrade;
+ $agecategories[$r->id]['maxgrade']=$r->maxgrade;
+ }
+
//make sure that if they changed their grade on the student page, we update their projectcategories_id accordingly
if($projectcategories_id && $projectinfo->projectcategories_id!=$projectcategories_id) {
echo notice(i18n("Age category changed, updating to %1",array($agecategories[$projectcategories_id]['category'])));
diff --git a/admin/registration_list.php b/admin/registration_list.php
index f8975c8..b17ac44 100644
--- a/admin/registration_list.php
+++ b/admin/registration_list.php
@@ -57,7 +57,7 @@ case 'delete':
mysql_query("DELETE FROM winners WHERE projects_id='{$p['id']}'");
}
mysql_query("DELETE FROM registrations WHERE id='$regid' AND conferences_id='".$conference['id']."'");
- mysql_query("DELETE FROM students WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
+ mysql_query("DELETE FROM users WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM projects WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
mysql_query("DELETE FROM safety WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
// mysql_query("DELETE FROM questions_answers WHERE registrations_id='$regid' AND conferences_id='".$conference['id']."'");
@@ -300,18 +300,15 @@ $(document).ready(function() {
selected: -1
});
+/*
$("#newproject").click(function() {
popup_editor(-1);
}
);
+ */
});
-THIS PAGE IS NOT YET UPDATED TO THE NEW SYSTEM. PLEASE DO NOT USE IT
-
-send_footer();
-exit;
-?>
@@ -335,7 +332,9 @@ exit; } ?> | -+ + // echo | \n"; + ?> |
".i18n("Status")." | "; -echo "".i18n("Email Address")." | "; echo "".i18n("Reg Num")." | "; echo "".i18n("Proj Num")." | "; echo "".i18n("Project Title")." | "; echo "".i18n("Age Category")." | "; echo "".i18n("Division")." | "; -echo "".i18n("School(s)")." | "; -echo "".i18n("Student(s)")." | "; +echo "".i18n("Participant Details")." | "; echo "".i18n("Action")." | "; echo "{$status_text} | "; - echo "{$r->email} | "; +// echo "{$r->email} | "; echo "{$r->reg_num} | "; $pn = str_replace(' ', ' ', $r->projectnumber); echo "$pn | "; @@ -446,44 +442,66 @@ function print_row($r) echo "".i18n($cats[$r->projectcategories_id])." | "; echo "".i18n($divs[$r->projectdivisions_id])." | "; - $sq=mysql_query("SELECT students.firstname, - students.lastname, - students.id, + echo "";
+
+ $sq=mysql_query("SELECT users.firstname,
+ users.lastname,
+ users.id,
schools.school,
schools.board,
- schools.id AS schools_id
+ schools.id AS schools_id,
+ accounts.username,
+ accounts.email,
+ accounts.pendingemail
FROM
- students,schools
+ users
+ JOIN accounts ON users.accounts_id=accounts.id
+ LEFT JOIN schools ON users.schools_id=schools.id
WHERE
- students.registrations_id='$r->reg_id'
- AND
- students.schools_id=schools.id
+ users.registrations_id='$r->reg_id'
");
echo mysql_error();
$studnum=1;
$schools="";
$students="";
- while($studentinfo=mysql_fetch_object($sq))
- {
- $students.="$studentinfo->firstname $studentinfo->lastname "; - $schools.="$studentinfo->school "; - } + $scl = "style=\"cursor:pointer;\" onclick=\"popup_editor('{$r->reg_id}','');\""; + //if theres more than 1, we should show some headings between the tables + if(mysql_num_rows($sq)>1) $showheadings=true; + + while($studentinfo=mysql_fetch_object($sq)) { + if($studentinfo->email) $e=$studentinfo->email; + else if($studentinfo->pendingemail) $e=$studentinfo->pendingemail; + else $e=""; + if($showheadings) + echo "Participant #$studnum "; + + echo "
| ";
+
- echo "$schools | "; - echo "$students | "; echo ""; if($conference_id==$conference['id']) { echo "reg_id});return false\" >"; echo ""; echo ""; - - echo ""; + /* + echo ""; + */ } diff --git a/admin/student_editor.php b/admin/student_editor.php index 1fe962f..39aa3c5 100644 --- a/admin/student_editor.php +++ b/admin/student_editor.php @@ -113,8 +113,10 @@ function students_save() $schoolvalue="'".mysql_escape_string(stripslashes($_POST['schools_id'][$x]))."', "; } //INSERT new record + //FIXME: we don't do this yet, rather, we need to check if the account exists, add it if not, then account_add_role() + /* $dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x]; - mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,email,address,city,province,postalcode,phone,dateofbirth,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,conferences_id) VALUES (". + mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,email,address,city,province,postalcode,phonehome,birthdate,grade,schools_id,tshirt,medicalalert,foodreq,teachername,teacheremail,conferences_id) VALUES (". "'".$registrations_id."', ". "'".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ". @@ -124,7 +126,7 @@ function students_save() "'".mysql_escape_string(stripslashes($_POST['city'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['province'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['postalcode'][$x]))."', ". - "'".mysql_escape_string(stripslashes($_POST['phone'][$x]))."', ". + "'".mysql_escape_string(stripslashes($_POST['phonehome'][$x]))."', ". "'$dob', ". "'".mysql_escape_string(stripslashes($_POST['grade'][$x]))."', ". $schoolvalue. @@ -134,6 +136,7 @@ function students_save() "'".mysql_escape_string(stripslashes($_POST['teachername'][$x]))."', ". "'".mysql_escape_string(stripslashes($_POST['teacheremail'][$x]))."', ". "'".$conference['id']."')"); + */ happy_("%1 %2 successfully added",array($_POST['firstname'][$x],$_POST['lastname'][$x])); @@ -150,7 +153,7 @@ function students_save() //UPDATE existing record $dob=$_POST['year'][$x]."-".$_POST['month'][$x]."-".$_POST['day'][$x]; - mysql_query("UPDATE students SET ". + mysql_query("UPDATE users SET ". "firstname='".mysql_escape_string(stripslashes($_POST['firstname'][$x]))."', ". "lastname='".mysql_escape_string(stripslashes($_POST['lastname'][$x]))."', ". "sex='".mysql_escape_string(stripslashes($_POST['sex'][$x]))."', ". @@ -159,17 +162,20 @@ function students_save() "city='".mysql_escape_string(stripslashes($_POST['city'][$x]))."', ". "province='".mysql_escape_string(stripslashes($_POST['province'][$x]))."', ". "postalcode='".mysql_escape_string(stripslashes($_POST['postalcode'][$x]))."', ". - "phone='".mysql_escape_string(stripslashes($_POST['phone'][$x]))."', ". - "dateofbirth='$dob', ". + "phonehome='".mysql_escape_string(stripslashes($_POST['phonehome'][$x]))."', ". + "birthdate='$dob', ". "grade='".mysql_escape_string(stripslashes($_POST['grade'][$x]))."', ". $schoolquery. "medicalalert='".mysql_escape_string(stripslashes($_POST['medicalalert'][$x]))."', ". "foodreq='".mysql_escape_string(stripslashes($_POST['foodreq'][$x]))."', ". - "teachername='".mysql_escape_string(stripslashes($_POST['teachername'][$x]))."', ". - "teacheremail='".mysql_escape_string(stripslashes($_POST['teacheremail'][$x]))."', ". "tshirt='".mysql_escape_string(stripslashes($_POST['tshirt'][$x]))."' ". "WHERE id='".$_POST['id'][$x]."'"); + if(mysql_error()) { + error_("error: %1",array(mysql_error())); + } + else { happy_("%1 %2 successfully updated",array($_POST['firstname'][$x],$_POST['lastname'][$x])); + } } $x++; } @@ -181,7 +187,7 @@ function students_load() global $registrations_id, $config, $conference; //now query and display - $q=mysql_query("SELECT * FROM students WHERE + $q=mysql_query("SELECT * FROM users WHERE registrations_id='$registrations_id' AND conferences_id='{$conference['id']}'"); echo mysql_error(); @@ -192,12 +198,13 @@ function students_load() if($numtoshow == 0) $numtoshow=$numfound; + /* echo ""; + */ echo " |
---|