Copyright (C) 2005 James Grant Copyright (C) 2007 David Grant 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. */ ?> id; } /* Match selections with avaiulable positions */ foreach($_POST['posn'] as $id=>$val) { if(!in_array($id, $posns)) continue; if($vals != '') $vals .=','; $vals .= "('{$u['id']}','$id','{$config['FAIRYEAR']}')"; } } /* Delete existing selections */ mysql_query("DELETE FROM volunteer_positions_signup WHERE users_id='{$u['id']}' AND year='{$config['FAIRYEAR']}' "); echo mysql_error(); /* Add new selections if there are any */ if($vals != '') { $q = "INSERT INTO volunteer_positions_signup (users_id, volunteer_positions_id,year) VALUES $vals"; $r=mysql_query($q); echo mysql_error(); } message_push(notice(i18n("Volunteer Positions successfully updated"))); } /* update overall status */ volunteer_status_update($u); if($_SESSION['embed'] != true) { //output the current status $newstatus=volunteer_status_position($u); if($newstatus!='complete') message_push(error(i18n("Volunteer Position Selection Incomplete"))); else message_push(happy(i18n("Volunteer Position Selection Complete"))); } if($_SESSION['embed'] == true) { echo "
"; display_messages(); echo "

".i18n('Volutneer Positions')."

"; echo "
"; } else { //send the header send_header("Volunteer Positions", array("Volunteer Registration" => "volunteer_main.php") ); } $s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'volunteer_position.php'; echo "
\n"; echo "\n"; echo "\n"; /* 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 ""; echo ''; } echo "
'; $checked = false; if($_SESSION['lang'] == 'en') { $sday = strftime("%a. %B %e, %Y", $p->ustart); $stime = strftime("%H:%M", $p->ustart); $eday = strftime("%a. %B %e, %Y", $p->uend); $etime = strftime("%H:%M", $p->uend); if($sday == $eday) { $start = $stime; $end = "$etime, $sday"; } else { $start = "$sday, $stime"; $end = "$eday, $etime"; } } else { $start = $p->start; $end = $p->end; } $ch = in_array($p->id, $checked_positions) ? 'checked="checked"' : ''; echo "id]\" value=\"checked\" />"; echo ''; echo ''.i18n($p->name).'($start - $end)
'; echo i18n($p->desc); echo '

"; echo "\n"; echo "
"; echo "
"; if($_SESSION['embed'] != true) send_footer(); ?>