<?php require_once './libraries/Freedcamp.php'; $oFreedcamp = new Freedcamp(); $project_id = $_GET['project_id']; $todo_id = $_GET['todo_id']; $aTodo = $oFreedcamp->getTodoByTodoId($todo_id); if ($aTodo['http_code'] != 200) { die('Error finding todo!'); } $todo = $aTodo['item']; $todo_groups = $oFreedcamp->getTodoGroupsByProjectId($project_id); if ($todo_groups['http_code'] != '200') { die('Error finding todo groups'); } $todos_groups_array = array(); if (get_class($todo_groups['item']) == 'SimpleXMLElement') { $todos_groups_array[] = $todo_groups['item']; } else { $todos_groups_array = $todo_groups['item']; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $description = $_POST['description']; $todo_groupid = $_POST['todo_groupid']; $priority = $_POST['priority']; $due_date = $_POST['due_date']; $res = $oFreedcamp->editTodo($todo_id, $description, $todo_groupid, $priority, $due_date); if ($res['http_code'] == '200') { header('Location: todo_view.php?todo_id=' . $todo_id . '&project_id=' . $project_id); } else { die($res['item']);
<?php require_once './libraries/Freedcamp.php'; $oFreedcamp = new Freedcamp(); $project_id = $_GET['project_id']; $aTodos = $oFreedcamp->getTodosByProjectId($project_id); //var_dump($aTodos);die; if ($aTodos['http_code'] != 200) { die('Error finding todos!'); } else { $todos_array = array(); if (get_class($aTodos['item']) == 'SimpleXMLElement') { $todos_array[] = $aTodos['item']; } else { $todos_array = $aTodos['item']; } } ?> <html> <head> <title>Freedcamp PHP API example</title> </head> <body> <h2>List of todos</h2> <a href="todo_add.php?project_id=<?php echo $project_id; ?> ">Add new</a> <table> <tr>
<?php require_once './libraries/Freedcamp.php'; $oFreedcamp = new Freedcamp(); $aProjects = $oFreedcamp->getProjects(); if ($aProjects['http_code'] != 200) { die('Error finding projects!'); } else { $projects_array = array(); if (get_class($aProjects['item']) == 'SimpleXMLElement') { $projects_array[] = $aProjects['item']; } else { $projects_array = $aProjects['item']; } } ?> <html> <head> <title>Freedcamp PHP API example</title> </head> <body> <h2>Freedcamp projects that you have access</h2> <table> <tr> <th>Project name</th> <th> </th> </tr> <?php foreach ($projects_array as $project_object) { ?>
<?php require_once './libraries/Freedcamp.php'; $oFreedcamp = new Freedcamp(); $project_id = $_GET['project_id']; $todo_id = $_GET['todo_id']; $res = $oFreedcamp->deleteTodo($todo_id); ?> <html> <head> <title>Freedcamp PHP API example</title> </head> <body> <?php if ($res['http_code'] == 200) { ?> Todo deleted successfully! <a href="todos.php?project_id=<?php echo $project_id; ?> ">Back to todos</a> <?php } else { ?> <?php } ?> </body> </html>
<?php require_once './libraries/Freedcamp.php'; $oFreedcamp = new Freedcamp(); $project_id = $_GET['project_id']; $todo_id = $_GET['todo_id']; $aTodo = $oFreedcamp->getTodoByTodoId($todo_id); if ($aTodo['http_code'] != 200) { die('Error finding todo!'); } $todo = $aTodo['item']; ?> <html> <head> <title>Freedcamp PHP API example</title> </head> <body> <h2>Todo View</h2> <table> <tr> <td><b>Description:</b></td> <td><?php echo $todo->description; ?> </td> </tr> <tr> <td><b>Priority:</b></td> <td><?php