<?php // Get task ID to add this step to $task_id = TaskerMAN\Core\IO::GET('task_id'); try { // Creates a new step, loads information, and then saves $step = new TaskerMAN\Application\TaskStep(); $step->setTaskID(TaskerMAN\Core\IO::GET('task_id')); $step->setComment(TaskerMAN\Core\IO::POST('comment')); $step->setTitle(TaskerMAN\Core\IO::POST('title')); $step->save(); } catch (TaskerMAN\Application\TaskException $e) { } // Redirect back to the task page header('Location: index.php?p=task&id=' . $task_id);
</div> <br /> <div class="input-group input-group-md"> <span class="input-group-addon" id="sizing-addon3">Assigned To</span> <select name="assigned-to" class="form-control"> <?php echo TaskerMAN\WebInterface\UserListDropdownGenerator::generate(TaskerMAN\Core\IO::POST('assigned-to')); ?> </select> </div> <br /> <div class="input-group input-group-md"> <span class="input-group-addon" id="sizing-addon4">Initial Step</span> <input type="text" name="step-text" class="form-control" aria-describedby="sizing-addon4" value="<?php echo TaskerMAN\Core\IO::POST('step-text'); ?> "> </div> <br /> <div class="input-group input-group-md"> <input type="submit" name="submit" value="Submit" class="btn btn-md btn-primary" /> </div> </form> </div> </div> </div>
Once you have done that, you can create your first administrative user below. </p> </div> </div> <?php if (!is_null($alert)) { echo $alert; } if (isset($_POST['name'])) { $name_placeholder = 'value="' . TaskerMAN\Core\IO::POST('name') . '"'; } else { $name_placeholder = null; } if (isset($_POST['email'])) { $email_placeholder = 'value="' . TaskerMAN\Core\IO::POST('email') . '"'; } else { $email_placeholder = null; } ?> <label for="name" class="sr-only">Name</label> <input type="text" id="name" name="name" class="form-control" placeholder="Full Name" <?php echo $name_placeholder; ?> required autofocus> <label for="email" class="sr-only">Email address</label> <input type="email" id="email" name="email" class="form-control" placeholder="Email address" <?php echo $email_placeholder; ?>
} catch (TaskerMAN\Application\UserManagementException $e) { $alert = '<div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div>'; } } elseif (isset($_POST['submit'])) { // Form submitted if (isset($_POST['admin'])) { $is_admin = true; } else { $is_admin = false; } // Update user try { TaskerMAN\Application\UserManagement::update($user->id, TaskerMAN\Core\IO::POST('name'), TaskerMAN\Core\IO::POST('email'), $is_admin); // Update password if (!empty(TaskerMAN\Core\IO::POST('password'))) { TaskerMAN\Application\UserManagement::changePassword($user->id, TaskerMAN\Core\IO::POST('password')); } // Reload user $user = new TaskerMAN\Application\User($uid); $alert = '<div class="alert alert-info" role="alert">User settings were succesfully updated</div>'; } catch (TaskerMAN\Application\UserManagementException $e) { $alert = '<div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div>'; } } ?> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> <?php if (isset($alert)) { echo $alert;
echo $stats['average_completion_time']; ?> average completion time</span> </div> </div> <?php // Only show 'Allocated' tasks TaskerMAN\Application\TaskListInterface::setSearchCriteria('status', 1); // Pagination $Pagination = new TaskerMAN\WebInterface\WebPagination(); $Pagination->setItemsPerPage(25); $Pagination->setNumItems(TaskerMAN\Application\TaskListInterface::getNumTasks()); $Pagination->setCurrentPage(TaskerMAN\Core\IO::GET('page')); $Pagination->setBaseURL('index.php?p=main'); TaskerMAN\Application\TaskListInterface::setStartPosition($Pagination->generateLIMITStartPosition()); TaskerMAN\Application\TaskListInterface::setLimit($Pagination->getItemsPerPage()); // Load tasks $TaskData = TaskerMAN\Application\TaskListInterface::getTasks(true); ?> <h2 class="sub-header">Outstanding Tasks</h2> <div class="table-responsive"> <div align="center"> <?php echo $Pagination->getOutput(); ?> </div>
<?php // Get username and password $email = TaskerMAN\Core\IO::GET('email'); $password = TaskerMAN\Core\IO::GET('password'); if (empty($email) || empty($password)) { throw new TaskerMAN\Application\APIErrorException('Requires email and password'); } // Verify the user's login credentials $user = TaskerMAN\Application\Login::verifyCredentials($email, $password); // Login details incorrect if (!$user) { throw new TaskerMAN\Application\APIErrorException('Incorrect email or password'); } // Login success, return API Token echo TaskerMAN\Application\API::response(array('key' => $user->api_token));
<?php // Get array of task IDs $ids = explode(',', TaskerMAN\Core\IO::GET('id')); // Remove non-numeric IDs foreach ($ids as $key => $id) { if (!is_numeric($id)) { unset($ids[$key]); } } $steps = array(); // Loop through each task foreach ($ids as $id) { $task = new TaskerMAN\Application\Task($id); if (is_null($task->id)) { // Unable to load task throw new TaskerMAN\Application\APIErrorException('Task ' . $id . ' does not exist'); } if ((int) $task->assignee_uid !== TaskerMAN\Application\API::$uid) { throw new TaskerMAN\Application\APIErrorException('User does not have access to task ' . $id); } // Load steps into response array $steps[$id] = $task->getSteps(); } if (empty($steps)) { throw new TaskerMAN\Application\APIErrorException('No steps found'); } echo TaskerMAN\Application\API::response(array('steps' => $steps));
<?php // Get task ID and status variables $task_id = (int) TaskerMAN\Core\IO::GET('id'); $status = (int) TaskerMAN\Core\IO::GET('status'); // Expects time in UNIX timestamp format $completed_time = (int) TaskerMAN\Core\IO::GET('completed_time'); // If no completed time is passed, use current time if (empty($completed_time)) { $completed_time = time(); } $task = new TaskerMAN\Application\Task($task_id); if (empty($task->id)) { // Unable to load task, throw error throw new TaskerMAN\Application\APIErrorException('Invalid task ID'); } switch ($status) { // Make sure we're not setting the status to a state it's already in case $task->status: throw new TaskerMAN\Application\APIErrorException('Trying to change status to same value as it already has'); break; // allocated // allocated case 1: $task->setStatus(1); $task->setCompletedTime('0000-00-00 00:00:00'); break; // completed // completed case 2: $task->setStatus(2);
TaskerMAN\WebInterface\WebInterface::setTitle('Task ' . $task_id); ?> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> <?php if (isset($_POST['submit'])) { try { $task->setTitle(TaskerMAN\Core\IO::POST('task-title')); $task->setDueBy(TaskerMAN\Core\IO::POST('due-date')); $task->setAssignee(TaskerMAN\Core\IO::POST('assigned-to')); // Task changed to completed if ($task->status != 2 && TaskerMAN\Core\IO::POST('status') == 2) { $task->setCompletedTime(); } $task->setStatus(TaskerMAN\Core\IO::POST('status')); $task->save(); } catch (TaskerMAN\Application\TaskException $e) { $alert = '<div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div>'; } } if (isset($alert)) { echo $alert; } switch ($task->status) { case 0: $label = '<span class="label label-default">Abandoned</span>'; break; case 1: $label = '<span class="label label-primary">Allocated</span>'; break;
<?php $id = (int) TaskerMAN\Core\IO::GET('id'); $comment = TaskerMAN\Core\IO::POST('comment', false); $step = new TaskerMAN\Application\TaskStep($id); if ($step->task_id === NULL) { // Unable to load step, does not exist throw new TaskerMAN\Application\APIErrorException('Unknown step ID'); } // Check that user is permitted to modify this task if ((int) $step->assignee_uid != TaskerMAN\Application\API::$uid) { throw new TaskerMAN\Application\APIErrorException('User does not have access to modify this step'); } // Set comment and commit changes try { $step->setComment($comment); $step->save(); } catch (TaskerMAN\Application\TaskException $e) { throw new TaskerMAN\Application\APIErrorException($e->getMessage()); } echo TaskerMAN\Application\API::response('Step comment updated successfully');
<?php $id = (int) TaskerMAN\Core\IO::GET('id'); $task = new TaskerMAN\Application\Task($id); if (is_null($task->id)) { // Unable to load task throw new TaskerMAN\Application\APIErrorException('Task does not exist'); } if ((int) $task->assignee_uid !== TaskerMAN\Application\API::$uid) { throw new TaskerMAN\Application\APIErrorException('User does not have access to this task'); } $result = array('id' => $task->id, 'created_uid' => $task->created_uid, 'created_name' => $task->created_name, 'assignee_uid' => $task->assignee_uid, 'assignee_name' => $task->assignee_name, 'due_by' => $task->due_by, 'completed_time' => $task->completed_time, 'status' => $task->status, 'title' => $task->title, 'steps' => $task->getSteps()); echo TaskerMAN\Application\API::response($result);
<form method="post" action="index.php?p=new_user"> <div class="input-group input-group-md"> <span class="input-group-addon" id="sizing-addon1">Name</span> <input type="text" name="name" class="form-control" placeholder="Name" aria-describedby="sizing-addon1" maxlength="50" value="<?php echo TaskerMAN\Core\IO::POST('name'); ?> "> </div> <br /> <div class="input-group input-group-md"> <span class="input-group-addon" id="sizing-addon2">Email Address</span> <input type="email" name="email" class="form-control" placeholder="Email Address" aria-describedby="sizing-addon2" value="<?php echo TaskerMAN\Core\IO::POST('email'); ?> "> </div> <br /> <div class="input-group input-group-md"> <span class="input-group-addon" id="sizing-addon3">Password</span> <input type="password" name="password" class="form-control" placeholder="Password" aria-describedby="sizing-addon3"> </div> <br /> <div class="input-group input-group"> <span class="input-group-addon" id="sizing-addon4">Administrator </span>
$base_url = 'index.php?'; foreach ($_GET as $key => $val) { if ($key == 'page') { continue; } $base_url .= $key . '=' . TaskerMAN\Core\IO::sanitize($val) . '&'; } $base_url = trim($base_url, '&'); $Pagination->setBaseURL($base_url); TaskerMAN\Application\TaskListInterface::setStartPosition($Pagination->generateLIMITStartPosition()); TaskerMAN\Application\TaskListInterface::setLimit($Pagination->getItemsPerPage()); /** * Handle sorting */ $sort_col = TaskerMAN\Core\IO::get('sort_col'); $sort_dir = TaskerMAN\Core\IO::get('sort_dir'); if (empty($sort_col)) { $sort_col = 'due_by'; } if (empty($sort_dir)) { $sort_dir = 'ASC'; } TaskerMAN\Application\TaskListInterface::setSort($sort_col, $sort_dir); $TaskData = TaskerMAN\Application\TaskListInterface::getTasks(true); ?> <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"> <div class="row"> <div class="col-md-9"> <div class="panel panel-info">