Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/view/ManiphestTaskListView.php
<?php | <?php | ||||
final class ManiphestTaskListView extends ManiphestView { | final class ManiphestTaskListView extends ManiphestView { | ||||
private $tasks; | private $tasks; | ||||
private $handles; | private $handles; | ||||
private $customFieldLists = array(); | |||||
private $showBatchControls; | private $showBatchControls; | ||||
private $noDataString; | private $noDataString; | ||||
public function setTasks(array $tasks) { | public function setTasks(array $tasks) { | ||||
assert_instances_of($tasks, 'ManiphestTask'); | assert_instances_of($tasks, 'ManiphestTask'); | ||||
$this->tasks = $tasks; | $this->tasks = $tasks; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setHandles(array $handles) { | public function setHandles(array $handles) { | ||||
assert_instances_of($handles, 'PhabricatorObjectHandle'); | assert_instances_of($handles, 'PhabricatorObjectHandle'); | ||||
$this->handles = $handles; | $this->handles = $handles; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setCustomFieldLists(array $lists) { | |||||
$this->customFieldLists = $lists; | |||||
return $this; | |||||
} | |||||
public function setShowBatchControls($show_batch_controls) { | public function setShowBatchControls($show_batch_controls) { | ||||
$this->showBatchControls = $show_batch_controls; | $this->showBatchControls = $show_batch_controls; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setNoDataString($text) { | public function setNoDataString($text) { | ||||
$this->noDataString = $text; | $this->noDataString = $text; | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | foreach ($this->tasks as $task) { | ||||
$href = new PhutilURI('/maniphest/task/edit/'.$task->getID().'/'); | $href = new PhutilURI('/maniphest/task/edit/'.$task->getID().'/'); | ||||
$item->addAction( | $item->addAction( | ||||
id(new PHUIListItemView()) | id(new PHUIListItemView()) | ||||
->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
->addSigil('maniphest-edit-task') | ->addSigil('maniphest-edit-task') | ||||
->setHref($href)); | ->setHref($href)); | ||||
} | } | ||||
$field_list = idx($this->customFieldLists, $task->getPHID()); | |||||
if ($field_list) { | |||||
$field_list | |||||
->addFieldsToListViewItem($task, $this->getViewer(), $item); | |||||
} | |||||
$list->addItem($item); | $list->addItem($item); | ||||
} | } | ||||
return $list; | return $list; | ||||
} | } | ||||
// This method should be removed, and all call-sites switch | |||||
// to use ManiphestSearchEngine | |||||
public static function loadTaskHandles( | public static function loadTaskHandles( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
array $tasks) { | array $tasks) { | ||||
assert_instances_of($tasks, 'ManiphestTask'); | assert_instances_of($tasks, 'ManiphestTask'); | ||||
$phids = array(); | $phids = array(); | ||||
foreach ($tasks as $task) { | foreach ($tasks as $task) { | ||||
$assigned_phid = $task->getOwnerPHID(); | $assigned_phid = $task->getOwnerPHID(); | ||||
Show All 19 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0