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('user.inc.php');
|
||||||
require_once('judge.inc.php');
|
require_once('judge.inc.php');
|
||||||
|
|
||||||
if($_SESSION['embed'] == true) {
|
/* Sort out who we're editting */
|
||||||
user_auth_required('committee');
|
if($_POST['users_id'])
|
||||||
$u = user_load($_SESSION['embed_edit_id']);
|
$eid = intval($_POST['users_id']); /* From a save form */
|
||||||
} else {
|
else if(array_key_exists('embed_edit_id', $_SESSION))
|
||||||
user_auth_required('judge');
|
$eid = $_SESSION['embed_edit_id']; /* From the embedded editor */
|
||||||
$u = user_load($_SESSION['users_id']);
|
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();
|
$times = array();
|
||||||
|
|
||||||
/* Load the judging rounds */
|
/* 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']}'");
|
mysql_query("DELETE FROM judges_availability WHERE users_id='{$u['id']}'");
|
||||||
|
|
||||||
if(is_array($_POST['time']) ) {
|
if(is_array($_POST['time']) ) {
|
||||||
@ -71,13 +80,13 @@ if($_POST['action']=='save') {
|
|||||||
'{$times[$x]['starttime']}','{$times[$x]['endtime']}')");
|
'{$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) {
|
if($_SESSION['embed'] == true) {
|
||||||
echo "<br />";
|
|
||||||
display_messages();
|
display_messages();
|
||||||
echo "<h3>".i18n('Time Availability')."</h3>";
|
echo "<h4>".i18n('Time Availability')."</h4>";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
} else {
|
} else {
|
||||||
//send the header
|
//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);
|
judge_status_update($u);
|
||||||
|
|
||||||
if($_SESSION['embed'] != true) {
|
if($_SESSION['embed'] != true) {
|
||||||
@ -97,13 +117,12 @@ if($_SESSION['embed'] != true) {
|
|||||||
echo happy(i18n("Time Availability Preferences Complete"));
|
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";
|
<form id="judgeavailability_form" >
|
||||||
|
<input type="hidden" name="users_id" value="<?=$u['id']?>" />
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
<br />
|
||||||
|
<table>
|
||||||
echo "<br />";
|
<?
|
||||||
|
|
||||||
/* Get all their available times */
|
/* Get all their available times */
|
||||||
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id=\"{$u['id']}\" ORDER BY `start`");
|
$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) {
|
foreach($times as $x=>$t) {
|
||||||
$ch = $sel[$x] == true ? 'checked="checked"' : '';
|
$ch = $sel[$x] == true ? 'checked="checked"' : '';
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
@ -127,14 +145,14 @@ foreach($times as $x=>$t) {
|
|||||||
echo "<tr><td></td><td><p>{$t['name']}</td>";
|
echo "<tr><td></td><td><p>{$t['name']}</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
echo "</table>";
|
</table>
|
||||||
echo "<br />";
|
<br />
|
||||||
echo "<br />";
|
<br />
|
||||||
|
|
||||||
echo "<input type=\"submit\" value=\"".i18n("Save Time Availability Preferences")."\" />\n";
|
<input type="submit" onclick="judgeavailability_save();return false;" value="<?=i18n("Save Time Availability Preferences")?>" />
|
||||||
echo "</form>";
|
</form>
|
||||||
|
|
||||||
if($_SESSION['embed'] != true) send_footer();
|
<?
|
||||||
|
if($_SESSION['embed'] != true) send_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -26,14 +26,24 @@
|
|||||||
require_once('user.inc.php');
|
require_once('user.inc.php');
|
||||||
require_once('judge.inc.php');
|
require_once('judge.inc.php');
|
||||||
|
|
||||||
if($_SESSION['embed'] == true) {
|
/* Sort out who we're editting */
|
||||||
$u = user_load($_SESSION['embed_edit_id']);
|
if($_POST['users_id'])
|
||||||
} else {
|
$eid = intval($_POST['users_id']); /* From a save form */
|
||||||
$u = user_load($_SESSION['users_id']);
|
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..
|
//first delete all their old associations for this year..
|
||||||
mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id='{$u['id']}'");
|
mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id='{$u['id']}'");
|
||||||
|
|
||||||
@ -43,13 +53,13 @@
|
|||||||
VALUES ('{$u['id']}','$aid')");
|
VALUES ('{$u['id']}','$aid')");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message_push(notice(i18n("Special Award preferences successfully saved")));
|
happy_("Special Award preferences successfully saved");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_SESSION['embed'] == true) {
|
if($_SESSION['embed'] == true) {
|
||||||
echo "<br />";
|
|
||||||
display_messages();
|
display_messages();
|
||||||
echo "<h3>".i18n('Special Awards')."</h3>";
|
echo "<h4>".i18n('Special Awards')."</h4>";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
} else {
|
} else {
|
||||||
//send the header
|
//send the header
|
||||||
@ -57,6 +67,15 @@
|
|||||||
array('Judge Registration' => 'judge_main.php')
|
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);
|
judge_status_update($u);
|
||||||
|
|
||||||
@ -69,12 +88,12 @@ if($_SESSION['embed'] != true) {
|
|||||||
echo happy(i18n("Special Award Preferences Complete"));
|
echo happy(i18n("Special Award Preferences Complete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_SESSION['embed'] == true) {
|
?>
|
||||||
echo "<form name=\"specialawardform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
|
|
||||||
} else {
|
<form id="judgespecialawards_form">
|
||||||
echo "<form name=\"specialawardform\" method=\"post\" action=\"judge_special_awards.php\">\n";
|
<input type="hidden" name="users_id" value="<?=$u['id']?>" />
|
||||||
}
|
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
<?
|
||||||
if($u['special_award_only'] == 'yes') {
|
if($u['special_award_only'] == 'yes') {
|
||||||
echo i18n("Please select the special award you are supposed to judge.");
|
echo i18n("Please select the special award you are supposed to judge.");
|
||||||
} else {
|
} else {
|
||||||
@ -112,24 +131,24 @@ if($_SESSION['embed'] == true) {
|
|||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q))
|
||||||
{
|
{
|
||||||
echo "<tr><td rowspan=\"2\">";
|
?>
|
||||||
$ch = (in_array($r->id,$spawards)) ? "checked=\"checked\"" : "";
|
<tr><td rowspan=\"2\">
|
||||||
echo "<input onclick=\"checkboxclicked(this)\" $ch type=\"checkbox\" name=\"spaward[]\" value=\"{$r->id}\" />";
|
<? $ch = (in_array($r->id,$spawards)) ? "checked=\"checked\"" : ""; ?>
|
||||||
echo "</td><td>";
|
<input onclick="checkboxclicked(this)" <?=$ch?> type="checkbox" name="spaward[]" value="<?=$r->id?>" />
|
||||||
echo "<b>{$r->name}</b> ({$r->organization})";
|
</td><td>
|
||||||
echo "</td></tr>";
|
<b><?=$r->name?></b> (<?=$r->organization?>)</td>
|
||||||
echo "<tr><td>";
|
</tr><tr>
|
||||||
echo "{$r->criteria}";
|
<td><?=$r->criteria?>
|
||||||
echo "<br /><br />";
|
<br /><br /></td>
|
||||||
echo "</td></tr>";
|
</tr>
|
||||||
|
<?
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>";
|
?>
|
||||||
|
</table>
|
||||||
echo "<input type=\"submit\" value=\"".i18n("Save Special Award Preferences")."\" />\n";
|
<input type="submit" onclick="judgespecialawards_save();return false;" value="<?=i18n("Save Special Award Preferences")?>" />
|
||||||
echo "</form>";
|
</form>
|
||||||
|
|
||||||
|
<?
|
||||||
if($_SESSION['embed'] != true) send_footer();
|
if($_SESSION['embed'] != true) send_footer();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user