forked from science-ation/science-ation
- fixup availablity and special awards selection
This commit is contained in:
parent
c3e6e42d62
commit
64dba39a57
@ -27,14 +27,22 @@ require_once('common.inc.php');
|
||||
require_once('user.inc.php');
|
||||
require_once('judge.inc.php');
|
||||
|
||||
if($_SESSION['embed'] == true) {
|
||||
user_auth_required('committee');
|
||||
$u = user_load($_SESSION['embed_edit_id']);
|
||||
} else {
|
||||
user_auth_required('judge');
|
||||
$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);
|
||||
|
||||
$times = array();
|
||||
|
||||
/* Load the judging rounds */
|
||||
@ -58,7 +66,8 @@ while($r = mysql_fetch_object($q)) {
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['action']=='save') {
|
||||
switch($_GET['action']) {
|
||||
case 'save':
|
||||
mysql_query("DELETE FROM judges_availability WHERE users_id='{$u['id']}'");
|
||||
|
||||
if(is_array($_POST['time']) ) {
|
||||
@ -71,13 +80,13 @@ if($_POST['action']=='save') {
|
||||
'{$times[$x]['starttime']}','{$times[$x]['endtime']}')");
|
||||
}
|
||||
}
|
||||
message_push(notice(i18n("Time Availability preferences successfully saved")));
|
||||
happy_("Time Availability preferences successfully saved");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['embed'] == true) {
|
||||
echo "<br />";
|
||||
display_messages();
|
||||
echo "<h3>".i18n('Time Availability')."</h3>";
|
||||
echo "<h4>".i18n('Time Availability')."</h4>";
|
||||
echo "<br />";
|
||||
} else {
|
||||
//send the header
|
||||
@ -86,6 +95,17 @@ if($_SESSION['embed'] == true) {
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function judgeavailability_save()
|
||||
{
|
||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_availability.php?action=save", $("#judgeavailability_form").serializeArray());
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
|
||||
|
||||
judge_status_update($u);
|
||||
|
||||
if($_SESSION['embed'] != true) {
|
||||
@ -97,13 +117,12 @@ if($_SESSION['embed'] != true) {
|
||||
echo happy(i18n("Time Availability Preferences Complete"));
|
||||
}
|
||||
|
||||
$url = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'judge_availability.php';
|
||||
echo "<form name=\"availabilityform\" method=\"post\" action=\"$url\">\n";
|
||||
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
|
||||
echo "<br />";
|
||||
|
||||
?>
|
||||
<form id="judgeavailability_form" >
|
||||
<input type="hidden" name="users_id" value="<?=$u['id']?>" />
|
||||
<br />
|
||||
<table>
|
||||
<?
|
||||
/* Get all their available times */
|
||||
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id=\"{$u['id']}\" ORDER BY `start`");
|
||||
|
||||
@ -116,7 +135,6 @@ while($r=mysql_fetch_object($q)) {
|
||||
}
|
||||
}
|
||||
|
||||
echo "<table>\n";
|
||||
foreach($times as $x=>$t) {
|
||||
$ch = $sel[$x] == true ? 'checked="checked"' : '';
|
||||
echo "<tr><td>";
|
||||
@ -127,14 +145,14 @@ foreach($times as $x=>$t) {
|
||||
echo "<tr><td></td><td><p>{$t['name']}</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Time Availability Preferences")."\" />\n";
|
||||
echo "</form>";
|
||||
|
||||
if($_SESSION['embed'] != true) send_footer();
|
||||
|
||||
?>
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<input type="submit" onclick="judgeavailability_save();return false;" value="<?=i18n("Save Time Availability Preferences")?>" />
|
||||
</form>
|
||||
|
||||
<?
|
||||
if($_SESSION['embed'] != true) send_footer();
|
||||
?>
|
||||
|
@ -26,14 +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');
|
||||
}
|
||||
|
||||
if($_POST['action']=="save") {
|
||||
$u = user_load($eid);
|
||||
|
||||
switch($_GET['action']) {
|
||||
case 'save':
|
||||
//first delete all their old associations for this year..
|
||||
mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id='{$u['id']}'");
|
||||
|
||||
@ -43,13 +53,13 @@
|
||||
VALUES ('{$u['id']}','$aid')");
|
||||
}
|
||||
}
|
||||
message_push(notice(i18n("Special Award preferences successfully saved")));
|
||||
happy_("Special Award preferences successfully saved");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['embed'] == true) {
|
||||
echo "<br />";
|
||||
display_messages();
|
||||
echo "<h3>".i18n('Special Awards')."</h3>";
|
||||
echo "<h4>".i18n('Special Awards')."</h4>";
|
||||
echo "<br />";
|
||||
} else {
|
||||
//send the header
|
||||
@ -57,6 +67,15 @@
|
||||
array('Judge Registration' => 'judge_main.php')
|
||||
);
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function judgespecialawards_save()
|
||||
{
|
||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_special_awards.php?action=save", $("#judgespecialawards_form").serializeArray());
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?
|
||||
|
||||
judge_status_update($u);
|
||||
|
||||
@ -69,12 +88,12 @@ if($_SESSION['embed'] != true) {
|
||||
echo happy(i18n("Special Award Preferences Complete"));
|
||||
}
|
||||
|
||||
if($_SESSION['embed'] == true) {
|
||||
echo "<form name=\"specialawardform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
|
||||
} else {
|
||||
echo "<form name=\"specialawardform\" method=\"post\" action=\"judge_special_awards.php\">\n";
|
||||
}
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
?>
|
||||
|
||||
<form id="judgespecialawards_form">
|
||||
<input type="hidden" name="users_id" value="<?=$u['id']?>" />
|
||||
|
||||
<?
|
||||
if($u['special_award_only'] == 'yes') {
|
||||
echo i18n("Please select the special award you are supposed to judge.");
|
||||
} else {
|
||||
@ -112,24 +131,24 @@ if($_SESSION['embed'] == true) {
|
||||
echo mysql_error();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr><td rowspan=\"2\">";
|
||||
$ch = (in_array($r->id,$spawards)) ? "checked=\"checked\"" : "";
|
||||
echo "<input onclick=\"checkboxclicked(this)\" $ch type=\"checkbox\" name=\"spaward[]\" value=\"{$r->id}\" />";
|
||||
echo "</td><td>";
|
||||
echo "<b>{$r->name}</b> ({$r->organization})";
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>";
|
||||
echo "{$r->criteria}";
|
||||
echo "<br /><br />";
|
||||
echo "</td></tr>";
|
||||
?>
|
||||
<tr><td rowspan=\"2\">
|
||||
<? $ch = (in_array($r->id,$spawards)) ? "checked=\"checked\"" : ""; ?>
|
||||
<input onclick="checkboxclicked(this)" <?=$ch?> type="checkbox" name="spaward[]" value="<?=$r->id?>" />
|
||||
</td><td>
|
||||
<b><?=$r->name?></b> (<?=$r->organization?>)</td>
|
||||
</tr><tr>
|
||||
<td><?=$r->criteria?>
|
||||
<br /><br /></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Special Award Preferences")."\" />\n";
|
||||
echo "</form>";
|
||||
|
||||
|
||||
if($_SESSION['embed'] != true) send_footer();
|
||||
|
||||
?>
|
||||
</table>
|
||||
<input type="submit" onclick="judgespecialawards_save();return false;" value="<?=i18n("Save Special Award Preferences")?>" />
|
||||
</form>
|
||||
|
||||
<?
|
||||
if($_SESSION['embed'] != true) send_footer();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user