} //kasutaja tahab välja logida if (isset($_GET["logout"])) { //aadressireal on olemas muutuja logout //kustutame kõik session muutujad ja peatame sessiooni session_destroy(); header("Location: login.php"); } if (isset($_GET["delete"])) { deleteTask($_GET["delete"]); } if (isset($_GET["done"])) { doneTask($_GET["done"]); } if (isset($_GET["edit"])) { editTask($_GET["edit"]); } $tasks = tasks(); ?> <html> <table border=1 > <tr> <th>Aine nimetus</th> <th>Õppejõud</th> <th>Ülesande kirjeldus</th> <th>Tähtaeg</th> <th>Raskus</th> <th>Olulisus</th> <!--<th>Muuda</th>--> <th>Tehtud</th> <th>Eemalda</th>
return http_response_code($responseCode); //Bad request } case 'GET': //GET apenas lista as tarefas $tasks = getAllTasks(); echo $tasks; return http_response_code($RESPONSE_CODES['ok']); case 'PUT': //PUT pode ser usado para editar uma tarefa, ou marcá-la como concluida parse_str(file_get_contents('php://input'), $vars); //pega as variáveis via PUT if (!empty($name = $vars['nome'])) { //Edição de uma tarefa $description = $vars['descricao'] ? $vars['descricao'] : ""; if ($success = editTask($name, $description)) { $success->status = 200; echo json_encode($success, JSON_PRETTY_PRINT); return http_response_code($RESPONSE_CODES['ok']); } else { $responseCode = $RESPONSE_CODES['bad_request']; echo json_encode(["status" => $responseCode, "mensagem" => sprintf($ERROR_MESSAGES['task_not_found'], $name)]); return $responseCode; } } elseif (!empty($id = $vars['id'])) { //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']);
$res = get_tasks($db, $group, $from); break; case "addTask": if (!isset($p->title)) { $res = array('status' => false, 'msg' => "NO PARAMETERS"); } else { $res = array('status' => add_task($db, issetor($p->title), issetor($p->description), issetor($p->deadline), issetor($p->worklevel), issetor($p->groupe), issetor($p->UID)), 'msg' => "{$p->title} est ajouté"); } break; case "deleteTask": if (!isset($p->id)) { $res = array('status' => false, 'msg' => "NO PARAMETERS"); } else { $res = array('status' => deleteTask($db, issetor($p->id)), 'msg' => "{$p->title} est supprimée"); } break; case "editTask": if (!isset($p->id)) { $res = array('status' => false, 'msg' => "NO PARAMETERS"); } else { $res = array('status' => editTask($db, issetor($p->title), issetor($p->description), issetor($p->deadline), issetor($p->worklevel), issetor($p->groupe), issetor($p->UID), $p->id), 'msg' => "{$p->title} est modifiée"); } break; default: $res = array("ACTION NOT FOUND"); } echo json_encode($res); } else { $res = array("NO ACTION SET"); echo json_encode($res); }
break; } break; } break; case 'editTransaction': editTransaction($option); break; case 'viewMemberMailChimpInfo': viewMemberMailChimpInfo($option); break; case 'editMailingListSubscription': editMailingListSubscription($option); break; case 'edittask': editTask($option); break; case 'newtransactionfromtransaction': newProvisionalTransaction($option, TRUE); break; case 'newtransactionfrommember': newProvisionalTransaction($option, FALSE); break; case 'newtimetransaction': newTimetransaction($option, FALSE); break; case 'selltomember': case 'transactions': showTransactions($option); break; case 'setip':
$mtg->error('You don\'t have access'); } $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : null; $_GET['action'] = array_key_exists('action', $_GET) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch ($_GET['action']) { case 'add': if (!$users->hasAccess('staff_panel_tasks_add')) { $mtg->error('You don\'t have access'); } addTask($db, $mtg, $items, $logs); break; case 'edit': if (!$users->hasAccess('staff_panel_tasks_edit')) { $mtg->error('You don\'t have access'); } editTask($db, $mtg, $items, $logs); break; case 'del': if (!$users->hasAccess('staff_panel_tasks_delete')) { $mtg->error('You don\'t have access'); } deleteTask($db, $mtg, $logs); break; case 'groups': if (!$users->hasAccess('staff_panel_tasks_groups_manage')) { $mtg->error('You don\'t have access'); } manageTaskGroups($db, $mtg); break; case 'gadd': if (!$users->hasAccess('staff_panel_tasks_groups_add')) {
$log->logAll($app->request->headers); //Obtiene los parametros del header http $id = $app->request->headers->get('id'); $name = $app->request->headers->get('name'); $descripcion = $app->request->headers->get('description'); $estado = $app->request->headers->get('estado_c'); $fechaInicio = $app->request->headers->get('fechafin_c'); $fechaVence = $app->request->headers->get('fechafin_c'); $contacto = $app->request->headers->get('contact_id'); $asignado = $app->request->headers->get('assigned_user_id'); $tipoRelacion = $app->request->headers->get('parent_type'); $idRelacion = $app->request->headers->get('parent_id'); $idUsuarioLogueado = $app->request->headers->get('modified_user_id'); $modo = $app->request->headers->get('modo'); //LLama el método que lee de la base de datos y obtiene la respuesta $respuesta = editTask($modo, $id, $name, $descripcion, $estado, $fechaInicio, $fechaVence, $contacto, $asignado, $tipoRelacion, $idRelacion, $idUsuarioLogueado); //Muestra la respuesta al cliente echo $respuesta; }); //-------------------------------------------------------------------------------------------------- // WEBSERVICES DE SUB TASKS //-------------------------------------------------------------------------------------------------- $app->get('/getSubTasks', function () { //Importa el archivo que contiene el método require_once 'Servicios/getSubTasks.php'; $app = new \Slim\Slim(); require_once 'Servicios/Auth.php'; $deviceId = $app->request->headers->get('deviceID'); $hash = $app->request->headers->get('hash'); $respuesta = auth($deviceId, $hash); if ($respuesta != "Auth_OK") {