本文整理汇总了PHP中PhabricatorPolicyQuery::renderPolicyDescriptions方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorPolicyQuery::renderPolicyDescriptions方法的具体用法?PHP PhabricatorPolicyQuery::renderPolicyDescriptions怎么用?PHP PhabricatorPolicyQuery::renderPolicyDescriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorPolicyQuery
的用法示例。
在下文中一共展示了PhabricatorPolicyQuery::renderPolicyDescriptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPropertyView
private function buildPropertyView(PhabricatorApplication $application, PhabricatorActionListView $actions)
{
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView());
$properties->setActionList($actions);
$properties->addProperty(pht('Description'), $application->getShortDescription());
if ($application->getFlavorText()) {
$properties->addProperty(null, phutil_tag('em', array(), $application->getFlavorText()));
}
if ($application->isPrototype()) {
$proto_href = PhabricatorEnv::getDoclink('User Guide: Prototype Applications');
$learn_more = phutil_tag('a', array('href' => $proto_href, 'target' => '_blank'), pht('Learn More'));
$properties->addProperty(pht('Prototype'), pht('This application is a prototype. %s', $learn_more));
}
$overview = $application->getOverview();
if (strlen($overview)) {
$overview = new PHUIRemarkupView($viewer, $overview);
$properties->addSectionHeader(pht('Overview'), PHUIPropertyListView::ICON_SUMMARY);
$properties->addTextContent($overview);
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $application);
$properties->addSectionHeader(pht('Policies'), 'fa-lock');
foreach ($application->getCapabilities() as $capability) {
$properties->addProperty($application->getCapabilityLabel($capability), idx($descriptions, $capability));
}
return $properties;
}
示例2: buildPropertyView
private function buildPropertyView(PhameBlog $blog)
{
$viewer = $this->getViewer();
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($blog);
$domain = $blog->getDomain();
if (!$domain) {
$domain = phutil_tag('em', array(), pht('No external domain'));
}
$properties->addProperty(pht('Domain'), $domain);
$feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
$properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $blog);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
$properties->invokeWillRenderEvent();
$description = $blog->getDescription();
if (strlen($description)) {
$description = new PHUIRemarkupView($viewer, $description);
$properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$properties->addTextContent($description);
}
return $properties;
}
示例3: buildProperties
private function buildProperties(PhabricatorProject $project)
{
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())->setUser($viewer)->setObject($project);
if ($project->isMilestone()) {
$icon_key = PhabricatorProjectIconSet::getMilestoneIconKey();
$icon = PhabricatorProjectIconSet::getIconIcon($icon_key);
$target = PhabricatorProjectIconSet::getIconName($icon_key);
$note = pht('Members of the parent project are members of this project.');
$show_join = false;
} else {
if ($project->getHasSubprojects()) {
$icon = 'fa-sitemap';
$target = pht('Parent Project');
$note = pht('Members of all subprojects are members of this project.');
$show_join = false;
} else {
if ($project->getIsMembershipLocked()) {
$icon = 'fa-lock';
$target = pht('Locked Project');
$note = pht('Users with access may join this project, but may not leave.');
$show_join = true;
} else {
$icon = 'fa-briefcase';
$target = pht('Normal Project');
$note = pht('Users with access may join and leave this project.');
$show_join = true;
}
}
}
$item = id(new PHUIStatusItemView())->setIcon($icon)->setTarget(phutil_tag('strong', array(), $target))->setNote($note);
$status = id(new PHUIStatusListView())->addItem($item);
$view->addProperty(pht('Membership'), $status);
if ($show_join) {
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $project);
$view->addProperty(pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
}
$viewer_phid = $viewer->getPHID();
if ($project->isUserWatcher($viewer_phid)) {
$watch_item = id(new PHUIStatusItemView())->setIcon('fa-eye green')->setTarget(phutil_tag('strong', array(), pht('Watching')))->setNote(pht('You will receive mail about changes made to any related ' . 'object.'));
$watch_status = id(new PHUIStatusListView())->addItem($watch_item);
$view->addProperty(pht('Watching'), $watch_status);
}
if ($project->isUserMember($viewer_phid)) {
$is_silenced = $this->isProjectSilenced($project);
if ($is_silenced) {
$mail_icon = 'fa-envelope-o grey';
$mail_target = pht('Disabled');
$mail_note = pht('When mail is sent to project members, you will not receive ' . 'a copy.');
} else {
$mail_icon = 'fa-envelope-o green';
$mail_target = pht('Enabled');
$mail_note = pht('You will receive mail that is sent to project members.');
}
$mail_item = id(new PHUIStatusItemView())->setIcon($mail_icon)->setTarget(phutil_tag('strong', array(), $mail_target))->setNote($mail_note);
$mail_status = id(new PHUIStatusListView())->addItem($mail_item);
$view->addProperty(pht('Mail to Members'), $mail_status);
}
return $view;
}
示例4: buildPropertyList
private function buildPropertyList(DivinerLiveBook $book)
{
$viewer = $this->getRequest()->getUser();
$view = id(new PHUIPropertyListView())->setUser($viewer);
$policies = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $book);
$view->addProperty(pht('Updated'), phabricator_datetime($book->getDateModified(), $viewer));
return $view;
}
示例5: buildPropertyView
private function buildPropertyView(PhabricatorDashboard $dashboard)
{
$viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView())->setUser($viewer);
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $dashboard);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$properties->addProperty(pht('Panels'), $viewer->renderHandleList($dashboard->getPanelPHIDs()));
return id(new PHUIObjectBoxView())->setHeaderText(pht('Details'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->addPropertyList($properties);
}
示例6: buildPropertyView
private function buildPropertyView(PhabricatorDashboard $dashboard)
{
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($dashboard);
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $dashboard);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$properties->addProperty(pht('Panels'), $viewer->renderHandleList($dashboard->getPanelPHIDs()));
return $properties;
}
示例7: buildPropertyView
private function buildPropertyView(NuanceSource $source, PhabricatorActionListView $actions)
{
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($source)->setActionList($actions);
$definition = $source->requireDefinition();
$properties->addProperty(pht('Source Type'), $definition->getName());
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $source);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
return $properties;
}
示例8: buildPropertyView
private function buildPropertyView(PhabricatorProjectColumn $column, PhabricatorActionListView $actions)
{
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($column)->setActionList($actions);
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $column);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$limit = $column->getPointLimit();
$properties->addProperty(pht('Point Limit'), $limit ? $limit : pht('No Limit'));
return $properties;
}
示例9: buildPolicyView
private function buildPolicyView(PhabricatorApplication $application)
{
$viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView());
$header = id(new PHUIHeaderView())->setHeader(pht('POLICIES'))->setHeaderIcon('fa-lock');
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $application);
foreach ($application->getCapabilities() as $capability) {
$properties->addProperty($application->getCapabilityLabel($capability), idx($descriptions, $capability));
}
return id(new PHUIObjectBoxView())->setHeader($header)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->appendChild($properties);
}
示例10: buildPropertyListView
private function buildPropertyListView(PhabricatorProject $project, PhabricatorActionListView $actions)
{
$request = $this->getRequest();
$viewer = $request->getUser();
$view = id(new PHUIPropertyListView())->setUser($viewer)->setObject($project)->setActionList($actions);
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $project);
$this->loadHandles(array($project->getPHID()));
$view->addProperty(pht('Looks Like'), $this->getHandle($project->getPHID())->renderTag());
$view->addProperty(pht('Visible To'), $descriptions[PhabricatorPolicyCapability::CAN_VIEW]);
$view->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$view->addProperty(pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
return $view;
}
示例11: buildPropertyView
private function buildPropertyView(PhabricatorPaste $paste, array $child_phids, PhabricatorActionListView $actions)
{
$viewer = $this->getViewer();
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($paste)->setActionList($actions);
$properties->addProperty(pht('Author'), $viewer->renderHandle($paste->getAuthorPHID()));
$properties->addProperty(pht('Created'), phabricator_datetime($paste->getDateCreated(), $viewer));
if ($paste->getParentPHID()) {
$properties->addProperty(pht('Forked From'), $viewer->renderHandle($paste->getParentPHID()));
}
if ($child_phids) {
$properties->addProperty(pht('Forks'), $viewer->renderHandleList($child_phids));
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $paste);
return $properties;
}
示例12: buildPropertyListView
private function buildPropertyListView(PhabricatorSpacesNamespace $space)
{
$viewer = $this->getRequest()->getUser();
$list = id(new PHUIPropertyListView())->setUser($viewer);
$list->addProperty(pht('Default Space'), $space->getIsDefaultNamespace() ? pht('Yes') : pht('No'));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $space);
$list->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$description = $space->getDescription();
if (strlen($description)) {
$description = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($description), 'default', $viewer);
$list->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$list->addTextContent($description);
}
return $list;
}
示例13: buildPropertyView
private function buildPropertyView(PhabricatorPaste $paste, array $child_phids)
{
$user = $this->getRequest()->getUser();
$properties = new PhabricatorPropertyListView();
$properties->addProperty(pht('Author'), $this->getHandle($paste->getAuthorPHID())->renderLink());
$properties->addProperty(pht('Created'), phabricator_datetime($paste->getDateCreated(), $user));
if ($paste->getParentPHID()) {
$properties->addProperty(pht('Forked From'), $this->getHandle($paste->getParentPHID())->renderLink());
}
if ($child_phids) {
$properties->addProperty(pht('Forks'), $this->renderHandlesForPHIDs($child_phids));
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($user, $paste);
$properties->addProperty(pht('Visible To'), $descriptions[PhabricatorPolicyCapability::CAN_VIEW]);
return $properties;
}
示例14: renderProperties
private function renderProperties(PhameBlog $blog, PhabricatorUser $user, PhabricatorActionListView $actions)
{
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
$properties = new PHUIPropertyListView();
$properties->setActionList($actions);
$properties->addProperty(pht('Skin'), $blog->getSkin());
$properties->addProperty(pht('Domain'), $blog->getDomain());
$feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
$properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($user, $blog);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$properties->addProperty(pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
$engine = id(new PhabricatorMarkupEngine())->setViewer($user)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
$properties->addTextContent(phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)));
return $properties;
}
示例15: buildManagementPanelContent
public function buildManagementPanelContent()
{
$repository = $this->getRepository();
$viewer = $this->getViewer();
$view = id(new PHUIPropertyListView())->setViewer($viewer)->setActionList($this->newActions());
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $repository);
$view_parts = array();
if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
$space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID($repository);
$view_parts[] = $viewer->renderHandle($space_phid);
}
$view_parts[] = $descriptions[PhabricatorPolicyCapability::CAN_VIEW];
$view->addProperty(pht('Visible To'), phutil_implode_html(" · ", $view_parts));
$view->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$pushable = $repository->isHosted() ? $descriptions[DiffusionPushCapability::CAPABILITY] : phutil_tag('em', array(), pht('Not a Hosted Repository'));
$view->addProperty(pht('Pushable By'), $pushable);
return $this->newBox(pht('Policies'), $view);
}