view = idx($data, 'view');
}
public function processRequest() {
$views = array(
'Your Tasks',
'action' => 'Action Required',
// 'activity' => 'Recently Active',
// 'closed' => 'Recently Closed',
'created' => 'Created',
'triage' => 'Need Triage',
'
',
'All Open Tasks',
'alltriage' => 'Need Triage',
'unassigned' => 'Unassigned',
'allopen' => 'All Open',
);
if (empty($views[$this->view])) {
$this->view = 'action';
}
$tasks = $this->loadTasks();
$nav = new AphrontSideNavView();
foreach ($views as $view => $name) {
if (is_integer($view)) {
$nav->addNavItem(
phutil_render_tag(
'span',
array(),
$name));
} else {
$nav->addNavItem(
phutil_render_tag(
'a',
array(
'href' => '/maniphest/view/'.$view.'/',
'class' => ($this->view == $view)
? 'aphront-side-nav-selected'
: null,
),
phutil_escape_html($name)));
}
}
$handle_phids = mpull($tasks, 'getOwnerPHID');
$handles = id(new PhabricatorObjectHandleData($handle_phids))
->loadHandles();
$task_list = new ManiphestTaskListView();
$task_list->setTasks($tasks);
$task_list->setHandles($handles);
$nav->appendChild(
'');
$nav->appendChild($task_list);
return $this->buildStandardPageResponse(
$nav,
array(
'title' => 'Task List',
));
}
private function loadTasks() {
$request = $this->getRequest();
$user = $request->getUser();
$phids = array($user->getPHID());
switch ($this->view) {
case 'action':
return id(new ManiphestTask())->loadAllWhere(
'ownerPHID in (%Ls) AND status = 0',
$phids);
case 'created':
return id(new ManiphestTask())->loadAllWhere(
'authorPHID in (%Ls) AND status = 0',
$phids);
case 'triage':
return id(new ManiphestTask())->loadAllWhere(
'ownerPHID in (%Ls) and status = %d',
$phids,
ManiphestTaskPriority::PRIORITY_TRIAGE);
case 'alltriage':
return id(new ManiphestTask())->loadAllWhere(
'status = %d',
ManiphestTaskPriority::PRIORITY_TRIAGE);
case 'unassigned':
return id(new ManiphestTask())->loadAllWhere(
'ownerPHID IS NULL');
case 'allopen':
return id(new ManiphestTask())->loadAllWhere(
'status = 0');
}
return array();
}
}