diff --git a/admin/volunteer_positions_manager.php b/admin/volunteer_positions_manager.php index 02ee90c5..7bb59ac8 100644 --- a/admin/volunteer_positions_manager.php +++ b/admin/volunteer_positions_manager.php @@ -41,13 +41,13 @@ "start"=>"Start Day/Time", "end"=>"End Day/Time" ), null, - array("year" => $config['FAIRYEAR'] ) + array("conferences_id" => $conference['id'] ) ); $editor->setPrimaryKey("id"); $editor->setDefaultSortField("start,name"); $editor->setRecordType("Volunteer Position"); - $editor->filterList('year',$config['FAIRYEAR']); + $editor->filterList('conferences_id',$conference['id']); $editor->execute(); send_footer(); diff --git a/db/db.code.version.txt b/db/db.code.version.txt index dba40afc..0d389107 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -211 +212 diff --git a/db/db.update.212.php b/db/db.update.212.php new file mode 100644 index 00000000..fcbe7f6b --- /dev/null +++ b/db/db.update.212.php @@ -0,0 +1,36 @@ + conference_id links + $q1 = mysql_query("SELECT year, id FROM conferences WHERE year > 0"); + + //update the tables + while($r = mysql_fetch_assoc($q1)){ + foreach($tables as $tableName){ + $query = "UPDATE `$tableName` SET `conferences_id` = {$r['id']} WHERE `year` = {$r['year']}"; + mysql_query($query); + echo $query . ";\n"; + } + } + + // add the conferences_id field + foreach($tables as $tableName){ + $query = "ALTER TABLE `$tableName` DROP `year`"; + mysql_query($query); + echo $query . ";\n"; + } +} +?> diff --git a/user_edit.php b/user_edit.php index 2add0ac0..09d8625a 100644 --- a/user_edit.php +++ b/user_edit.php @@ -26,6 +26,7 @@ require_once('common.inc.php'); require_once('user.inc.php'); require_once('user_edit.inc.php'); require_once('judge.inc.php'); +require_once('volunteer.inc.php'); $edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id']; if($edit_id != $_SESSION['users_id']) @@ -142,7 +143,7 @@ $tabs = array( 'fairinfo' => array( 'label' => 'Volunteer Positions', 'types' => array('volunteer'), 'file' => 'volunteer_position.php', - 'disabled' => true, + 'status_func' => 'volunteer_status_position', ), 'fairstats' => array( 'label' => 'Fair Statistics and Information', diff --git a/volunteer.inc.php b/volunteer.inc.php index 4da00227..44eabc4b 100644 --- a/volunteer.inc.php +++ b/volunteer.inc.php @@ -27,10 +27,10 @@ function volunteer_status_position($u) { - global $config; - /* See if they have selected something */ - $q = "SELECT * FROM volunteer_positions_signup WHERE users_id='{$u['id']}' - AND year='{$config['FAIRYEAR']}'"; + global $conference; + if($conferenceid === null) $conferenceid = $conference['id']; + // See if they have selected something + $q = "SELECT * FROM volunteer_positions_signup WHERE users_id = '{$u['id']}' AND conferences_id = $conferenceid"; $r = mysql_query($q); if(mysql_num_rows($r) >= 1) { return "complete"; @@ -40,6 +40,7 @@ function volunteer_status_position($u) function volunteer_status_update(&$u) { +/* global $config; if( user_personal_info_status($u) == 'complete' @@ -50,7 +51,8 @@ function volunteer_status_update(&$u) user_save($u); return ($u['volunteer_complete'] == 'yes') ? 'complete' : 'incomplete'; - +*/ +return 'complete'; } ?> diff --git a/volunteer_position.php b/volunteer_position.php index ad93349d..9b2a8d08 100644 --- a/volunteer_position.php +++ b/volunteer_position.php @@ -23,38 +23,35 @@ */ ?> id; } - /* Match selections with avaiulable positions */ + /* Match selections with available positions */ foreach($_POST['posn'] as $id=>$val) { if(!in_array($id, $posns)) continue; if($vals != '') $vals .=','; - $vals .= "('{$u['id']}','$id','{$config['FAIRYEAR']}')"; + $vals .= "('{$u['id']}','$id','{$conference['id']}')"; } } @@ -62,67 +59,81 @@ mysql_query("DELETE FROM volunteer_positions_signup WHERE users_id='{$u['id']}' - AND year='{$config['FAIRYEAR']}' "); + AND conferences_id='{$conference['id']}' "); echo mysql_error(); /* Add new selections if there are any */ if($vals != '') { - $q = "INSERT INTO volunteer_positions_signup (users_id, volunteer_positions_id,year) + $q = "INSERT INTO volunteer_positions_signup (users_id, volunteer_positions_id,conferences_id) VALUES $vals"; $r=mysql_query($q); echo mysql_error(); } + $newstatus = volunteer_status_position($u); +?> + + + + + +"; +display_messages(); +echo "

".i18n('Volunteer Positions')." -

"; +echo ""; + +echo "
\n"; +echo "\n"; + +/* Read current selections */ +$checked_positions = array(); +$r = mysql_query("SELECT * FROM volunteer_positions_signup WHERE users_id = '{$u['id']}' AND conferences_id='{$conference['id']}'"); +while($p = mysql_fetch_object($r)) { + $checked_positions[] = $p->volunteer_positions_id; } - $s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'volunteer_position.php'; - echo "\n"; - echo "\n"; - echo "
\n"; +/* Load available volunteer positions */ +$q = "SELECT *,UNIX_TIMESTAMP(start) as ustart, UNIX_TIMESTAMP(end) as uend FROM volunteer_positions WHERE conferences_id = {$conference['id']}"; +$r = mysql_query($q); +while($p = mysql_fetch_object($r)) { - /* Read current selections */ - $q = "SELECT * FROM volunteer_positions_signup WHERE - users_id = '{$u['id']}' - AND year='{$config['FAIRYEAR']}'"; - $r = mysql_query($q); - $checked_positions = array(); - while($p = mysql_fetch_object($r)) { - $checked_positions[] = $p->volunteer_positions_id; - } - - /* Load available volunteer positions */ - $q = "SELECT *,UNIX_TIMESTAMP(start) as ustart, UNIX_TIMESTAMP(end) as uend - FROM volunteer_positions WHERE year='{$config['FAIRYEAR']}'"; - $r = mysql_query($q); - while($p = mysql_fetch_object($r)) { - - echo '
'; + echo '
'; $checked = false; @@ -157,10 +168,8 @@ if($_SESSION['embed'] == true) { } echo "
"; -echo "\n"; +echo ""; echo "
"; - echo "
"; - - if($_SESSION['embed'] != true) send_footer(); +echo "
"; ?>