diff --git a/super/conferences.php b/super/conferences.php index 3c65bc7..22e9a1c 100644 --- a/super/conferences.php +++ b/super/conferences.php @@ -123,9 +123,83 @@ if(array_key_exists('formAction', $_POST)){ // check for an action by the normal method if(array_key_exists('action', $_GET)){ switch($_GET['action']){ - case 'new': // this is a request to create a new conference + case 'loadTable': + draw_conferences_list(); + break; + case 'new': + // present them with a wizard in which to create a new conference $_SESSION['conference_wizard'] = array(); wizard_draw_step('start'); + break; + case 'edit': + // give them an editor in which to modify an existing conference + $cid = $_POST['id']; + if(is_numeric($cid)){ + $conf = mysql_fetch_assoc(mysql_query("SELECT * FROM conferences WHERE id = $cid")); + if(is_array($conf)){ + echo ""; + echo ""; + echo ""; + echo ""; + echo "
" . i18n('Name') . ":
" . i18n('Conference Type') . ":"; + echo ""; + echo "
" . i18n('Status') . ":"; + $statuses = array('pending','running','ended'); + echo ""; + + echo "
"; + } + } + break; + case 'save': + // save the new conference data for the conference that's being edited + $confId = $_POST['id']; + if(!is_numeric($confId)){ + error_("invalid conference id"); + } + // verify that the specified conference already exists + $countRecord = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) as tally FROM conferences WHERE id = $confId"), 0); + $tally = $countRecord['tally']; + if($tally == 1){ + // ok, it's a valid conference id. Let's go ahead and update the data for it + $confType = mysql_real_escape_string($_POST['confType']); + $confName = mysql_real_escape_string($_POST['confName']); + $confStatus = mysql_real_escape_string($_POST['confStatus']); + mysql_query("UPDATE conferences SET type='$confType', name='$confName', status='$confStatus' WHERE id='$confId'"); + $errMsg = mysql_error(); + if($errMsg != null){ + error_("SQL error: $errMsg"); + }else{ + happy_("Conference updated successfully"); + } + }else{ + error_("nonexistant conference id"); + } + break; + case 'delete': + // delete the specified conference + $confId = $_POST['id']; + if(!is_numeric($confId)){ + error_("invalid conference id"); + }else{ + mysql_query("UPDATE conferences set status='deleted' WHERE id = $confId"); + $errMsg = mysql_error(); + if($errMsg != null){ + error_("SQL error: $errMsg"); + }else{ + happy_("Conference updated successfully"); + } + } + break; } exit; @@ -139,29 +213,67 @@ send_header("Conferences Setup", ?> +Add a conference +

-
-Add a conference
"; - $query = mysql_query("SELECT * FROM `conferences`"); + echo ""; + echo ""; + $query = mysql_query("SELECT * FROM `conferences` WHERE status <> 'deleted'"); + $rowNumbr = 0; while($row = mysql_fetch_assoc($query)){ - echo ""; + echo ''; echo ""; - echo ""; - echo ""; + echo ""; + if($row['status'] == 'running'){ + echo ""; // can't delete a running conference + }else{ + echo ""; + } echo ""; } echo "
" . i18n("Conferences") . "
{$row['name']}{$row['type']}{$row['status']}\""\""
"; } -/* -require("../tableeditor.class.php"); -$editor=new TableEditor("conferences", - array( - "name"=>"Conference Name", - "type"=>"Type", - "status"=>"Status" - ) - ); - -$editor->setPrimaryKey("id"); -$editor->setDefaultSortField("id"); -$editor->setRecordType("Conference"); -$editor->execute(); -*/ /************** Wizard handling functions *************/ // draw an individual step in the wizard function wizard_draw_step($step, $message = null){ @@ -281,7 +387,7 @@ function wizard_close(){ echo " "; }