public static function update() { $params = $_POST; $attributes = array('name' => $params['name'], 'hashtags' => $params['hashtags'], 'description' => $params['description']); $request = new Request($attributes); $errors = $request->errors(); if (count($errors) > 0) { View::make('request/edit.html', array('errors' => $errors, 'attributes' => $attributes)); } else { $request->update(); Redirect::to('/request/' . $request->id, array('message' => 'The request has been succesfully edited')); } }
if (isset($_POST['search'])) { // Determine the area we want to access.. if (isset($_POST['access']) && $_POST['access'] === "staff") { // If the employee_id is set then use this method. if (!empty($_POST['employee_id'])) { // Determine if we got a proper ID. if (!($id = Staff::getID($_POST['employee_id']))) { $message = "No search results found."; } else { $staff = new Staff($id); } } elseif (!empty($_POST['id'])) { $id = $_POST['id']; $staff = new Staff($id); } else { $message = "An error has occured, please contact the administration for further assistance."; } } elseif (isset($_POST['access']) && $_POST['access'] === "client" && isset($_POST['approval_code'])) { // Determine if we're searching for a staff request. if ($_POST['search'] !== "Search") { // Determine if we're trying to update the staff request. if (!Request::update($_POST['search'], $_POST['status'])) { $message = "Unable to update status of request: " . $_POST['approval_code']; } } // Get the staff request data from the database. if (!($request = Request::getRequest($_POST['approval_code'], $_SESSION['access']))) { $message = "No search results found."; } } }
require_once "includes/initialize.php"; $r_id = $_GET['id']; $find_req = Request::find_by_id($r_id); if (isset($_POST['submit'])) { $fer_type = trim(mysql_prep($_POST['fer_type'])); $name = trim(mysql_prep($_POST['name'])); $quantity = trim(mysql_prep($_POST['quantity'])); $date = trim(mysql_prep($_POST['date'])); if (empty($errors)) { $new_req = new Request(); $new_req->req_id = $r_id; $new_req->fer_type = $fer_type; $new_req->name = $name; $new_req->quantity = $quantity; $new_req->date = $date; $rslt = $new_req->update(); if ($rslt) { echo "<div class=\"container\">\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-md-7\">\n\t\t\t\t\t\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t\t\t<h4>Your request has been successfully updated<h4><br>\n\t\t\t\t\t\t\t\t\t\t<h4>Thank You!<h4><br>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { echo "<div class=\"container\">\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-md-7\">\n\t\t\t\t\t\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t\t\t<h4>Error!<h4><br>\n\t\t\t\t\t\t\t\t\t\t<h4>Your request has not been sent<h4><br>\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t"; } } else { echo "<div class=\"container\">\n\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t<div class=\"col-md-7\">\n\t\t\t\t\t\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t\t\t\t\t\t<div class=\"panel-body\">\n\t\t\t\t\t\t\t\t\t\t<h4>Error!<h4><br>\n\t\t\t\t\t\t\t\t\t\t<h4>Your request has not been sent<h4>.<br>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t"; } } else { $form = <<<EOT <div class="container"> \t<div class="row"> \t\t
<?php session_start(); if (!isset($_SESSION['admin_user_id']) || !$_SESSION['admin_user_id'] || !isset($_SESSION['admin_username'])) { exit; } if (!isset($_POST['request_id']) || !$_POST['request_id']) { exit; } require_once "../../vars.php"; require_once "../../includes/request.class.php"; $request = new Request(); $data = array(); if (isset($_POST['response'])) { $data['response'] = $_POST['response']; } if (isset($_POST['status'])) { $data['status'] = $_POST['status']; } if (count($data)) { $request->update($_POST['request_id'], $data); }
$action = 'display'; } if (isset($_GET['rid'])) { $rid = $_GET['rid']; switch ($action) { case 'display': $rid = $_GET['rid']; $actData = new Request($rid); $tpl->parse('TABLE_TEXT', 'pc_table'); $users = new RequestClass5(); $users->retrive(); $users->cids = $actData->cid[0]; // $users->sortBy($sort); $users->tplTableInner('TABLE_TEXT', array('id', 'cid', 'name'), array(false, false, false), array(false, false, false)); $tpl->assign('FIELDS_ACTION', 'save'); $tpl->parse('FIELDS_DATA', 'table'); $tpl->parse('BODY', 'req_edit'); break; case 'save': $actData = new Request($rid); $actData->cid[0] = $_POST['CID']; $actData->update(); // echo $_POST['CID']; // echo '<BR>'; // echo $rid; break; } } else { } $tpl->parse('PAGE', 'page'); $tpl->FastPrint();