@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 76 lines 1.6 kB view raw
1<?php 2 3final class SlowvotePollStatus 4 extends Phobject { 5 6 const STATUS_OPEN = 'open'; 7 const STATUS_CLOSED = 'closed'; 8 9 private $key; 10 11 public static function newStatusObject($key) { 12 $object = new self(); 13 $object->key = $key; 14 return $object; 15 } 16 17 public function getKey() { 18 return $this->key; 19 } 20 21 public static function getAll() { 22 $map = self::getMap(); 23 24 $result = array(); 25 foreach ($map as $key => $spec) { 26 $result[$key] = self::newStatusObject($key); 27 } 28 29 return $result; 30 } 31 32 public function getName() { 33 $name = $this->getProperty('name'); 34 35 if ($name === null) { 36 $name = pht('Unknown ("%s")', $this->getKey()); 37 } 38 39 return $name; 40 } 41 42 public function getHeaderTagIcon() { 43 return $this->getProperty('header.tag.icon'); 44 } 45 46 public function getHeaderTagColor() { 47 return $this->getProperty('header.tag.color'); 48 } 49 50 public function getTransactionIcon() { 51 return $this->getProperty('transaction.icon'); 52 } 53 54 private function getProperty($key, $default = null) { 55 $spec = idx(self::getMap(), $this->getKey(), array()); 56 return idx($spec, $key, $default); 57 } 58 59 private static function getMap() { 60 return array( 61 self::STATUS_OPEN => array( 62 'name' => pht('Open'), 63 'header.tag.icon' => 'fa-square-o', 64 'header.tag.color' => 'bluegrey', 65 'transaction.icon' => 'fa-pencil', 66 ), 67 self::STATUS_CLOSED => array( 68 'name' => pht('Closed'), 69 'header.tag.icon' => 'fa-ban', 70 'header.tag.color' => 'indigo', 71 'transaction.icon' => 'fa-ban', 72 ), 73 ); 74 } 75 76}