protected function OnInput() { parent::OnInput(); $this->title = 'Добавление заявки'; $this->types = getTypes(); $this->departments = getDepartments(); if (isset($_POST['submit'])) { move_uploaded_file($_FILES["filename"]['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/dt/uploads/claim/" . $_FILES["filename"]["name"]); $file = $_FILES['filename']['name']; addClaim($_POST['in_num'], $_POST['in_date'], $_POST['out_num'], $_POST['out_date'], $_POST['type'], $_POST['description'], $_POST['sen_dep'], $_POST['sen_name'], $file, $_POST['rec']); } }
function getDepartmentWithCourses($collegeId) { //initialise array variables $data = []; $courses = []; $ids = []; //fetch departments $departments = getDepartments($collegeId); //append departments to data array //$data['departments'] = $departments; //get the ids of each department foreach ($departments as $key => $value) { //$ids[] = $value['id']; $data[$key]['department'] = $value; $data[$key]['courses'] = getCategories($value['id']); } return $data; }
<?php switch ($_POST['API']) { case 1: getCompanies(); break; case 2: getDepartments($_POST['company']); break; case 3: getCourses($_POST['company'], $_POST['department']); break; case 4: getXMLs($_POST['company'], $_POST['department'], $_POST['course']); break; case 5: downloadXML($_POST['company'], $_POST['department'], $_POST['course'], $_POST['xmlname']); break; default: break; } function getCompanies() { $dir = @opendir("CaptivateResults"); if ($dir != "") { while (($file = readdir($dir)) !== false) { if (!is_file($file)) { echo $file . ";"; } } closedir($dir);
$app->render('html/editUser.html', array('user' => getUserDetails($app->db, $userID), 'departments' => getDepartments($app->db), 'roles' => $roles)); })->name('editUser'); $app->post('/admin/users/edit/:user', function ($userID) use($app) { $result = editUser($app->db, $userID, $app->request->post('user'), $app->request->post('email'), $app->request->post('department'), $app->request->post('role'), $app->request->post('archiveEnabled'), $app->request->post('archiveDate'), $app->request->post('archiveReason')); if (!empty($result)) { $app->flash('error', $result); $app->redirect($app->urlFor('editUser', array('user' => $userID))); } else { $app->redirect($app->urlFor('userList', array('active' => 'active'))); } }); $app->get('/admin/departments', function () use($app) { $app->redirect($app->urlFor('departmentsList')); }); $app->get('/admin/departments/list', function () use($app) { $app->render('html/departments.html', array('departments' => getDepartments($app->db))); })->name('departmentsList'); $app->get('/admin/departments/add', function () use($app) { $app->render('html/adddepartment.html'); }); $app->post('/admin/departments/add', function () use($app) { $result = addDepartment($app->db, $app->request->post('name')); if ($app->request->post('ajax') === 'true') { if (is_numeric($result)) { $app->halt(200, $result); } else { $app->halt(409, $result); } } else { if (is_numeric($result)) { $app->redirect($app->urlFor('departmentsList'));
?> </select> <label>Create Date From: </label> <input name='date_from' type='text' value="<?php echo $_POST['date_from']; ?> " autocomplete='off'> <label>Create Date Till: </label> <input name='date_till' type='text' value="<?php echo $_POST['date_till']; ?> " autocomplete='off'> <label>System #: </label> <select name='item_department_id' id="item_department_id"><option value="">-SELECT-</option> <?php $dept_list = getDepartments(); foreach ($dept_list as $dept) { $dept_sel = $dept['dept_id'] == $_POST['item_department_id'] ? "selected='selected'" : ""; echo "<option value='{$dept['dept_id']}' {$dept_sel} id='company_{$dept['dept_company']}'>{$dept['dept_name']}</option>"; } ?> </select> <label>User: </label> <select name='item_created_by'><option value="">-SELECT-</option> <?php $user_list = getUsers(); foreach ($user_list as $user) { $user_sel = $user['user_id'] == $_POST['item_created_by'] ? "selected='selected'" : ""; echo "<option value='{$user['user_id']}' {$user_sel}>{$user['user_username']}</option>"; } ?>
include 'functions.php'; if (!empty($_POST)) { foreach ($_POST as $key => $value) { switch ($key) { case 'universityName': if (!empty($_POST[$key])) { $universityName = $_POST[$key]; $dep = getDepartmentsNames($universityName); echo generateOptions($dep); } break; case 'universityNameAndReturnDepartmentId': if (!empty($_POST[$key])) { $universityName = $_POST[$key]; $dep = getDepartments($universityName); echo generateOptionsWithSpecifiedValueField($dep, 'departmentId', 'departmentName'); } break; case 'departmentIdAndReturnProfessorId': if (!empty($_POST[$key])) { $departmentId = $_POST[$key]; $pro = getProfessors($departmentId); echo generateOptionsWithSpecifiedValueField($pro, 'professorId', 'professorUsername'); } break; case 'departmentIdAndReturnSecretaryId': if (!empty($_POST[$key])) { $departmentId = $_POST[$key]; $sec = getSecretaries($departmentId); echo generateOptionsWithSpecifiedValueField($sec, 'secretaryId', 'secretaryUsername');
echo "</option><option value=\"10\""; if ($_COOKIE['WHMCSAutoRefresh'] == 10) { echo "selected"; } echo ">10 "; echo $aInt->lang("support", "minutes"); echo "</option><option value=\"15\""; if ($_COOKIE['WHMCSAutoRefresh'] == 15) { echo "selected"; } echo ">15 "; echo $aInt->lang("support", "minutes"); echo "</option></select> <input type=\"submit\" value=\""; echo $aInt->lang("support", "setautorefresh"); echo "\" class=\"button\" /></div>\n</form>\n\n </div>\n</div>\n<div id=\"tab2box\" class=\"tabbox\">\n <div id=\"tab_content\">\n\n </div>\n</div>\n\n<br />\n\n"; $departmentsarray = getDepartments(); $tag = $whmcs->get_req_var("tag"); if ($tag) { echo "<h2>Filtering Tickets for Tag <strong>\"" . $tag . "\"</strong></h2>"; } $tagjoin = $tag ? " INNER JOIN tbltickettags ON tbltickettags.ticketid=tbltickets.id" : ""; $query = " FROM tbltickets LEFT JOIN tblclients ON tblclients.id=tbltickets.userid" . $tagjoin . " WHERE "; $filters = $statusfilter = array(); if ($view == "") { $result = select_query("tblticketstatuses", "title", array("showawaiting" => "1")); while ($data = mysql_fetch_array($result)) { $statusfilter[] = $data[0]; } $filters[] = "tbltickets.status IN (" . db_build_in_array($statusfilter) . ")"; } else { if ($view == "any") {
public function departments() { if ($this->method == 'GET') { $this->response['data'] = getDepartments(); } else { $this->response['message'] = "endpoint does not recognize " . $this->method . " requests"; $this->response['code'] = 405; } return $this->response; }
<?php /** * Created by PhpStorm. * User: robertoferrerb * Date: 11/22/15 * Time: 5:40 AM */ include_once "functions.php"; $function = $_POST['function']; switch ($function) { case "getDepartments": return getDepartments(); break; case "getCourseByDepartment": return json_encode(getCourseByDepartment($_POST['department'])); break; }
} else { $_SESSION['error'] = 'Não foi possível aletrar o registro.'; } header('location: ' . SITE_URL . 'atividades/view.php?id=' . $id); break; case 'delete': if (delete('atividades', ['id' => $id])) { $_SESSION['success'] = 'Registro exluido com sucesso. '; } else { $_SESSION['error'] = 'Não foi possível excluir o registro.'; } header('location: ' . SITE_URL . 'atividades/index.php'); break; case 'ajaxPopulateDepartment': checkTokenIsValid($token); echo json_encode(getDepartments($id)); break; } function insert($table, $params) { // Atribui a instrução SQL construida no método $sql = buildInsert($table, $params); $conn = dbConnect(); extract($params); $idDemandante = antiInjection($id_demandante); $idSetor = antiInjection($id_setor); $idStatus = antiInjection($id_status); $idResponsavel = antiInjection($id_responsavel); $titulo = antiInjection($titulo); $descricao = antiInjection($descricao); $data = str_replace('/', '-', antiInjection($data));