<?php /*** * Task detail screen */ $win = new SDPanel(); $win->setCaption("Task Detail"); //Get var sent from main screen $id = new InputNumeric(); $id->setClass("input.Common"); Data::getParm($id); //Define the acrtion bar $bar = new ActionBar(); $btn_delete = new ButtonBar(); $btn_delete->setCaption("Delete"); $btn_delete->onTap(removeTask()); $btn_delete->setImage("img/deleteBar.png"); $bar->addControl($btn_delete); $win->addControl($bar); //Items definition $name = new InputText(); $name->setClass("input.Common"); $description = new InputText(); $description->setClass("input.Common"); $date = new InputDate(); $date->setLabelCaption("Task date"); $date->setClass("input.Common"); $addToCalendar = new InputBoolean(); $addToCalendar->setLabelCaption("Add to my calendar"); $addToCalendar->setLabelPosition("Right"); //Main table definition
//Marcar conclusão de uma tarefa $success = taskDone($id); if ($success) { $success->status = 200; echo json_encode($success, JSON_PRETTY_PRINT); return http_response_code($RESPONSE_CODES['ok']); } else { $responseCode = http_response_code(403); echo json_encode(["status" => $responseCode, "mensagem" => sprintf($ERROR_MESSAGES['task_not_found'], $id)]); return $responseCode; } } case 'DELETE': parse_str(file_get_contents('php://input'), $vars); if (!empty($id = $vars['id'])) { $task = getTask($id); if ($task) { removeTask($task->id); $responseCode = $RESPONSE_CODES['no_content']; echo json_encode(["status" => $responseCode, "mensagem" => "Tarefa apagada"]); return http_response_code($responseCode); } else { echo json_encode(["status" => $RESPONSE_CODES['bad_request'], "mensagem" => "Tarefa não encontrada"]); return http_response_code($RESPONSE_CODES['bad_request']); } } else { $responseCode = $RESPONSE_CODES['bad_request']; echo json_encode(["status" => $responseCode, "mensagem" => sprintf($ERROR_MESSAGES['miss_param'], "id")]); return $responseCode; } }
require_once inc_dataGrid; require_once inc_dataReader; require_once inc_response; //------------------------- DATA BLOCK ---------------------------- $task = isset($_POST["task"]) ? $_POST["task"] : (isset($_GET["task"]) ? $_GET["task"] : ""); switch ($task) { case "SelectAll": SelectAll(); case "SelectAllReceive": SelectAllReceive(); case "selectProjects": selectProjects(); case "saveTask": saveTask(); case "removeTask": removeTask(); } function SelectAll() { $where = "1=1"; if (!empty($_REQUEST["TaskStatus"])) { $where .= " AND TaskStatus in(" . ($_REQUEST["TaskStatus"] == "RAW" ? "'RAW'" : "'DONE','RESPONSE'") . ")"; } $res = PdoDataAccess::runquery_fetchMode("\r\n\t\tselect\tt.* , \r\n\t\t\t\tSysName,\r\n\t\t\t\tconcat_ws(' ',fname,lname,CompanyName) RegPersonName\r\n\t\t\t\t\r\n\t\tfrom FRW_tasks t\r\n\t\tjoin BSC_persons on(RegPersonID = PersonID)\r\n\t\tjoin FRW_systems using(SystemID)\r\n\t\t\r\n\t\twhere {$where} order by FIELD(TaskStatus,'RAW') desc,ifnull(DoneDate,CreateDate) desc"); $cnt = $res->rowCount(); $res = PdoDataAccess::fetchAll($res, $_GET["start"], $_GET["limit"]); echo dataReader::getJsonData($res, $cnt, $_GET["callback"]); die; } function saveTask() {
if (isset($_POST['user'])) { echo removeUser($_POST['user']); } else { echo "No proper data"; } break; case 1: if (isset($_POST['group'])) { echo removeGroup($_POST['group']); } else { echo "No proper data"; } break; case 2: if (isset($_POST['task'])) { echo removeTask($_POST['task']); } else { echo "No proper data"; } break; case 3: if (isset($_POST['student']) and isset($_POST['group'])) { echo deleteStudent($_POST['student'], $_POST['group']); } else { echo "No proper data"; } break; default: echo "No proper data"; } } else {