예제 #1
0
 /**
  * Test task loading
  */
 public function loadTasks($id)
 {
     $load_task = new TaskerMAN\Application\Task($id);
     $this->assertEquals($load_task->created_uid, 1);
     $this->assertEquals($load_task->assignee_uid, 1);
     $this->assertEquals($load_task->status, 1);
     $this->assertEquals($load_task->title, 'PHPUnit Testing');
     // Get steps
     $steps = $load_task->getSteps();
     $this->assertEquals($steps[0]['title'], 'Write some unit tests');
 }
예제 #2
0
<?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));
예제 #3
0
  				<br />

  				<div class="input-group input-group-md">
	  				<input type="submit" name="submit" value="Submit" class="btn btn-md btn-primary" />
	  			</div>

			</div>
		</div>
	</form>

	<hr />

	<h3>Manage Steps</h3>

	<?php 
$steps = $task->getSteps();
$i = 0;
foreach ($steps as $step) {
    $i++;
    ?>

	<div class="panel panel-info">
	  	<div class="panel-heading">Step #<?php 
    echo $i;
    ?>
</div>
	  	<div class="panel-body">
		  
			<form method="post" action="index.php?p=edit_step&amp;id=<?php 
    echo $step['id'];
    ?>
예제 #4
0
<?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);