diff options
author | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
commit | 61d1aa04d8d44b17bfe6dace90088669fc6c3df8 (patch) | |
tree | 7ede15c880e4c41a18cded46fe6d03fb2dc4543b /tasks_api.php | |
download | mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.zip mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.tar.gz mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.tar.bz2 |
* Registration system's almost done
* Just part way through implementing tasks
So not much done yet, but it's a start.
Diffstat (limited to 'tasks_api.php')
-rw-r--r-- | tasks_api.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tasks_api.php b/tasks_api.php new file mode 100644 index 0000000..e65b0e9 --- /dev/null +++ b/tasks_api.php @@ -0,0 +1,28 @@ +<?php +namespace mcoop; +require_once("common/config.php"); + +function get_all_tasks_simple($db) { + $tasks = SimpleTask::get_all_simple($db); + foreach ($tasks as $k => $task) { + $task->load_admin($db); + $task->load_tdcs($db, false); + } + header("Content-Type: application/json"); + // TODO: this should probably use tasks->to_json instead so as to not serialize more than needed + echo json_encode($tasks); + //var_dump($tasks); +} + +$mapping = array( + "get_all_tasks_simple" => "\mcoop\get_all_tasks_simple" +); + +if (isset($_GET["action"])) { + $action = $_GET["action"]; + if (array_key_exists($action, $mapping)) { + $funcname = $mapping[$action]; + $funcname($db); + } +} +?> |