forked from science-ation/science-ation
Changed the scienceolympic judge settings to a generic activity selection tab (replacing so_judge_other.php with activities.php)
Altered use of schedule_users_availability_link. It no longer distinguishes by role.
This commit is contained in:
parent
e55a6f901a
commit
4a3ea7dba9
33
activities.inc.php
Normal file
33
activities.inc.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?
|
||||||
|
/*
|
||||||
|
This file is part of the 'Science Fair In A Box' project
|
||||||
|
SFIAB Website: http://www.sfiab.ca
|
||||||
|
|
||||||
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||||
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||||
|
Copyright (C) 2009 David Grant <dave@lightbox.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation, version 2.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING. If not, write to
|
||||||
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function activities_status(&$u)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
/* They must select a language */
|
||||||
|
if(count($u['languages']) < 1) return 'incomplete';
|
||||||
|
return 'complete';
|
||||||
|
}
|
||||||
|
|
@ -24,12 +24,12 @@
|
|||||||
<?php
|
<?php
|
||||||
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('activities.inc.php');
|
||||||
require_once("questions.inc.php");
|
require_once("questions.inc.php");
|
||||||
require_once('user_edit.inc.php');
|
require_once('user_edit.inc.php');
|
||||||
|
|
||||||
/* Ensure they're logged in as a judge or admin */
|
/* Ensure they're logged in as a judge, volunteer or admin */
|
||||||
user_auth_required(array(), array('judge','admin'));
|
user_auth_required(array(), array('judge', 'volunteer', 'admin'));
|
||||||
|
|
||||||
$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'])
|
||||||
@ -41,7 +41,13 @@ $u = user_load($edit_id);
|
|||||||
|
|
||||||
// load the times at which the various events are happening
|
// load the times at which the various events are happening
|
||||||
$times = array();
|
$times = array();
|
||||||
$q = mysql_query("SELECT schedule.id, date, hour, minute, duration, title FROM schedule JOIN events ON schedule.events_id = events.id WHERE schedule.conferences_id = 7 AND max_judges > 0 ORDER BY date, hour, minute");
|
$q = mysql_query("
|
||||||
|
SELECT schedule.id, date, hour, minute, duration, title
|
||||||
|
FROM schedule
|
||||||
|
JOIN events ON schedule.events_id = events.id
|
||||||
|
WHERE schedule.conferences_id = {$conference['id']}
|
||||||
|
ORDER BY date, hour, minute
|
||||||
|
");
|
||||||
$x = 0;
|
$x = 0;
|
||||||
while($r = mysql_fetch_assoc($q)){
|
while($r = mysql_fetch_assoc($q)){
|
||||||
$dateParts = explode('-', $r['date']);
|
$dateParts = explode('-', $r['date']);
|
||||||
@ -66,19 +72,18 @@ case 'save':
|
|||||||
$u['willing_chair'] = ($_POST['willing_chair'] == 'yes') ? 'yes' : 'no';
|
$u['willing_chair'] = ($_POST['willing_chair'] == 'yes') ? 'yes' : 'no';
|
||||||
$u['highest_psd'] = stripslashes($_POST['highest_psd']);
|
$u['highest_psd'] = stripslashes($_POST['highest_psd']);
|
||||||
user_save($u);
|
user_save($u);
|
||||||
|
/*
|
||||||
if(is_array($_POST['questions'])){
|
if(is_array($_POST['questions'])){
|
||||||
questions_save_answers("judgereg",$u['id'],$_POST['questions']);
|
questions_save_answers("judgereg",$u['id'],$_POST['questions']);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// save the judging availability selection
|
// save the availability selection
|
||||||
mysql_query("DELETE FROM schedule_users_availability_link WHERE users_id='{$u['id']}'");
|
mysql_query("DELETE FROM schedule_users_availability_link WHERE users_id='{$u['id']}'");
|
||||||
if(is_array($_POST['time']) ) {
|
if(is_array($_POST['time']) ) {
|
||||||
$judgeRole = mysql_result(mysql_query("SELECT id FROM roles WHERE type = 'judge'"), 0, 0);
|
|
||||||
foreach($_POST['time'] as $idx) {
|
foreach($_POST['time'] as $idx) {
|
||||||
mysql_query("
|
mysql_query("
|
||||||
INSERT INTO schedule_users_availability_link (schedule_id, users_id, roles_id)
|
INSERT INTO schedule_users_availability_link (schedule_id, users_id)
|
||||||
VALUES($idx, {$u['id']}, $judgeRole)
|
VALUES($idx, {$u['id']})
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,11 +92,10 @@ case 'save':
|
|||||||
happy_("Preferences successfully saved");
|
happy_("Preferences successfully saved");
|
||||||
|
|
||||||
$u = user_load($u['id']);
|
$u = user_load($u['id']);
|
||||||
$newstatus=judge_status_other($u);
|
$newstatus=activities_status($u);
|
||||||
echo "\$newstatus = $newstatus";
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
user_update_tab_status('sojudge','<?=$newstatus?>');
|
user_update_tab_status('activities','<?=$newstatus?>');
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
exit;
|
exit;
|
||||||
@ -103,15 +107,15 @@ $required = array('languages[]');
|
|||||||
if(count($times) > 1) $required[] = 'time[]';
|
if(count($times) > 1) $required[] = 'time[]';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<h4><?=i18n("Judge Information")?> - <span class="status_sojudge"></span></h4>
|
<h4><?=i18n("Activity Information")?> - <span class="status_activities"></span></h4>
|
||||||
<br/>
|
<br/>
|
||||||
<form class="editor" id="judgeother_form">
|
<form class="editor" id="activities_form">
|
||||||
<table width="90%">
|
<table width="90%">
|
||||||
<tr><td style="text-align: left" colspan="2"><b><?=i18n('Judging Language(s)')?></b><hr /></td></tr>
|
<tr><td style="text-align: left" colspan="2"><b><?=i18n('Language(s)')?></b><hr /></td></tr>
|
||||||
<tr><?=user_edit_item($u, 'Languages', 'languages[]', 'languages')?></tr>
|
<tr><?=user_edit_item($u, 'Languages', 'languages[]', 'languages')?></tr>
|
||||||
<?php if(count($times) > 1) { ?>
|
<?php if(count($times) > 1) { ?>
|
||||||
<tr><td style="text-align: left" colspan="2"><br /><b><?=i18n('Time Availability')?></b><hr />
|
<tr><td style="text-align: left" colspan="2"><br /><b><?=i18n('Time Availability')?></b><hr />
|
||||||
<i><?=i18n('Please specify the events you are available to judge')?></i>
|
<i><?=i18n('Please specify the events you are available for')?></i>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -120,10 +124,8 @@ if(count($times) > 1) $required[] = 'time[]';
|
|||||||
$q = mysql_query("
|
$q = mysql_query("
|
||||||
SELECT eual.* FROM schedule_users_availability_link eual
|
SELECT eual.* FROM schedule_users_availability_link eual
|
||||||
JOIN schedule ON schedule.id = eual.schedule_id
|
JOIN schedule ON schedule.id = eual.schedule_id
|
||||||
JOIN roles ON roles.id = eual.roles_id
|
|
||||||
WHERE eual.users_id=\"{$u['id']}\"
|
WHERE eual.users_id=\"{$u['id']}\"
|
||||||
AND schedule.conferences_id = {$conference['id']}
|
AND schedule.conferences_id = {$conference['id']}
|
||||||
AND roles.type = 'judge'
|
|
||||||
ORDER BY `schedule`.`date`, `schedule`.`hour`, `schedule`.`minute`
|
ORDER BY `schedule`.`date`, `schedule`.`hour`, `schedule`.`minute`
|
||||||
");
|
");
|
||||||
|
|
||||||
@ -144,14 +146,7 @@ if(count($times) > 1) $required[] = 'time[]';
|
|||||||
user_edit_item($u, 'Time Availability', 'time[]', 'checklist', $items, $sel);
|
user_edit_item($u, 'Time Availability', 'time[]', 'checklist', $items, $sel);
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
?>
|
//questions_print_answer_editor('judgereg', $u, 'questions');
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
questions_print_answer_editor('judgereg', $u, 'questions');
|
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
@ -160,14 +155,14 @@ questions_print_answer_editor('judgereg', $u, 'questions');
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function so_judgeother_save()
|
function activities_save()
|
||||||
{
|
{
|
||||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/so_judge_other.php?action=save&users_id=<?=$u['id']?>", $("#judgeother_form").serializeArray());
|
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/activities.php?action=save&users_id=<?=$u['id']?>", $("#activities_form").serializeArray());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#judgeother_form").validate({
|
$("#activities_form").validate({
|
||||||
errorPlacement: function(error, element) {
|
errorPlacement: function(error, element) {
|
||||||
if( element.attr('type') == 'checkbox' ) {
|
if( element.attr('type') == 'checkbox' ) {
|
||||||
error.insertAfter( element.parent("span") );
|
error.insertAfter( element.parent("span") );
|
||||||
@ -183,20 +178,20 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
messages: {
|
messages: {
|
||||||
"languages[]": { required: "<?=i18n('Please select the language(s) you can judge in')?>" },
|
"languages[]": { required: "<?=i18n('Please select the language(s) you can work in')?>" },
|
||||||
"time[]": { required: "<?=i18n('Please select the time(s) you are available for judging')?>" }
|
"time[]": { required: "<?=i18n('Please select the time(s) you are available')?>" }
|
||||||
},
|
},
|
||||||
submitHandler: function() {
|
submitHandler: function() {
|
||||||
so_judgeother_save();
|
activities_save();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
cancelHandler: function() {
|
cancelHandler: function() {
|
||||||
so_judgeother_save();
|
activities_save();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
user_update_tab_status('sojudge');
|
user_update_tab_status('activities');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -1 +1 @@
|
|||||||
213
|
214
|
||||||
|
1
db/db.update.214.sql
Normal file
1
db/db.update.214.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `schedule_users_availability_link` DROP `roles_id`;
|
@ -74,16 +74,6 @@ function judge_status_other(&$u)
|
|||||||
return 'complete';
|
return 'complete';
|
||||||
}
|
}
|
||||||
|
|
||||||
function so_judge_status_other(&$u)
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
/* They must select a language to judge in */
|
|
||||||
if(count($u['languages']) < 1) return 'incomplete';
|
|
||||||
return 'complete';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function judge_status_special_awards(&$u)
|
function judge_status_special_awards(&$u)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -27,6 +27,7 @@ require_once('user.inc.php');
|
|||||||
require_once('user_edit.inc.php');
|
require_once('user_edit.inc.php');
|
||||||
require_once('judge.inc.php');
|
require_once('judge.inc.php');
|
||||||
require_once('volunteer.inc.php');
|
require_once('volunteer.inc.php');
|
||||||
|
require_once('activities.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'])
|
||||||
@ -114,11 +115,11 @@ $tabs = array( 'fairinfo' => array(
|
|||||||
'status_func' => 'judge_status_other',
|
'status_func' => 'judge_status_other',
|
||||||
'conference_types' => array('sciencefair'),
|
'conference_types' => array('sciencefair'),
|
||||||
),
|
),
|
||||||
'sojudge' => array(
|
'activities' => array(
|
||||||
'label' => 'Judge',
|
'label' => 'Activities',
|
||||||
'types' => array('judge'),
|
'types' => array('judge', 'volunteer'),
|
||||||
'file' => 'so_judge_other.php',
|
'file' => 'activities.php',
|
||||||
'status_func' => 'so_judge_status_other',
|
'status_func' => 'activities_status',
|
||||||
'conference_types' => array('scienceolympics'),
|
'conference_types' => array('scienceolympics'),
|
||||||
),
|
),
|
||||||
'judgeexpertise' => array(
|
'judgeexpertise' => array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user