Copyright (C) 2005-2006 James 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. */ ?> $config['participant_project_summary_wordmax']) $summarycountok=0; else $summarycountok=1; if($config['participant_project_title_charmax'] && strlen(stripslashes($_POST['title']))>$config['participant_project_title_charmax']) { //0 for no limit, eg 255 database field limit $title=substr(stripslashes($_POST['title']),0,$config['participant_project_title_charmax']); error_("Project title truncated to %1 characters",array($config['participant_project_title_charmax'])); } else $title=stripslashes($_POST['title']); mysql_query("UPDATE projects SET ". "title='".mysql_escape_string($title)."', ". "projectdivisions_id='".intval($_POST['projectdivisions_id'])."', ". "language='".mysql_escape_string(stripslashes($_POST['language']))."', ". "req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ". "req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ". "req_special='".mysql_escape_string(stripslashes($_POST['req_special']))."', ". "summary='".mysql_escape_string(stripslashes($_POST['summary']))."', ". "summarycountok='$summarycountok',". "projectsort='".mysql_escape_string(stripslashes($_POST['projectsort']))."'". "WHERE id='".intval($_POST['id'])."'"); echo mysql_error(); happy_('Project Information Saved'); //check if they changed the project number if($_POST['projectnumber']!=$projectinfo->projectnumber) { //check if hte new one is available $q=mysql_query("SELECT * FROM projects WHERE conferences_id='".$conference['id']."' AND projectnumber='".$_POST['projectnumber']."'"); if(mysql_num_rows($q)) { error_("Could not change project number. %1 is already in use",array($_POST['projectnumber'])); } else { mysql_query("UPDATE projects SET projectnumber='".$_POST['projectnumber']."' WHERE id='".$_POST['id']."'"); happy_("Project number successfully changed to %1",array($_POST['projectnumber'])); } } } function project_load2() { global $registrations_id, $config, $conference; $projectcategories_id=getProjectCategory($registrations_id); //now select their project info $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$registrations_id."' AND conferences_id='".$conference['id']."'"); //check if it exists, if we didnt find any record, lets insert one $projectinfo=mysql_fetch_object($q); $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) { //save these in an array, so we can use them below $agecategories[$r->id]['category']=$r->category; $agecategories[$r->id]['mingrade']=$r->mingrade; $agecategories[$r->id]['maxgrade']=$r->maxgrade; } //make sure that if they changed their grade on the student page, we update their projectcategories_id accordingly if($projectcategories_id && $projectinfo->projectcategories_id!=$projectcategories_id) { echo notice(i18n("Age category changed, updating to %1",array($agecategories[$projectcategories_id]['category']))); mysql_query("UPDATE projects SET projectcategories_id='$projectcategories_id' WHERE id='$projectinfo->id'"); } //output the current status ?>
"; echo ""; echo ""; echo "
:
: " />
:
: ()
: "; echo "\n"; while($r=mysql_fetch_object($q)) { if($r->id == $projectinfo->projectdivisions_id) $sel="selected=\"selected\""; else $sel=""; echo "\n"; } echo "".REQUIREDFIELD; if($config['usedivisionselector']=="yes") { ?> "; echo i18n("WARNING! If you change the division you must manually change the project number too! It will NOT be assigned a new number automatically"); echo "
".i18n("Language").": "; echo "".REQUIREDFIELD; echo "
".i18n("Requirements").": "; echo ""; if($config['participant_project_table']=="no") { //if we arent asking them if they want a table or not, then we set it to 'yes' assuming everyone will get a table echo " "; } else { echo ""; echo " "; if($projectinfo->req_table=="yes") $check="checked=\"checked\""; else $check=""; echo " "; echo " "; if($projectinfo->req_table=="no") $check="checked=\"checked\""; else $check=""; echo " "; echo ""; } if($config['participant_project_electricity']=="no") { //if we arent asking them if they want electricity or not, then we set it to 'yes' assuming everyone will get electricity echo " "; } else { echo ""; echo " "; if($projectinfo->req_electricity=="yes") $check="checked=\"checked\""; else $check=""; echo " "; echo " "; if($projectinfo->req_electricity=="no") $check="checked=\"checked\""; else $check=""; echo " "; echo ""; } echo ""; echo " "; echo " "; echo ""; echo "
".i18n("Table").REQUIREDFIELD."Yes No
".i18n("Electricity").REQUIREDFIELD."Yes No
".i18n("Special")."req_special\" />
"; echo "
".i18n("Summary").": ".REQUIREDFIELD."
"; $summarywords=preg_split("/[\s,]+/",$projectinfo->summary); $summarywordcount=count($summarywords); if($summarywordcount>$config['participant_project_summary_wordmax']) echo "
"; else echo "
"; echo "$summarywordcount/"; echo i18n("%1 words maximum",array($config['participant_project_summary_wordmax'])); echo "
"; ?>
" />