protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $user = $config->getProfileObject();
     $id = $user->getID();
     $item = $this->newItem()->setHref("/people/manage/{$id}/")->setName($this->getDisplayName($config))->setIcon('fa-gears');
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $user = $config->getProfileObject();
     $picture = $user->getProfileImageURI();
     $name = $user->getUsername();
     $href = urisprintf('/p/%s/', $user->getUsername());
     $item = $this->newItem()->setHref($href)->setName($name)->setProfileImage($picture);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $project = $config->getProfileObject();
     $id = $project->getID();
     $picture = $project->getProfileImageURI();
     $name = $project->getName();
     $href = "/project/profile/{$id}/";
     $item = $this->newItem()->setHref($href)->setName($name)->setProfileImage($picture);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $project = $config->getProfileObject();
     $id = $project->getID();
     $name = $this->getDisplayName($config);
     $icon = 'fa-group';
     $href = "/project/members/{$id}/";
     $item = id(new PHUIListItemView())->setRenderNameAsTooltip(true)->setType(PHUIListItemView::TYPE_ICON_NAV)->setHref($href)->setName($name)->setIcon($icon);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $project = $config->getProfileObject();
     $id = $project->getID();
     $name = $this->getDisplayName($config);
     $icon = 'fa-group';
     $href = "/project/members/{$id}/";
     $item = $this->newItem()->setHref($href)->setName($name)->setIcon($icon);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $project = $config->getProfileObject();
     $id = $project->getID();
     $picture = $project->getProfileImageURI();
     $name = $project->getName();
     $href = "/project/profile/{$id}/";
     $item = id(new PHUIListItemView())->setRenderNameAsTooltip(true)->setType(PHUIListItemView::TYPE_ICON_NAV)->setHref($href)->setName($name)->setProfileImage($picture);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $project = $config->getProfileObject();
     $has_workboard = $project->getHasWorkboard();
     $id = $project->getID();
     $href = "/project/board/{$id}/";
     $name = $this->getDisplayName($config);
     $item = $this->newItem()->setHref($href)->setName($name)->setDisabled(!$has_workboard)->setIcon('fa-columns');
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $project = $config->getProfileObject();
     $has_children = $project->getHasSubprojects() || $project->getHasMilestones();
     $id = $project->getID();
     $name = $this->getDisplayName($config);
     $icon = 'fa-sitemap';
     $href = "/project/subprojects/{$id}/";
     $item = $this->newItem()->setHref($href)->setName($name)->setDisabled(!$has_children)->setIcon($icon);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $viewer = $this->getViewer();
     // Workboards are only available if Maniphest is installed.
     $class = 'PhabricatorManiphestApplication';
     if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         return array();
     }
     $project = $config->getProfileObject();
     $has_workboard = $project->getHasWorkboard();
     $id = $project->getID();
     $href = "/project/board/{$id}/";
     $name = $this->getDisplayName($config);
     $item = $this->newItem()->setHref($href)->setName($name)->setDisabled(!$has_workboard)->setIcon('fa-columns');
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $source = $config->getPanelProperty('source');
     switch ($source) {
         case 'catfacts':
         default:
             $facts = $this->getCatFacts();
             break;
     }
     $fact = $this->selectFact($facts);
     switch ($source) {
         case 'catfacts':
         default:
             $fact = array(id(new PHUIIconView())->setIconFont('fa-paw'), ' ', $fact);
             break;
     }
     $fact = phutil_tag('div', array('class' => 'phui-motivator'), $fact);
     $item = $this->newItem()->appendChild($fact);
     return array($item);
 }
 protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
 {
     $viewer = $this->getViewer();
     // Workboards are only available if Maniphest is installed.
     $class = 'PhabricatorManiphestApplication';
     if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         return array();
     }
     $project = $config->getProfileObject();
     $columns = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withProjectPHIDs(array($project->getPHID()))->execute();
     if ($columns) {
         $icon = 'fa-columns';
     } else {
         $icon = 'fa-columns grey';
     }
     $id = $project->getID();
     $href = "/project/board/{$id}/";
     $name = $this->getDisplayName($config);
     $item = id(new PHUIListItemView())->setRenderNameAsTooltip(true)->setType(PHUIListItemView::TYPE_ICON_NAV)->setHref($href)->setName($name)->setIcon($icon);
     return array($item);
 }
 protected function newPanel()
 {
     return PhabricatorProfilePanelConfiguration::initializeNewBuiltin();
 }
 private function getLinkURI(PhabricatorProfilePanelConfiguration $config)
 {
     return $config->getPanelProperty('uri');
 }
 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);
 }
 private function buildPanelHideContent(PhabricatorProfilePanelConfiguration $configuration)
 {
     $controller = $this->getController();
     $request = $controller->getRequest();
     $viewer = $this->getViewer();
     PhabricatorPolicyFilter::requireCapability($viewer, $configuration, PhabricatorPolicyCapability::CAN_EDIT);
     $v_visibility = $configuration->getVisibility();
     if ($request->isFormPost()) {
         $v_visibility = $request->getStr('visibility');
         $type_visibility = PhabricatorProfilePanelConfigurationTransaction::TYPE_VISIBILITY;
         $xactions = array();
         $xactions[] = id(new PhabricatorProfilePanelConfigurationTransaction())->setTransactionType($type_visibility)->setNewValue($v_visibility);
         $editor = id(new PhabricatorProfilePanelEditor())->setContentSourceFromRequest($request)->setActor($viewer)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true)->applyTransactions($configuration, $xactions);
         return id(new AphrontRedirectResponse())->setURI($this->getConfigureURI());
     }
     $map = PhabricatorProfilePanelConfiguration::getVisibilityNameMap();
     $form = id(new AphrontFormView())->setUser($viewer)->appendControl(id(new AphrontFormSelectControl())->setName('visibility')->setLabel(pht('Visibility'))->setValue($v_visibility)->setOptions($map));
     return $controller->newDialog()->setTitle(pht('Change Item Visibility'))->appendForm($form)->addCancelButton($this->getConfigureURI())->addSubmitButton(pht('Save Changes'));
 }
Esempio n. 16
0
 public function getBuiltinProfilePanels()
 {
     $panels = array();
     $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin()->setBuiltinKey(self::PANEL_PROFILE)->setPanelKey(PhabricatorProjectDetailsProfilePanel::PANELKEY);
     $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin()->setBuiltinKey(self::PANEL_WORKBOARD)->setPanelKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY);
     // TODO: This is temporary.
     $uri = urisprintf('/maniphest/?statuses=open()&projects=%s#R', $this->getPHID());
     $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin()->setBuiltinKey('tasks')->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)->setPanelProperty('icon', 'maniphest')->setPanelProperty('name', pht('Open Tasks'))->setPanelProperty('uri', $uri);
     // TODO: This is temporary.
     $id = $this->getID();
     $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin()->setBuiltinKey('feed')->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)->setPanelProperty('icon', 'feed')->setPanelProperty('name', pht('Feed'))->setPanelProperty('uri', "/project/feed/{$id}/");
     $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin()->setBuiltinKey(self::PANEL_MEMBERS)->setPanelKey(PhabricatorProjectMembersProfilePanel::PANELKEY);
     return $panels;
 }