當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhabricatorProject::getIsMembershipLocked方法代碼示例

本文整理匯總了PHP中PhabricatorProject::getIsMembershipLocked方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorProject::getIsMembershipLocked方法的具體用法?PHP PhabricatorProject::getIsMembershipLocked怎麽用?PHP PhabricatorProject::getIsMembershipLocked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhabricatorProject的用法示例。


在下文中一共展示了PhabricatorProject::getIsMembershipLocked方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: userCannotLeave

 /**
  * This is enforced in @{class:PhabricatorProjectTransactionEditor}. We use
  * this logic to render a better form for users hitting this case.
  */
 private function userCannotLeave(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     return $project->getIsMembershipLocked() && !PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
 }
開發者ID:patelhardik,項目名稱:phabricator,代碼行數:9,代碼來源:PhabricatorProjectUpdateController.php

示例2: buildActions

 private function buildActions(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     $id = $project->getID();
     $view = id(new PhabricatorActionListView())->setUser($viewer);
     $is_locked = $project->getIsMembershipLocked();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
     $supports_edit = $project->supportsEditMembers();
     $can_join = $supports_edit && PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_JOIN);
     $can_leave = $supports_edit && (!$is_locked || $can_edit);
     $viewer_phid = $viewer->getPHID();
     if (!$project->isUserMember($viewer_phid)) {
         $view->addAction(id(new PhabricatorActionView())->setHref('/project/update/' . $project->getID() . '/join/')->setIcon('fa-plus')->setDisabled(!$can_join)->setWorkflow(true)->setName(pht('Join Project')));
     } else {
         $view->addAction(id(new PhabricatorActionView())->setHref('/project/update/' . $project->getID() . '/leave/')->setIcon('fa-times')->setDisabled(!$can_leave)->setWorkflow(true)->setName(pht('Leave Project')));
     }
     if (!$project->isUserWatcher($viewer->getPHID())) {
         $view->addAction(id(new PhabricatorActionView())->setWorkflow(true)->setHref('/project/watch/' . $project->getID() . '/')->setIcon('fa-eye')->setName(pht('Watch Project')));
     } else {
         $view->addAction(id(new PhabricatorActionView())->setWorkflow(true)->setHref('/project/unwatch/' . $project->getID() . '/')->setIcon('fa-eye-slash')->setName(pht('Unwatch Project')));
     }
     $can_silence = $project->isUserMember($viewer_phid);
     $is_silenced = $this->isProjectSilenced($project);
     if ($is_silenced) {
         $silence_text = pht('Enable Mail');
     } else {
         $silence_text = pht('Disable Mail');
     }
     $view->addAction(id(new PhabricatorActionView())->setName($silence_text)->setIcon('fa-envelope-o')->setHref("/project/silence/{$id}/")->setWorkflow(true)->setDisabled(!$can_silence));
     $can_add = $can_edit && $supports_edit;
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Add Members'))->setIcon('fa-user-plus')->setHref("/project/members/{$id}/add/")->setWorkflow(true)->setDisabled(!$can_add));
     $can_lock = $can_edit && $supports_edit && $this->hasApplicationCapability(ProjectCanLockProjectsCapability::CAPABILITY);
     if ($is_locked) {
         $lock_name = pht('Unlock Project');
         $lock_icon = 'fa-unlock';
     } else {
         $lock_name = pht('Lock Project');
         $lock_icon = 'fa-lock';
     }
     $view->addAction(id(new PhabricatorActionView())->setName($lock_name)->setIcon($lock_icon)->setHref($this->getApplicationURI("lock/{$id}/"))->setDisabled(!$can_lock)->setWorkflow(true));
     return $view;
 }
開發者ID:truSense,項目名稱:phabricator,代碼行數:42,代碼來源:PhabricatorProjectMembersViewController.php


注:本文中的PhabricatorProject::getIsMembershipLocked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。