summaryrefslogtreecommitdiff
path: root/tasks_api.php
diff options
context:
space:
mode:
Diffstat (limited to 'tasks_api.php')
-rw-r--r--tasks_api.php28
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);
+ }
+}
+?>