当前位置: 首页>>代码示例>>PHP>>正文


PHP ManiphestTaskStatus::getStatusColor方法代码示例

本文整理汇总了PHP中ManiphestTaskStatus::getStatusColor方法的典型用法代码示例。如果您正苦于以下问题:PHP ManiphestTaskStatus::getStatusColor方法的具体用法?PHP ManiphestTaskStatus::getStatusColor怎么用?PHP ManiphestTaskStatus::getStatusColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ManiphestTaskStatus的用法示例。


在下文中一共展示了ManiphestTaskStatus::getStatusColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: newNavigationMenuItems

 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $viewer = $this->getViewer();
     $project = $config->getProfileObject();
     $limit = 250;
     $tasks = id(new ManiphestTaskQuery())->setViewer($viewer)->withEdgeLogicPHIDs(PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, PhabricatorQueryConstraint::OPERATOR_AND, array($project->getPHID()))->setLimit($limit + 1)->execute();
     if (count($tasks) > $limit) {
         return $this->renderError(pht('Too many tasks to compute statistics for (more than %s).', new PhutilNumber($limit)));
     }
     if (!$tasks) {
         return $this->renderError(pht('This milestone has no tasks yet.'));
     }
     $statuses = array();
     $points_done = 0;
     $points_total = 0;
     $no_points = 0;
     foreach ($tasks as $task) {
         $points = $task->getPoints();
         if ($points === null) {
             $no_points++;
             continue;
         }
         if (!$points) {
             continue;
         }
         $status = $task->getStatus();
         if (empty($statuses[$status])) {
             $statuses[$status] = 0;
         }
         $statuses[$status] += $points;
         if (ManiphestTaskStatus::isClosedStatus($status)) {
             $points_done += $points;
         }
         $points_total += $points;
     }
     if ($no_points == count($tasks)) {
         return $this->renderError(pht('No tasks have assigned point values.'));
     }
     if (!$points_total) {
         return $this->renderError(pht('All tasks with assigned point values are worth zero points.'));
     }
     $label = pht('%s of %s %s', new PhutilNumber($points_done), new PhutilNumber($points_total), ManiphestTaskPoints::getPointsLabel());
     $bar = id(new PHUISegmentBarView())->setLabel($label);
     $map = ManiphestTaskStatus::getTaskStatusMap();
     $statuses = array_select_keys($statuses, array_keys($map));
     foreach ($statuses as $status => $points) {
         if (!$points) {
             continue;
         }
         if (!ManiphestTaskStatus::isClosedStatus($status)) {
             continue;
         }
         $color = ManiphestTaskStatus::getStatusColor($status);
         if (!$color) {
             $color = 'sky';
         }
         $tooltip = pht('%s %s', new PhutilNumber($points), ManiphestTaskStatus::getTaskStatusName($status));
         $bar->newSegment()->setWidth($points / $points_total)->setColor($color)->setTooltip($tooltip);
     }
     $bar = phutil_tag('div', array('class' => 'phui-profile-segment-bar'), $bar);
     $item = $this->newItem()->appendChild($bar);
     return array($item);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:63,代码来源:PhabricatorProjectPointsProfilePanel.php

示例2: getColor

 public function getColor()
 {
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_OWNER:
             if ($this->getAuthorPHID() == $new) {
                 return 'green';
             } else {
                 if (!$new) {
                     return 'black';
                 } else {
                     if (!$old) {
                         return 'green';
                     } else {
                         return 'green';
                     }
                 }
             }
         case self::TYPE_STATUS:
             $color = ManiphestTaskStatus::getStatusColor($new);
             if ($color !== null) {
                 return $color;
             }
             if (ManiphestTaskStatus::isOpenStatus($new)) {
                 return 'green';
             } else {
                 return 'black';
             }
         case self::TYPE_PRIORITY:
             if ($old == ManiphestTaskPriority::getDefaultPriority()) {
                 return 'green';
             } else {
                 if ($old > $new) {
                     return 'grey';
                 } else {
                     return 'yellow';
                 }
             }
     }
     return parent::getColor();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:42,代码来源:ManiphestTransaction.php

示例3: getFieldValuesForConduit

 public function getFieldValuesForConduit()
 {
     $status_value = $this->getStatus();
     $status_info = array('value' => $status_value, 'name' => ManiphestTaskStatus::getTaskStatusName($status_value), 'color' => ManiphestTaskStatus::getStatusColor($status_value));
     $priority_value = (int) $this->getPriority();
     $priority_info = array('value' => $priority_value, 'subpriority' => (double) $this->getSubpriority(), 'name' => ManiphestTaskPriority::getTaskPriorityName($priority_value), 'color' => ManiphestTaskPriority::getTaskPriorityColor($priority_value));
     return array('name' => $this->getTitle(), 'authorPHID' => $this->getAuthorPHID(), 'ownerPHID' => $this->getOwnerPHID(), 'status' => $status_info, 'priority' => $priority_info);
 }
开发者ID:phpengineer,项目名称:phabricator,代码行数:8,代码来源:ManiphestTask.php


注:本文中的ManiphestTaskStatus::getStatusColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。