Differential D15544 Diff 37499 src/applications/people/controller/PhabricatorPeopleProfileViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/controller/PhabricatorPeopleProfileViewController.php
Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | if (count($badges)) { | ||||
$error = id(new PHUIBoxView()) | $error = id(new PHUIBoxView()) | ||||
->addClass('mlb') | ->addClass('mlb') | ||||
->appendChild(pht('User does not have any badges.')); | ->appendChild(pht('User does not have any badges.')); | ||||
$flex = id(new PHUIInfoView()) | $flex = id(new PHUIInfoView()) | ||||
->setSeverity(PHUIInfoView::SEVERITY_NODATA) | ->setSeverity(PHUIInfoView::SEVERITY_NODATA) | ||||
->appendChild($error); | ->appendChild($error); | ||||
} | } | ||||
// Best option? | |||||
$badges = id(new PhabricatorBadgesQuery()) | |||||
->setViewer($viewer) | |||||
->withStatuses(array( | |||||
PhabricatorBadgesBadge::STATUS_ACTIVE, | |||||
)) | |||||
->requireCapabilities( | |||||
array( | |||||
PhabricatorPolicyCapability::CAN_VIEW, | |||||
PhabricatorPolicyCapability::CAN_EDIT, | |||||
)) | |||||
->execute(); | |||||
$button = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setIcon('fa-plus') | |||||
->setText(pht('Award')) | |||||
->setWorkflow(true) | |||||
->setHref('/badges/award/'.$user->getID().'/'); | |||||
$can_award = false; | |||||
if (count($badges)) { | |||||
$can_award = true; | |||||
} | |||||
$header = id(new PHUIHeaderView()) | |||||
->setHeader(pht('Badges')); | |||||
if (count($badges)) { | |||||
$header->addActionLink($button); | |||||
} | |||||
$box = id(new PHUIObjectBoxView()) | $box = id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('Badges')) | ->setHeader($header) | ||||
->addClass('project-view-badges') | ->addClass('project-view-badges') | ||||
->appendChild($flex) | ->appendChild($flex) | ||||
->setBackground(PHUIObjectBoxView::GREY); | ->setBackground(PHUIObjectBoxView::GREY); | ||||
return $box; | return $box; | ||||
} | } | ||||
private function buildPeopleFeed( | private function buildPeopleFeed( | ||||
Show All 24 Lines |