</th>
			 <th><?php 
p($l->t('Time'));
?>
</th>
			 <th><?php 
p($l->t('Comment'));
?>
</th>
		</tr>
		<?php 
for ($i = 0; $i < count($_['status_details']); $i++) {
    print_unescaped('
				<tr>
				  <td>' . OC_Collaboration_Task::getStatusInFormat($_['status_details'][$i]['status'], $_['status_details'][$i]['member'], $_['task_details']['creator']) . '</td>
				  <td>' . OC_Collaboration_Time::convertDBTimeToUITime($_['status_details'][$i]['time']) . '</td><td>' . $_['status_details'][$i]['comment'] . '</td>
				</tr>');
}
?>
	 </table>

	 <?php 
if (strcasecmp(OC_Collaboration_Task::getTaskCreator($_['task_details']['tid']), OC_User::getUser()) == 0) {
    ?>
		 <form action="<?php 
    print_unescaped(OCP\Util::linkToRoute('collaboration_route', array('rel_path' => 'update_task')));
    ?>
" method="post" >
			 <input type="hidden" name="tid" value="<?php 
    p($_['task_details']['tid']);
    ?>
    /**
     * @brief Provides details for generating the project timeline
     * @param Project ID
     */
    public static function getProjectStatus($pid)
    {
        try {
            $query = OCP\DB::prepare('SELECT `finished`.`count` AS finished, `pending`.`count` AS pending, 
									 `starting_date`, `ending_date`, now() as now, `completed`, `last_updated` 
									 FROM (SELECT COUNT(`status`) AS count
									  	  FROM `*PREFIX*collaboration_task_status` AS tstatus 
									  	  JOIN `*PREFIX*collaboration_task` AS task 
									  	  ON (`tstatus`.`tid`=`task`.`tid`) 
									  	  WHERE `task`.`pid`=? 
										  AND `last_updated_time`=
										  		(SELECT MAX(`last_updated_time`) 
										  		FROM `*PREFIX*collaboration_task_status` 
										  		WHERE `tid`=`tstatus`.`tid`) 
										  AND `status`=\'Verified\') AS finished,
										  (SELECT COUNT(`status`) AS count
									  	  FROM `*PREFIX*collaboration_task_status` AS tstatus 
									  	  JOIN `*PREFIX*collaboration_task` AS task 
									  	  ON (`tstatus`.`tid`=`task`.`tid`) 
									  	  WHERE `task`.`pid`=? 
										  AND `last_updated_time`=
										  		(SELECT MAX(`last_updated_time`) 
										  		FROM `*PREFIX*collaboration_task_status` 
										  		WHERE `tid`=`tstatus`.`tid`) 
										  AND `status`<>\'Verified\'
										  AND `status`<>\'Cancelled\') AS pending,
										  `*PREFIX*collaboration_project`
									WHERE `pid`=?');
            $result = $query->execute(array($pid, $pid, $pid));
            $details = array();
            if ($row = $result->fetchRow()) {
                $details['progress'] = self::findProgress($row['starting_date'], $row['ending_date'], $row['now'], $row['completed']);
                $details['start_date'] = OC_Collaboration_Time::convertDBTimeToUITime($row['starting_date']);
                $details['deadline'] = OC_Collaboration_Time::convertDBTimeToUITime($row['ending_date']);
                $details['updated_time'] = OC_Collaboration_Time::convertDBTimeToUITime($row['last_updated']);
                $details['now'] = OC_Collaboration_Time::convertDBTimeToUITime($row['now']);
                $details['completed'] = $row['completed'];
                $details['num_completed_tasks'] = $row['finished'];
                $details['num_pending_tasks'] = $row['pending'];
            }
            return $details;
        } catch (\Exception $e) {
            OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG);
            return false;
        }
    }
OCP\JSON::checkAppEnabled('collaboration');
$l = new OC_l10n('collaboration');
if (isset($_POST['start']) && isset($_POST['count']) && isset($_POST['project']) && isset($_POST['status']) && isset($_POST['assigned_to']) && isset($_POST['assigned_by'])) {
    if ($_POST['project'] != '' && !OC_Collaboration_Project::isMemberWorkingOnProjectByTitle(OC_User::getUser(), $_POST['project'])) {
        throw new Exception(OC_User::getUser() . ' is trying to access project ' . $_POST['project']);
        OC_JSON::error();
        exit;
    }
    $args = array('assigned_to' => $_POST['assigned_to'] == true ? OC_User::getUser() : NULL, 'assigned_by' => $_POST['assigned_by'] == true ? OC_User::getUser() : NULL, 'project' => $_POST['project'] == '' ? NULL : $_POST['project'], 'status' => $_POST['status'] == '' ? NULL : $_POST['status']);
    $tasks = OC_Collaboration_Task::readTasks($args, $_POST['start'], $_POST['count']);
    $text = '';
    foreach ($tasks as $each) {
        if (!isset($each['tid']) || $each['tid'] == '') {
            break;
        }
        $datetime = OC_Collaboration_Time::convertDBTimeToUITime($each['ending_time']);
        $text .= '<div class="unit">
					<div class="task_title">' . $each['title'] . '</div>

					<div class="contents">	
						<div class="description">' . $each['description'] . '</div>							
							<br />
							<form class="view_details" action="' . \OCP\Util::linkToRoute('collaboration_route', array('rel_path' => 'task_details')) . '" method="post" >
								<input type="hidden" name="tid" value="' . $each['tid'] . '" />
								<input type="submit" value="' . $l->t('View details') . '" />
						</form>' . (strcasecmp(OC_Collaboration_Task::getTaskCreator($each['tid']), OC_User::getUser()) == 0 ? '<div class="edit" >
							<button class="btn_edit" id="btn_edit_' . $each['tid'] . '" >' . $l->t('Edit') . '</button>
							</div>' : '') . '</div>

					<div class="details">
						<div class="task_status">' . $l->t('Status: %s', array(OC_Collaboration_Task::getStatusInFormat($each['status'], $each['member'], $each['creator']))) . '</div>