<?php 
    p($l->t('Status'));
    ?>
					</td>
					<td>
						<?php 
    $ev_stat = array();
    $status = NULL;
    if (!isset($_['tid'])) {
        $ev_stat = OC_Collaboration_Task::getEventStatus('Created', 'Creator');
        $status = 'New';
    } else {
        $ev_stat = OC_Collaboration_Task::getEventStatus($_['task_details']['status'], 'Creator');
        $status = $_['task_details']['status'];
        $member = $_['task_details']['member'];
        print_unescaped('<span id="task_status">' . OC_Collaboration_Task::getStatusInFormat($status, $member, OC_User::getUser()) . '</span><br />');
    }
    $i = 0;
    foreach ($ev_stat as $event => $status) {
        print_unescaped('<input class="event" id="event_' . $i . '" value="' . $status . '" name="status" type="radio" data-next-status="' . $status . '" />');
        print_unescaped('<label for="event_' . $i . '" >' . OC_Collaboration_Task::translateEvent($event) . '</label>');
        switch ($event) {
            case 'Assign':
                print_unescaped('<span class="event_info" id="event_info_' . $i . '" >
															<select id="members" name="member" ></select>
															<br />
															<a id="skillset_link" href="" target="_blank" >' . $l->t('View availablility & skillset') . '</a><br />
															<input type="checkbox" id="send_mail" name="send_mail" />
															<label for="send_mail" >' . $l->t('Inform member via mail') . '</label></span>');
                break;
            case 'Cancel':
    $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>
						
						<div class="deadline_details">' . $l->t('Deadline: %s', array($l->l('datetime', $datetime))) . '</div>
					</div>
				</div>';
    }
    OCP\JSON::success(array('tasks' => $text));
    exit;
}
OC_JSON::error();
exit;
?>
</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']);
        <div class='clear-both-np'>
          <div class="cb-wrapper">
					<div class="contents">
            <div class="cb-date">
              <p>
                <b>Project</b>
                <?php 
        print_unescaped($each['proj_title']);
        ?>
              </p>
            </div>
            <div class="cb-date">
              <p>
                <b>Task Status</b>
                <?php 
        print_unescaped(OC_Collaboration_Task::getStatusInFormat($each['status'], $each['member'], $each['creator']));
        ?>
              </p>
            </div>
            <div class="cb-date">
              <b> Deadline</b>
              <?php 
        $datetime = OC_Collaboration_Time::convertDBTimeToUITime($each['ending_time']);
        p($l->t(' %s', array($l->l('datetime', $datetime))));
        ?>
            </div>
            <!--
            <div class="cb-date">
              <a href='#' class="open-description">Read more</a>
            </div>
            -->