OCP\Util::addStyle('collaboration', 'content_header');
OCP\Util::addStyle('collaboration', 'tasks');
$tpl = new OCP\Template("collaboration", "tasks", "user");
$args = array('project' => NULL, 'status' => NULL, 'assigned_by' => NULL, 'assigned_to' => NULL);
if (isset($_GET['project']) && $_GET['project'] != 'ALL') {
    if (!OC_Collaboration_Project::isMemberWorkingOnProjectByTitle(OC_User::getUser(), $_GET['project'])) {
        header('Location: ' . \OCP\Util::linkToRoute('collaboration_route', array('rel_path' => 'dashboard')));
        throw new Exception(OC_User::getUser() . ' is trying to access project ' . $_GET['project']);
        exit;
    } else {
        $tpl->assign('project', $_GET['project']);
        $args['project'] = $_GET['project'];
    }
}
if (isset($_GET['status']) && $_GET['status'] != 'ALL') {
    $tpl->assign('status', $_GET['status']);
    $args['status'] = $_GET['status'];
}
if (!isset($_GET['assigned_by']) && !isset($_GET['assigned_to'])) {
    $_GET['assigned_by'] = $_GET['assigned_to'] = 'on';
}
if (isset($_GET['assigned_by'])) {
    $tpl->assign('assigned_by', $_GET['assigned_by']);
    $args['assigned_by'] = OC_User::getUser();
}
if (isset($_GET['assigned_to'])) {
    $tpl->assign('assigned_to', $_GET['assigned_to']);
    $args['assigned_to'] = OC_User::getUser();
}
$tpl->assign('tasks', OC_Collaboration_Task::readTasks($args));
$tpl->printPage();
* You should have received a copy of the GNU Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
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') . '" />
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('collaboration');
OCP\App::setActiveNavigationEntry('collaboration');
OCP\Util::addScript('collaboration', 'dashboard');
OCP\Util::addStyle('collaboration', 'tabs');
OCP\Util::addStyle('collaboration', 'content_header');
OCP\Util::addStyle('collaboration', 'dashboard');
$tpl = new OCP\Template("collaboration", "dashboard", "user");
if (isset($_GET['project']) && $_GET['project'] != 'ALL') {
    if (!OC_Collaboration_Project::isMemberWorkingOnProjectByTitle(OC_User::getUser(), $_GET['project'])) {
        header('Location: ' . \OCP\Util::linkToRoute('collaboration_route', array('rel_path' => 'dashboard')));
        \OCP\Util::writeLog('collaboration', OC_User::getUser() . ' is trying to access project ' . $_GET['project'], \OCP\Util::WARN);
        exit;
    } else {
        $tpl->assign('project', $_GET['project']);
        $tpl->assign('posts', OC_Collaboration_Post::readPosts(OC_User::getUser(), $_GET['project']));
        $task_params["assigned_by"] = OC_User::getUser();
        $task_params["project"] = $_GET['project'];
        $tpl->assign('tasks', OC_Collaboration_Task::readTasks($task_params));
    }
} else {
    $tpl->assign('posts', OC_Collaboration_Post::readPosts(OC_User::getUser()));
    $task_params["assigned_to"] = OC_User::getUser();
    $tpl->assign('tasks', OC_Collaboration_Task::readTasks($task_params));
}
$tpl->printPage();