forked from science-ation/science-ation
- Fix expertise
This commit is contained in:
parent
211b5be1a5
commit
c3e6e42d62
@ -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 "<br />";
|
||||
display_messages();
|
||||
// echo "<h3>".i18n('Category and Division Preferences')."</h3>";
|
||||
echo "<br />";
|
||||
} else {
|
||||
//send the header
|
||||
send_header('Category and Division Preferences',
|
||||
@ -78,6 +85,17 @@
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function judgeexpertise_save()
|
||||
{
|
||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_expertise.php?action=save", $("#judgeexpertise_form").serializeArray());
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
|
||||
|
||||
judge_status_update($u);
|
||||
|
||||
if($_SESSION['embed'] != true) {
|
||||
@ -96,21 +114,18 @@ if($_SESSION['embed'] != true) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['embed'] == true) {
|
||||
echo "<form name=\"expertiseform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
|
||||
} else {
|
||||
echo "<form name=\"expertiseform\" method=\"post\" action=\"judge_expertise.php\">\n";
|
||||
}
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade");
|
||||
echo "<h3>".i18n("Age Category Preferences")."</h3><br>";
|
||||
echo "<table>";
|
||||
echo "<form name=\"expertiseform\" id=\"judgeexpertise_form\">\n";
|
||||
echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
|
||||
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade");
|
||||
echo "<h4>".i18n("Age Category Preferences")."</h4><br>";
|
||||
echo "<table class=\"tableedit\" >";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr><td> ";
|
||||
echo "<tr><td class=\"left\" >";
|
||||
echo i18n("%1 (Grades %2-%3)",array(i18n($r->category),$r->mingrade,$r->maxgrade));
|
||||
echo "</td>";
|
||||
echo ":</td>";
|
||||
echo "<td>";
|
||||
echo "<select name=\"catpref[$r->id]\">";
|
||||
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
||||
@ -130,9 +145,7 @@ if($_SESSION['embed'] == true) {
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<h3>".i18n("Division Expertise")."</h3><br>";
|
||||
echo "<table>";
|
||||
|
||||
echo "<h4>".i18n("Division Expertise")."</h4><br>";
|
||||
|
||||
|
||||
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 "<br />";
|
||||
echo "<br />";
|
||||
|
||||
// echo "<table>\n";
|
||||
|
||||
echo "<table>\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 "<tr><th></th>";
|
||||
for($x=1;$x<=5;$x++)
|
||||
echo "<th>$x</th>";
|
||||
echo "<th></th>";
|
||||
echo "</tr>";
|
||||
$first = false;
|
||||
}
|
||||
@ -167,7 +178,7 @@ if($_SESSION['embed'] == true) {
|
||||
$sel = ($u['div_prefs'][$r->id]==$x) ? "checked=\"checked\"" : '';
|
||||
echo "<td width=\"30\"><input onclick=\"fieldChanged()\" $sel type=\"radio\" name=\"division[$r->id]\" value=\"$x\" /></td>";
|
||||
}
|
||||
echo "<td width=\"100\"></td>";
|
||||
// echo "<td width=\"100\"></td>";
|
||||
echo "</tr>";
|
||||
|
||||
//only show the sub-divisions if the 'main' division is scored >=3
|
||||
@ -187,17 +198,18 @@ if($_SESSION['embed'] == true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
echo "<h3>".i18n("Other Areas of Expertise not listed above")."</h3>";
|
||||
echo "<textarea name=\"expertise_other\" rows=\"4\" cols=\"60\">".htmlspecialchars($u['expertise_other'])."</textarea>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Judging Preferences")."\" />\n";
|
||||
echo "</form>";
|
||||
?>
|
||||
</table>
|
||||
<br />
|
||||
<h4><?=i18n("Other Areas of Expertise not listed above")?></h4>
|
||||
<textarea name="expertise_other" rows="4" cols="60"><?=htmlspecialchars($u['expertise_other'])?></textarea>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<input type="submit" onclick="judgeexpertise_save();return false;" value="<?=i18n("Save Judging Preferences")?>" />
|
||||
</form>
|
||||
|
||||
<?
|
||||
if($_SESSION['embed'] != true) send_footer();
|
||||
|
||||
?>
|
||||
|
@ -66,7 +66,7 @@ case 'save':
|
||||
if($_SESSION['embed'] == true) {
|
||||
echo "<br />";
|
||||
display_messages();
|
||||
echo "<h3>".i18n('Other Information')."</h3>";
|
||||
echo "<h4>".i18n('Other Information')."</h4>";
|
||||
echo "<br />";
|
||||
} else {
|
||||
//send the header
|
||||
|
Loading…
x
Reference in New Issue
Block a user