function showTasks() { $inbox = getTasks('inbox'); $next = getTasks('next'); $someday = getTasks('someday'); echo "<h4>Inbox</h4>"; echo showByType($inbox); echo "<h4>Next</h4>"; echo showByType($next); echo "<h4>Someday</h4>"; echo showByType($someday); }
require 'vendor/autoload.php'; $app = new \Slim\Slim(); //http://hostname/api/ $app->get('/', function () use($app) { echo "Welcome to Task REST API"; }); // http://domain.address/api/tasks $app->get('/tasks', function () use($app) { $tasks = getTasks(); //Define what kind is this response $app->response()->header('Content-Type', 'application/json'); echo json_encode($tasks); }); $app->get('/tasks/:id', function ($id) use($app) { $tasks = getTasks(); $index = array_search($id, array_column($tasks, 'id')); if ($index > -1) { $app->response()->header('Content-Type', 'application/json'); echo json_encode($tasks[$index]); } else { $app->response()->setStatus(204); } }); //TODO move it to a DAO class function getTasks() { $tasks = array(array('id' => 1, 'description' => 'Learn REST', 'done' => false), array('id' => 2, 'description' => 'Learn JavaScript', 'done' => false), array('id' => 3, 'description' => 'Learn English', 'done' => false)); return $tasks; } $app->run();
return json_encode($data); } //getNewWeeklyID if ($task == "getServices") { $data = getServices($userid); echo $data; } //getServices if ($task == "lookupService") { $service = $request->service; $data = lookupService($userid, $service); echo $data; } //lookupService if ($task == "getTasks") { echo getTasks(); } //task getTimes if ($task == "addTask") { $description = $request->taskdescription; echo addTask($description); } //task addProject if ($task == "getAllEntries") { $billed = $request->includebilled; $data = getAllEntries($userid, $billed); echo $data; } //task getAllEntries if ($task == "loadAllInvoices") { $data = loadAllInvoices($userid);
$class = $class == 'Cmite' ? 'Cnorm' : 'Cmite'; $row['class'] = $class; $tpl->set_ar_out($row, 4); } } // Tabellenuebergang $tpl->out(1); // Aendern oder Einfuegen if ($aid == 'edit') { $lid = $menu->get(3); $erg = db_query('SELECT `task`, `file`, `description` FROM `prefix_loader` WHERE `id` = ' . $lid); $row = db_fetch_assoc($erg); $task = getTasks($row['task']); $tpl->set_ar_out(array('aname' => 'Eintrag bearbeiten', 'task' => $task, 'file' => $row['file'], 'description' => $row['description'], 'ANTISPAM' => get_antispam('adminuser_action', 0, true)), 5); } else { $task = getTasks(''); $tpl->set_ar_out(array('aname' => 'Eintrag hinzufügen', 'task' => $task, 'file' => '', 'description' => '', 'ANTISPAM' => get_antispam('adminuser_action', 0, true)), 5); } // Template-Footer $tpl->out(2); break; case 'del': // Betroffene Task-ID $lid = $menu->get(3); // Wert entfernen db_query('DELETE FROM `prefix_loader` WHERE `id` = ' . $lid); wd('admin.php?modules-loader', 'Eintrag gelöscht'); $design->footer(1); break; } $design->footer();
<?php include 'exec.php'; header("Content-type: application/json"); echo json_encode(getTasks());
getRemoteModuleList(); } else { if (isset($_GET['getLocalModuleList'])) { getLocalModuleList(); } else { if (isset($_GET['addModule'])) { addModule($_GET['addModule']); } else { if (isset($_GET['deleteModule'])) { deleteModule($_GET['deleteModule']); } else { if (isset($_GET['cancelTask'])) { cancelTask($_GET['cancelTask']); } else { if (isset($_GET['getTasks'])) { getTasks(); } else { if (isset($_GET['wifistat'])) { wifiStatus(); } else { if (isset($_GET['selfUpdate'])) { selfUpdate(); } else { if (isset($_GET['modUpdate'])) { addModule($_GET['modUpdate']); } else { if (isset($_GET['setLocalContent'])) { setLocalContent($_GET['setLocalContent']); } else { if (isset($_GET['getBatteryInfo'])) { getBatteryInfo();
<?php require_once 'lib.php'; if (!isset($_SESSION)) { session_start(); } $tasks = array(); if (isset($_SESSION['name'])) { $tasks = getTasks($_SESSION['name']); }
function printListofTasks($AID) { $tasks = getTasks($AID); $tasksN = count($tasks); echo "<form action='action.php' method='post'>"; for ($x = 0; $x < $tasksN; $x = $x + 4) { //$x ==Task IDKey $x1 = $x + 1; //==Name $x2 = $x1 + 1; //==Start Date $x3 = $x2 + 1; //End Date echo "<button type='submit' name='TID' value='{$tasks[$x]}'>{$tasks[$x1]}</button>\n\t\t<input type='check' value='{$tasks[$x]}' name='TIDS[]' hidden>"; } echo "<button type='submit' name='mode' value='assign' class='MediumButton'>Assign Tasks</button>"; echo "</form>"; }
//Importa el archivo que contiene el método require_once 'Servicios/getTasks.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") { echo $respuesta; return; } $currentUser = $app->request->headers->get('currentUser'); $log = new IOManager(); $log->logAll($app->request->headers); //LLama el método que lee de la base de datos y obtiene la respuesta $respuesta = getTasks($currentUser); //Muestra la respuesta al cliente echo $respuesta; }); //-------------------------------------------------------------------------------------------------- $app->get('/getTaskxAccount', function () { //Importa el archivo que contiene el método require_once 'Servicios/getTask.php'; $app = new \Slim\Slim(); require_once 'Servicios/Auth.php'; $log = new IOManager(); $log->logAll($app->request->headers); $deviceId = $app->request->headers->get('deviceID'); $hash = $app->request->headers->get('hash'); $respuesta = auth($deviceId, $hash); if ($respuesta != "Auth_OK") {