Path: blob/master/src/applications/differential/constants/DifferentialConstantsModule.php
12256 views
<?php12final class DifferentialConstantsModule3extends PhabricatorConfigModule {45public function getModuleKey() {6return 'constants.differential';7}89public function getModuleName() {10return pht('Constants: Differential');11}1213public function renderModuleStatus(AphrontRequest $request) {14$viewer = $request->getViewer();1516return array(17$this->renderRevisionStatuses($viewer),18$this->renderUnitStatuses($viewer),19$this->renderLintStatuses($viewer),20);21}2223private function renderRevisionStatuses(PhabricatorUser $viewer) {24$statuses = DifferentialRevisionStatus::getAll();2526$rows = array();27foreach ($statuses as $status) {28$icon = id(new PHUIIconView())29->setIcon(30$status->getIcon(),31$status->getIconColor());3233$timeline_icon = $status->getTimelineIcon();34if ($timeline_icon !== null) {35$timeline_view = id(new PHUIIconView())36->setIcon(37$status->getTimelineIcon(),38$status->getTimelineColor());39} else {40$timeline_view = null;41}4243if ($status->isClosedStatus()) {44$is_open = pht('Closed');45} else {46$is_open = pht('Open');47}4849$tag_color = $status->getTagColor();50if ($tag_color !== null) {51$tag_view = id(new PHUIIconView())52->seticon('fa-tag', $tag_color);53} else {54$tag_view = null;55}5657$ansi_color = $status->getAnsiColor();58if ($ansi_color !== null) {59$web_color = PHUIColor::getWebColorFromANSIColor($ansi_color);60$ansi_view = id(new PHUIIconView())61->setIcon('fa-stop', $web_color);62} else {63$ansi_view = null;64}656667$rows[] = array(68$status->getKey(),69$status->getLegacyKey(),70$icon,71$timeline_view,72$tag_view,73$ansi_view,74$is_open,75$status->getDisplayName(),76);77}7879$table = id(new AphrontTableView($rows))80->setHeaders(81array(82pht('Value'),83pht('Legacy Value'),84pht('Icon'),85pht('Timeline Icon'),86pht('Tag Color'),87pht('ANSI Color'),88pht('Open/Closed'),89pht('Name'),90))91->setColumnClasses(92array(93null,94null,95null,96null,97null,98null,99null,100'wide pri',101));102103$view = id(new PHUIObjectBoxView())104->setHeaderText(pht('Differential Revision Statuses'))105->setTable($table);106107return $view;108}109110private function renderUnitStatuses(PhabricatorUser $viewer) {111$statuses = DifferentialUnitStatus::getStatusMap();112113$rows = array();114foreach ($statuses as $status) {115$rows[] = array(116$status->getValue(),117id(new PHUIIconView())118->setIcon($status->getIconIcon(), $status->getIconColor()),119$status->getName(),120);121}122123$table = id(new AphrontTableView($rows))124->setHeaders(125array(126pht('Value'),127pht('Icon'),128pht('Name'),129))130->setColumnClasses(131array(132null,133null,134'wide pri',135));136137$view = id(new PHUIObjectBoxView())138->setHeaderText(pht('Differential Unit Statuses'))139->setTable($table);140141return $view;142}143144private function renderLintStatuses(PhabricatorUser $viewer) {145$statuses = DifferentialLintStatus::getStatusMap();146147$rows = array();148foreach ($statuses as $status) {149$rows[] = array(150$status->getValue(),151id(new PHUIIconView())152->setIcon($status->getIconIcon(), $status->getIconColor()),153$status->getName(),154);155}156157$table = id(new AphrontTableView($rows))158->setHeaders(159array(160pht('Value'),161pht('Icon'),162pht('Name'),163))164->setColumnClasses(165array(166null,167null,168'wide pri',169));170171$view = id(new PHUIObjectBoxView())172->setHeaderText(pht('Differential Lint Statuses'))173->setTable($table);174175return $view;176}177178179}180181182