CurrentNumberRecords(); GetVariablesFromSession(); if ($_POST['check'] != 'Display') { $Action = $_POST['display_button']; } else { $Action = $_POST['check']; } switch ($Action) { case 'Add': InitializeVariables(); AddForm(); break; case 'Edit': $DesiredRecord = $_POST['SelectRecord']; GetLoadDesiredRecord(); EditForm(); break; case 'Display': $DesiredRecord = $_POST['SelectRecord']; GetLoadDesiredRecord(); DisplayForm(); break; case 'Delete': $DesiredRecord = $_POST['SelectRecord']; GetLoadDesiredRecord(); DeleteForm(); break; case 'Next': Db_Next(); DisplayForm(); break;
function Edit($id, $name, $description, $location) { /* check if any form elements are bad, if so redisplay the addform */ if ($name == "") { EditForm("'<b>Calendar Name</b>' was blank, original values now displayed", $id); return; } if ($description == "") { EditForm("'<b>Description</b>' was blank, original values now displayed", $id); return; } if ($location == "") { EditForm("'<b>Location</b>' was blank, original values now displayed", $id); return; } /* if we get to this point, its safe to add to the database */ $sqlstring = "update calendars set calendar_name = '{$name}', calendar_description = '{$description}', calendar_location = '{$location}' where calendar_id = '{$id}'"; //echo $sqlstring; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); DisplayList(); }
$answer_response = nl2br($array['answer_response']); $answer_words = $array['answer_words']; $answer_weighting = $array['answer_weighting']; $answer_rating = $array['answer_rating']; $tender_id = $array['tender_id']; $tender_name = $array['tender_name']; $tender_date = $array['tender_date']; $tender_type = $array['tender_type']; if ($tender_date > time() and $_GET[edit_question] != $answer_id) { $answer_ref = $answer_ref . " <a href=\"index2.php?page=tender_view&tender_id={$tender_id}&edit_question={$answer_id}#{$answer_id}\"><img src=\"images/button_edit.png\" alt=\"Edit\" /></a>"; } if ($counter == 0) { echo "<h1>Searching: <i>{$search}</i></h1>"; print "<table summary=\"Lists of questions and responses\">"; if ($_GET[question] == "add") { EditForm('', '', '', '', '', $tender_id); echo "</th></tr>"; } } if ($answer_response == NULL) { $answer_response = "-- Not yet answered --"; } echo "<tr><th style=\"width: 10%;\" >{$answer_ref}</th><th>"; $answer_question = nl2br($answer_question); TenderWords($answer_question); echo "</th></tr>"; echo "<tr><td colspan=\"2\">{$answer_response}</td></tr>"; echo "<tr><td colspan=\"2\" class=\"minitext\"><a href=\"index2.php?page=tender_view&tender_id={$tender_id}\">{$tender_name}</a> "; if ($tender_type != NULL) { echo " (" . $tender_type . ")"; }
if ($answer_time_edited > 0) { $time_edited = ", last updated: " . TimeFormatDetailed($answer_time_edited); } else { unset($time_edited); } if ($answer_id_edited > 0) { $person_edited = ", by " . $user_name_first . " " . $user_name_second; } else { unset($person_edited); } echo "Word count: {$answer_wordcount}, allowed: {$answer_words}, weighting: {$answer_weighting}" . $time_edited . $person_edited . "</td></tr><a name=\"{$answer_id}\"></a>"; $counter++; } if ($word_count_total > 0) { echo "<tr><td><strong>Total Word Count:</strong></td><td><strong>" . number_format($word_count_total) . "</strong></td></tr>"; } echo "</table>"; if (mysql_num_rows($result) == 0) { $sql = "SELECT * FROM intranet_tender WHERE tender_id = '{$_GET['tender_id']}' LIMIT 1"; $result = mysql_query($sql, $conn) or die(mysql_error()); $array = mysql_fetch_array($result); $tender_id = $array['tender_id']; $tender_name = $array['tender_name']; $tender_date = $array['tender_date']; echo "<h1>{$tender_name}</h1>"; echo "<h2>" . TimeFormatDetailed($tender_date) . "</h2>"; echo "<p>There are currently no responses on the system.</p>"; echo "<table summary=\"Lists of questions and responses\">"; EditForm($answer_id, $answer_question, $answer_ref, $answer_words, $answer_weighting, $tender_id); echo "</table>"; }
function Edit($id, $username, $groupid, $calendarid, $projectid, $details, $title, $startdatetime, $enddatetime, $isalldayevent, $istimerequest, $currentcal, $repeats, $repeattype, $repeatsun, $repeatmon, $repeattue, $repeatwed, $repeatthu, $repeatfri, $repeatsat, $repeatenddate) { /* check if any form elements are bad, if so redisplay the addform */ if ($name == "") { EditForm("'<b>Calendar Appointment</b>' was blank, original values now displayed", $id); return; } if ($description == "") { EditForm("'<b>Description</b>' was blank, original values now displayed", $id); return; } if ($location == "") { EditForm("'<b>Location</b>' was blank, original values now displayed", $id); return; } /* if we get to this point, its safe to add to the database */ $sqlstring = "update calendars set calendar_name = '{$name}', calendar_description = '{$description}', calendar_location = '{$location}' where calendar_id = '{$id}'"; //echo $sqlstring; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); DisplayList(); }
function Edit($id, $name, $description, $admin) { /* check if any form elements are bad, if so redisplay the addform */ if ($name == "") { EditForm("'<b>Calendar Name</b>' was blank, original values now displayed", $id); return; } if ($description == "") { EditForm("'<b>Description</b>' was blank, original values now displayed", $id); return; } if ($admin == "") { EditForm("'<b>Admin Username</b>' was blank, original values now displayed", $id); return; } $name = mysql_real_escape_string($name); $description = mysql_real_escape_string($description); $admin = mysql_real_escape_string($admin); /* if we get to this point, its safe to add to the database */ $sqlstring = "update projects set project_name = '{$name}', project_description = '{$description}', project_admin = '{$admin}' where project_id = '{$id}'"; //echo $sqlstring; $result = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>{$sqlstring}</i><br>"); DisplayList(); }