diff --git a/judge_expertise.php b/judge_expertise.php index e7e56163..2e228fd1 100644 --- a/judge_expertise.php +++ b/judge_expertise.php @@ -26,15 +26,24 @@ require_once('user.inc.php'); require_once('judge.inc.php'); - if($_SESSION['embed'] == true) { - $u = user_load($_SESSION['embed_edit_id']); - } else { - $u = user_load($_SESSION['users_id']); - } +/* Sort out who we're editting */ +if($_POST['users_id']) + $eid = intval($_POST['users_id']); /* From a save form */ +else if(array_key_exists('embed_edit_id', $_SESSION)) + $eid = $_SESSION['embed_edit_id']; /* From the embedded editor */ +else + $eid = $_SESSION['users_id']; /* Regular entry */ +if($eid != $_SESSION['users_id']) { + /* Not editing ourself, we had better be + * a committee member */ + user_auth_required('committee','admin'); +} + +$u = user_load($eid); - if($_POST['action']=="save") - { +switch($_GET['action']) { +case 'save': if(!is_array($_POST['division'])) $_POST['division']=array(); if(!is_array($_POST['subdivision'])) @@ -62,15 +71,13 @@ } } user_save($u); - message_push(notice(i18n("Preferences successfully saved"))); - $u = user_load($u['id']); - } + happy_("Preferences successfully saved"); + exit; +} + if($_SESSION['embed'] == true) { - echo "
"; display_messages(); -// echo "

".i18n('Category and Division Preferences')."

"; - echo "
"; } else { //send the header send_header('Category and Division Preferences', @@ -78,6 +85,17 @@ ); } +?> + +\n"; -} else { - echo "
\n"; -} - echo "\n"; - $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade"); - echo "

".i18n("Age Category Preferences")."


"; - echo ""; +echo "\n"; +echo "\n"; + + $q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade"); + echo "

".i18n("Age Category Preferences")."


"; + echo "
"; while($r=mysql_fetch_object($q)) { - echo ""; + echo ":"; echo "
    "; + echo "
"; echo i18n("%1 (Grades %2-%3)",array(i18n($r->category),$r->mingrade,$r->maxgrade)); - echo ""; echo "
"; echo "
"; echo "
"; - echo "

".i18n("Division Expertise")."


"; - echo ""; - + echo "

".i18n("Division Expertise")."


"; echo i18n("Please rank the following divisions according to the amount of knowledge you have of each subject. A '1' indicates very little knowledge, and a '5' indicates you are very knowledgeable of the subject"); @@ -142,11 +155,10 @@ if($_SESSION['embed'] == true) { echo "
"; echo "
"; -// echo "
\n"; - + echo "
\n"; //query all of the categories - $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division"); + $q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY division"); $first = true; while($r=mysql_fetch_object($q)) { @@ -156,7 +168,6 @@ if($_SESSION['embed'] == true) { echo ""; for($x=1;$x<=5;$x++) echo ""; - echo ""; echo ""; $first = false; } @@ -167,7 +178,7 @@ if($_SESSION['embed'] == true) { $sel = ($u['div_prefs'][$r->id]==$x) ? "checked=\"checked\"" : ''; echo ""; } - echo ""; +// echo ""; echo ""; //only show the sub-divisions if the 'main' division is scored >=3 @@ -187,17 +198,18 @@ if($_SESSION['embed'] == true) { } } } - echo "
$x
id]\" value=\"$x\" />
"; - echo "
"; - echo "

".i18n("Other Areas of Expertise not listed above")."

"; - echo ""; - echo "
"; - echo "
"; - - echo "\n"; - echo "
"; +?> + +
+

+ +
+
+" /> + + diff --git a/judge_other.php b/judge_other.php index 195208ca..8102bcbc 100644 --- a/judge_other.php +++ b/judge_other.php @@ -66,7 +66,7 @@ case 'save': if($_SESSION['embed'] == true) { echo "
"; display_messages(); - echo "

".i18n('Other Information')."

"; + echo "

".i18n('Other Information')."

"; echo "
"; } else { //send the header