3 final class PhabricatorProjectColumnStatusOrder
4 extends PhabricatorProjectColumnOrder
{
6 const ORDERKEY
= 'status';
8 public function getDisplayName() {
9 return pht('Group by Status');
12 protected function newMenuIconIcon() {
16 public function getHasHeaders() {
20 public function getCanReorder() {
24 public function getMenuOrder() {
28 protected function newHeaderKeyForObject($object) {
29 return $this->newHeaderKeyForStatus($object->getStatus());
32 private function newHeaderKeyForStatus($status) {
33 return sprintf('status(%s)', $status);
36 protected function newSortVectorsForObjects(array $objects) {
37 $status_sequence = $this->newStatusSequence();
40 foreach ($objects as $object_key => $object) {
41 $vectors[$object_key] = array(
42 (int)idx($status_sequence, $object->getStatus(), 0),
49 private function newStatusSequence() {
50 $statuses = ManiphestTaskStatus
::getTaskStatusMap();
52 array_keys($statuses),
53 range(1, count($statuses)));
56 protected function newHeadersForObjects(array $objects) {
59 $statuses = ManiphestTaskStatus
::getTaskStatusMap();
60 $sequence = $this->newStatusSequence();
62 foreach ($statuses as $status_key => $status_name) {
63 $header_key = $this->newHeaderKeyForStatus($status_key);
66 (int)idx($sequence, $status_key, 0),
69 $status_icon = ManiphestTaskStatus
::getStatusIcon($status_key);
70 $status_color = ManiphestTaskStatus
::getStatusColor($status_key);
72 $icon_view = id(new PHUIIconView())
73 ->setIcon($status_icon, $status_color);
75 $drop_effect = $this->newEffect()
76 ->setIcon($status_icon)
77 ->setColor($status_color)
78 ->addCondition('status', '!=', $status_key)
81 'Change status to %s.',
82 phutil_tag('strong', array(), $status_name)));
84 $header = $this->newHeader()
85 ->setHeaderKey($header_key)
86 ->setSortVector($sort_vector)
87 ->setName($status_name)
91 'value' => $status_key,
93 ->addDropEffect($drop_effect);
101 protected function newColumnTransactions($object, array $header) {
102 $new_status = idx($header, 'value');
104 if ($object->getStatus() === $new_status) {
109 $xactions[] = $this->newTransaction($object)
110 ->setTransactionType(ManiphestTaskStatusTransaction
::TRANSACTIONTYPE
)
111 ->setNewValue($new_status);