Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestReportController.php
Show First 20 Lines • Show All 378 Lines • ▼ Show 20 Lines | private function formatBurnRow($label, $info) { | ||||
return array( | return array( | ||||
$label, | $label, | ||||
number_format($info['open']), | number_format($info['open']), | ||||
number_format($info['close']), | number_format($info['close']), | ||||
$fmt, | $fmt, | ||||
); | ); | ||||
} | } | ||||
private function makeLinkToEntry($handle, $project_handle, $priority) { | |||||
$project_phids = array(); | |||||
if ($project_handle) { | |||||
$project_phids[] = $project_handle->getPHID(); | |||||
} | |||||
$link = '/maniphest/?status=open()'; | |||||
switch ($this->view) { | |||||
case 'project': | |||||
if ($handle) { | |||||
$project_phids[] = $handle->getPHID(); | |||||
} | |||||
if (empty($project_phids)) { | |||||
$link .= '&projects=null()'; | |||||
} | |||||
break; | |||||
case 'user': | |||||
if ($handle) { | |||||
$link .= '&assigned='.$handle->getPHID(); | |||||
} else { | |||||
$link .= '&assigned=none()'; | |||||
} | |||||
break; | |||||
} | |||||
if (!empty($project_phids)) { | |||||
$link .= '&projects='.implode(',', $project_phids); | |||||
} | |||||
if ($priority !== null) { | |||||
$link .= '&priority='.$priority; | |||||
} | |||||
return $link; | |||||
} | |||||
public function renderOpenTasks() { | public function renderOpenTasks() { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$query = id(new ManiphestTaskQuery()) | $query = id(new ManiphestTaskQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withStatuses(ManiphestTaskStatus::getOpenStatusConstants()); | ->withStatuses(ManiphestTaskStatus::getOpenStatusConstants()); | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | foreach (array_merge($handles, array(null)) as $handle) { | ||||
if ($handle) { | if ($handle) { | ||||
if (($project_handle) && | if (($project_handle) && | ||||
($project_handle->getPHID() == $handle->getPHID())) { | ($project_handle->getPHID() == $handle->getPHID())) { | ||||
// If filtering by, e.g., "bugs", don't show a "bugs" group. | // If filtering by, e.g., "bugs", don't show a "bugs" group. | ||||
continue; | continue; | ||||
} | } | ||||
$tasks = idx($result, $handle->getPHID(), array()); | $tasks = idx($result, $handle->getPHID(), array()); | ||||
$link = $this->makeLinkToEntry($handle, $project_handle, null); | |||||
$name = phutil_tag( | $name = phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $base_link.$handle->getPHID(), | 'href' => $link, | ||||
), | ), | ||||
$handle->getName()); | $handle->getName()); | ||||
$closed = idx($result_closed, $handle->getPHID(), array()); | $closed = idx($result_closed, $handle->getPHID(), array()); | ||||
} else { | } else { | ||||
$tasks = $leftover; | $tasks = $leftover; | ||||
$name = $leftover_name; | $name = $leftover_name; | ||||
$closed = $leftover_closed; | $closed = $leftover_closed; | ||||
} | } | ||||
$taskv = $tasks; | $taskv = $tasks; | ||||
$tasks = mgroup($tasks, 'getPriority'); | $tasks = mgroup($tasks, 'getPriority'); | ||||
$row = array(); | $row = array(); | ||||
$row[] = $name; | $row[] = $name; | ||||
$total = 0; | $total = 0; | ||||
$total_tasks = array(); | |||||
foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $label) { | foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $label) { | ||||
$n = count(idx($tasks, $pri, array())); | $pri_tasks = idx($tasks, $pri, array()); | ||||
$total_tasks = array_merge($total_tasks, $pri_tasks); | |||||
$n = count($pri_tasks); | |||||
if ($n == 0) { | if ($n == 0) { | ||||
$row[] = '-'; | $row[] = '-'; | ||||
} else { | } else { | ||||
$row[] = number_format($n); | $link = $this->makeLinkToEntry($handle, $project_handle, $pri); | ||||
$row[] = phutil_tag( | |||||
'a', | |||||
array( | |||||
'href' => $link, | |||||
'target' => '_blank', | |||||
), | |||||
number_format($n)); | |||||
} | } | ||||
$total += $n; | $total += $n; | ||||
} | } | ||||
$row[] = number_format($total); | |||||
$row[] = phutil_tag( | |||||
epriestley: This is unused, and this approach won't scale for large numbers of tasks. | |||||
'a', | |||||
array( | |||||
'href' => $this->makeLinkToEntry($handle, $project_handle, null), | |||||
'target' => '_blank', | |||||
), | |||||
number_format($total)); | |||||
list($link, $oldest_all) = $this->renderOldest($taskv); | list($link, $oldest_all) = $this->renderOldest($taskv); | ||||
$row[] = $link; | $row[] = $link; | ||||
$normal_or_better = array(); | $normal_or_better = array(); | ||||
foreach ($taskv as $id => $task) { | foreach ($taskv as $id => $task) { | ||||
// TODO: This is sort of a hard-code for the default "normal" status. | // TODO: This is sort of a hard-code for the default "normal" status. | ||||
// When reports are more powerful, this should be made more general. | // When reports are more powerful, this should be made more general. | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |
This is unused, and this approach won't scale for large numbers of tasks.