forked from science-ation/science-ation
judge main questions
This commit is contained in:
parent
9f3dc6c9dc
commit
b4a021411d
226
judge_other.php
226
judge_other.php
@ -22,26 +22,22 @@
|
|||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<?
|
<?
|
||||||
require_once('common.inc.php');
|
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');
|
||||||
require_once("questions.inc.php");
|
require_once("questions.inc.php");
|
||||||
|
require_once('user_edit.inc.php');
|
||||||
|
|
||||||
/* Sort out who we're editting */
|
/* Ensure they're logged in as a judge or admin */
|
||||||
if($_POST['users_id'])
|
user_auth_required(array(), array('judge','admin'));
|
||||||
$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']) {
|
$edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id'];
|
||||||
/* Not editing ourself, we had better be
|
if($edit_id != $_SESSION['users_id'])
|
||||||
* a committee member */
|
user_auth_required('admin');
|
||||||
user_auth_required('committee','admin');
|
else
|
||||||
}
|
user_auth_required();
|
||||||
|
|
||||||
$u = user_load($eid);
|
$u = user_load($edit_id);
|
||||||
|
|
||||||
switch($_GET['action']) {
|
switch($_GET['action']) {
|
||||||
case 'save':
|
case 'save':
|
||||||
@ -59,123 +55,123 @@ case 'save':
|
|||||||
$u['highest_psd'] = stripslashes($_POST['highest_psd']);
|
$u['highest_psd'] = stripslashes($_POST['highest_psd']);
|
||||||
|
|
||||||
user_save($u);
|
user_save($u);
|
||||||
questions_save_answers("judgereg",$u['id'],$_POST['questions']);
|
|
||||||
|
questions_save_answers("judgereg",$u['id'],$_POST['questions']);
|
||||||
happy_("Preferences successfully saved");
|
happy_("Preferences successfully saved");
|
||||||
|
|
||||||
$u=user_load($eid);
|
$u = user_load($u['id']);
|
||||||
$newstatus=judge_status_other($u);
|
$newstatus=judge_status_other($u);
|
||||||
echo "<script type=\"text/javascript\">";
|
?>
|
||||||
echo "other_update_status('$newstatus');\n";
|
<script type="text/javascript">
|
||||||
echo "</script>\n";
|
user_update_tab_status('judge','<?=$newstatus?>');
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_SESSION['embed'] == true) {
|
$fields = array('languages[]', 'years_school','years_regional','years_national','willing_chair','highest_psd');
|
||||||
echo "<br />";
|
$required = array('languages[]');
|
||||||
display_messages();
|
|
||||||
echo "<h3>".i18n('Other Information')."</h3>";
|
|
||||||
echo "<br />";
|
|
||||||
} else {
|
|
||||||
//send the header
|
|
||||||
send_header('Other Information',
|
|
||||||
array('Judge Registration' => 'judge_main.php')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$newstatus=judge_status_other($u);
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<h4><?=i18n("Judge Information")?> - <span class="status_judge"></span></h4>
|
||||||
function judgeother_save()
|
|
||||||
{
|
|
||||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_other.php?action=save", $("#judgeother_form").serializeArray());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function other_update_status(s) {
|
<form class="editor" id="judgeother_form">
|
||||||
if(s!='complete') {
|
<table width="90%">
|
||||||
$("#other_info_status").html('<?=error(i18n("Other Information Incomplete"))?>');
|
<tr><td style="text-align: left" colspan="2"><b><?=i18n('Judging Language(s)')?></b><hr /></td></tr>
|
||||||
}
|
<tr><?=user_edit_item($u, 'Languages', 'languages[]', 'languages')?></tr>
|
||||||
else
|
|
||||||
$("#other_info_status").html('<?=happy(i18n("Other Information Complete"))?>');
|
|
||||||
}
|
|
||||||
|
|
||||||
//when we're ready, output the status
|
|
||||||
$(document).ready( function() { other_update_status('<?=$newstatus?>');});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<?
|
|
||||||
judge_status_update($u);
|
|
||||||
echo "<div id=\"other_info_status\"></div>\n";
|
|
||||||
?>
|
|
||||||
<form name="otherform" id="judgeother_form">
|
|
||||||
<input type="hidden" name="users_id" value="<?=$u['id']?>">
|
|
||||||
<table class="editor">
|
|
||||||
<tr>
|
|
||||||
<td style="width:35%"><?=i18n("I can judge in the following languages")." ".REQUIREDFIELD?>: </td>
|
|
||||||
<td>
|
|
||||||
<?
|
|
||||||
$q=mysql_query("SELECT * FROM languages WHERE active='Y' ORDER BY langname");
|
|
||||||
echo mysql_error();
|
|
||||||
while($r=mysql_fetch_object($q))
|
|
||||||
{
|
|
||||||
$ch = (in_array($r->lang,$u['languages'])) ? 'checked="checked"' : '';
|
|
||||||
echo "<input onclick=\"fieldChanged()\" $ch type=\"checkbox\" name=\"languages[]\" value=\"$r->lang\" /> $r->langname <br />";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
<tr><td style="text-align: left" colspan="2"><br /><b><?=i18n('Judging Experience')?></b><hr />
|
||||||
|
<i><?=i18n('Please specify the number of years you\'ve judged at the following levels. This helps balance the experience on judging teams.')?></i>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<?
|
<tr><?=user_edit_item($u, 'Judge at a School/District Fair', 'years_school', 'textbox', 5)?></tr>
|
||||||
if($config['judges_specialaward_only_enable'] == 'yes') {
|
<tr><?=user_edit_item($u, 'Judge at a Regional Fair', 'years_regional', 'textbox', 5)?></tr>
|
||||||
?>
|
<tr><?=user_edit_item($u, 'Judge at a National Fair', 'years_national', 'textbox', 5)?></tr>
|
||||||
<tr><td colspan="2"><hr /></td></tr>
|
|
||||||
<tr><td><?=i18n("I am a judge for a specific special award")?>:</td>
|
|
||||||
<td><table><tr><td>
|
|
||||||
<?
|
|
||||||
$ch = ($u['special_award_only'] == 'yes') ? 'checked="checked"' : '';
|
|
||||||
echo "<input $ch type=\"checkbox\" name=\"special_award_only\" value=\"yes\" />";
|
|
||||||
echo "</td><td>";
|
|
||||||
echo i18n("Check this box if you are supposed to judge a specific special award, and please select that award on the Special Award Preferences page.");
|
|
||||||
?>
|
|
||||||
</td></tr></table>
|
|
||||||
</td></tr>
|
|
||||||
<?
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<tr><td colspan="2"><hr /></td></tr>
|
<tr><td style="text-align: left" colspan="2"><br /><b><?=i18n('Judging Questions')?></b><hr /></td></tr>
|
||||||
|
<tr><?=user_edit_item($u, 'I am willing to be the lead for my judging team', 'willing_chair', 'yesno')?></tr>
|
||||||
|
<tr><?=user_edit_item($u, 'Highest post-secondary degree', 'highest_psd', 'textbox')?></tr>
|
||||||
|
|
||||||
<tr> <td><?=i18n("Years of judging experience at a School level:")?></td>
|
|
||||||
<td><input onchange="fieldChanged()" type="text" name="years_school" size="5" value="<?=$u['years_school']?>" /></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><?=i18n("Years of judging experience at a Regional level:")?></td>
|
|
||||||
<td><input onchange="fieldChanged()" type="text" name="years_regional" size="5" value="<?=$u['years_regional']?>" /></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><?=i18n("Years of judging experience at a National level:")?></td>
|
|
||||||
<td><input onchange="fieldChanged()" type="text" name="years_national" size="5" value="<?=$u['years_national']?>" /></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><?=i18n("I am willing to be the lead for my judging team")?></td>
|
|
||||||
<td>
|
|
||||||
<? $ch = ($u['willing_chair'] == 'yes') ? 'checked="checked"' : ''; ?>
|
|
||||||
<input <?=$ch?> type="checkbox" name="willing_chair" value="yes" />
|
|
||||||
</tr><tr>
|
|
||||||
<td><?=i18n("Highest post-secondary degree")?></td>
|
|
||||||
<td><input onchange="fieldChanged()" type="text" name="highest_psd" size="35" value="<?=$u['highest_psd']?>" /></td>
|
|
||||||
</tr><tr>
|
|
||||||
<td colspan="2"><hr /></td></tr>
|
|
||||||
</table>
|
|
||||||
<table class="editor">
|
|
||||||
<td style="width:35%" colspan="2"></td><td colspan="2"></td>
|
|
||||||
<?
|
<?
|
||||||
questions_print_answer_editor('judgereg', $u, 'questions');
|
questions_print_answer_editor('judgereg', $u, 'questions');
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
<br />
|
||||||
<br /><br />
|
<button><?=i18n("Save Information")?></button>
|
||||||
|
|
||||||
<input type="submit" onclick="judgeother_save(); return false;" value="<?=i18n("Save Information")?>" />
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function judgeother_save()
|
||||||
|
{
|
||||||
|
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_other.php?action=save&users_id=<?=$u['id']?>", $("#judgeother_form").serializeArray());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#judgeother_form").validate({
|
||||||
|
errorPlacement: function(error, element) {
|
||||||
|
if( element.attr('type') == 'checkbox' ) {
|
||||||
|
error.insertAfter( element.parent("span") );
|
||||||
|
} else {
|
||||||
|
error.insertAfter(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
"languages[]": { required: true },
|
||||||
|
years_school: { min: 0, max:100 },
|
||||||
|
years_regional: { min: 0, max:100 },
|
||||||
|
years_national: { min: 0, max:100 }
|
||||||
|
},
|
||||||
|
|
||||||
|
messages: {
|
||||||
|
"languages[]": { required: "<?=i18n('Please select the language(s) you can judge in')?>" },
|
||||||
|
years_school: {
|
||||||
|
min: "<?=i18n('Please enter a valid number')?>",
|
||||||
|
max: "<?=i18n('Please enter a valid number')?>",
|
||||||
|
},
|
||||||
|
years_regional: {
|
||||||
|
min: "<?=i18n('Please enter a valid number')?>",
|
||||||
|
max: "<?=i18n('Please enter a valid number')?>",
|
||||||
|
},
|
||||||
|
years_national: {
|
||||||
|
min: "<?=i18n('Please enter a valid number')?>",
|
||||||
|
max: "<?=i18n('Please enter a valid number')?>",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitHandler: function() {
|
||||||
|
judgeother_save();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
cancelHandler: function() {
|
||||||
|
judgeother_save();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
user_update_tab_status('judge');
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
if($_SESSION['embed'] != true) send_footer();
|
/*
|
||||||
|
if($config['judges_specialaward_only_enable'] == 'yes') {
|
||||||
|
|
||||||
|
<tr><td colspan="2"><hr /></td></tr>
|
||||||
|
<tr><td><?=i18n("I am a judge for a specific special award")?>:</td>
|
||||||
|
<td><table><tr><td>
|
||||||
|
|
||||||
|
$ch = ($u['special_award_only'] == 'yes') ? 'checked="checked"' : '';
|
||||||
|
echo "<input $ch type=\"checkbox\" name=\"special_award_only\" value=\"yes\" />";
|
||||||
|
echo "</td><td>";
|
||||||
|
echo i18n("Check this box if you are supposed to judge a specific special award, and please select that award on the Special Award Preferences page.");
|
||||||
|
|
||||||
|
</td></tr></table>
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
|
@ -100,17 +100,18 @@ function questions_print_answer_editor($section, &$u, $array_name)
|
|||||||
$qs = questions_load_questions($section, $u['year']);
|
$qs = questions_load_questions($section, $u['year']);
|
||||||
$keys = array_keys($qs);
|
$keys = array_keys($qs);
|
||||||
foreach($keys as $qid) {
|
foreach($keys as $qid) {
|
||||||
print("<tr>\n");
|
|
||||||
print(" <td colspan=\"2\">".i18n($qs[$qid]['question'])."</td>\n");
|
|
||||||
print(" <td colspan=\"2\">");
|
|
||||||
$iname = "{$array_name}[{$qid}]";
|
$iname = "{$array_name}[{$qid}]";
|
||||||
|
print("<tr>\n");
|
||||||
|
print(" <td><label for=\"$iname\">".i18n($qs[$qid]['question'])."</label></td>\n");
|
||||||
|
print(" <td >");
|
||||||
switch($qs[$qid]['type']) {
|
switch($qs[$qid]['type']) {
|
||||||
case 'yesno':
|
case 'yesno':
|
||||||
if($ans[$qid]=="yes") $ch="checked=\"checked\""; else $ch="";
|
echo "<select name=\"$iname\">";
|
||||||
print("<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"$iname\" value=\"yes\" />".i18n("Yes"));
|
$sel = ($ans[$qid]=='yes') ? 'selected="selected"' : '';
|
||||||
print(" ");
|
echo "<option value=\"yes\" $sel>".i18n("Yes")."</option>\n";
|
||||||
if($ans[$qid]=="no") $ch="checked=\"checked\""; else $ch="";
|
$sel = ($ans[$qid]=='no') ? 'selected="selected"' : '';
|
||||||
print("<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"$iname\" value=\"no\" />".i18n("No"));
|
echo "<option value=\"no\" $sel>".i18n("No")."</option>\n";
|
||||||
|
echo "</select>";
|
||||||
break;
|
break;
|
||||||
case 'int':
|
case 'int':
|
||||||
print("<input onclick=\"fieldChanged()\" type=\"text\" ".
|
print("<input onclick=\"fieldChanged()\" type=\"text\" ".
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
require_once('account.inc.php');
|
require_once('account.inc.php');
|
||||||
|
|
||||||
function user_edit_item(&$u, $label, $fname, $type='textbox')
|
function user_edit_item(&$u, $label, $fname, $type='textbox', $data1=NULL)
|
||||||
{
|
{
|
||||||
global $required, $fields, $config;
|
global $required, $fields, $config;
|
||||||
|
|
||||||
@ -41,7 +41,8 @@ function user_edit_item(&$u, $label, $fname, $type='textbox')
|
|||||||
echo '<td>';
|
echo '<td>';
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case 'textbox':
|
case 'textbox':
|
||||||
echo "<input id=\"$fname\" name=\"$fname\" type=\"text\" value=\"{$u[$fname]}\">";
|
if($data1 != NULL) $size = "size=\"$data1\"";
|
||||||
|
echo "<input id=\"$fname\" name=\"$fname\" $size type=\"text\" value=\"{$u[$fname]}\">";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'province':
|
case 'province':
|
||||||
@ -74,6 +75,18 @@ function user_edit_item(&$u, $label, $fname, $type='textbox')
|
|||||||
}
|
}
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'languages':
|
||||||
|
echo "<span>";
|
||||||
|
$x = 0;
|
||||||
|
foreach($config['languages'] AS $l=>$ln) {
|
||||||
|
$ch = (in_array($l,$u['languages'])) ? 'checked="checked"' : '';
|
||||||
|
if($x) echo '<br />';
|
||||||
|
echo "<input $ch type=\"checkbox\" name=\"$fname\" value=\"$l\" />$ln";
|
||||||
|
$x=1;
|
||||||
|
}
|
||||||
|
echo "</span>";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
require_once('common.inc.php');
|
require_once('common.inc.php');
|
||||||
require_once('user.inc.php');
|
require_once('user.inc.php');
|
||||||
require_once('user_edit.inc.php');
|
require_once('user_edit.inc.php');
|
||||||
|
require_once('judge.inc.php');
|
||||||
|
|
||||||
$edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id'];
|
$edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id'];
|
||||||
if($edit_id != $_SESSION['users_id'])
|
if($edit_id != $_SESSION['users_id'])
|
||||||
@ -56,11 +57,11 @@ $tabs = array( 'fairinfo' => array(
|
|||||||
'file' => 'user_organization.php',
|
'file' => 'user_organization.php',
|
||||||
'status_func' => 'user_organization_status',
|
'status_func' => 'user_organization_status',
|
||||||
),
|
),
|
||||||
'judgeother' => array(
|
'judge' => array(
|
||||||
'label' => 'Judge Other',
|
'label' => 'Judge',
|
||||||
'types' => array('judge'),
|
'types' => array('judge'),
|
||||||
'file' => 'judge_other.php',
|
'file' => 'judge_other.php',
|
||||||
'disabled' => true,
|
'status_func' => 'judge_status_other',
|
||||||
),
|
),
|
||||||
'judgeexpertise' => array(
|
'judgeexpertise' => array(
|
||||||
'label' => 'Expertise',
|
'label' => 'Expertise',
|
||||||
|
@ -70,7 +70,7 @@ case 'save':
|
|||||||
|
|
||||||
//reload the user record because we dont know if we saved or didnt save above, we just want
|
//reload the user record because we dont know if we saved or didnt save above, we just want
|
||||||
//to know what the user looks like _now_
|
//to know what the user looks like _now_
|
||||||
$u = user_load($u['id']);
|
// $u = user_load($u['id']);
|
||||||
$newstatus=user_organization_status($u);
|
$newstatus=user_organization_status($u);
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -80,18 +80,14 @@ case 'save':
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//send the header
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<h4><?=i18n("Organization")?> - <span class="status_organization"></span></h4>
|
<h4><?=i18n("Organization")?> - <span class="status_organization"></span></h4>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
<form class="editor" id="orgform">
|
<form class="editor" id="orgform">
|
||||||
|
|
||||||
<table width="90%">
|
<table width="90%">
|
||||||
<tr><td style="text-align: left" colspan="2"><b>Organization</b><hr /></td></tr>
|
<tr><td style="text-align: left" colspan="2"><b><?=i18n('Organization')?></b><hr /></td></tr>
|
||||||
<tr><?=user_edit_item($u, 'Organization Name', 'organization')?></tr>
|
<tr><?=user_edit_item($u, 'Organization Name', 'organization')?></tr>
|
||||||
<tr><?=user_edit_item($u, 'Phone', 'phonework')?></tr>
|
<tr><?=user_edit_item($u, 'Phone', 'phonework')?></tr>
|
||||||
<tr><?=user_edit_item($u, 'Fax', 'fax')?></tr>
|
<tr><?=user_edit_item($u, 'Fax', 'fax')?></tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user