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


PHP PhabricatorProject::isUserWatcher方法代碼示例

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


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

示例1: renderWatchAction

 private function renderWatchAction(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     $id = $project->getID();
     if (!$viewer->isLoggedIn()) {
         $is_watcher = false;
         $is_ancestor = false;
     } else {
         $viewer_phid = $viewer->getPHID();
         $is_watcher = $project->isUserWatcher($viewer_phid);
         $is_ancestor = $project->isUserAncestorWatcher($viewer_phid);
     }
     if ($is_ancestor && !$is_watcher) {
         $watch_icon = 'fa-eye';
         $watch_text = pht('Watching Ancestor');
         $watch_href = "/project/watch/{$id}/?via=profile";
         $watch_disabled = true;
     } else {
         if (!$is_watcher) {
             $watch_icon = 'fa-eye';
             $watch_text = pht('Watch Project');
             $watch_href = "/project/watch/{$id}/?via=profile";
             $watch_disabled = false;
         } else {
             $watch_icon = 'fa-eye-slash';
             $watch_text = pht('Unwatch Project');
             $watch_href = "/project/unwatch/{$id}/?via=profile";
             $watch_disabled = false;
         }
     }
     $watch_icon = id(new PHUIIconView())->setIcon($watch_icon);
     return id(new PHUIButtonView())->setTag('a')->setWorkflow(true)->setIcon($watch_icon)->setText($watch_text)->setHref($watch_href)->setDisabled($watch_disabled);
 }
開發者ID:psyclone241,項目名稱:phabricator,代碼行數:33,代碼來源:PhabricatorProjectProfileController.php

示例2: renderWatchAction

 private function renderWatchAction(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     $viewer_phid = $viewer->getPHID();
     $id = $project->getID();
     $is_watcher = $viewer_phid && $project->isUserWatcher($viewer_phid);
     if (!$is_watcher) {
         $watch_icon = 'fa-eye';
         $watch_text = pht('Watch Project');
         $watch_href = "/project/watch/{$id}/?via=profile";
     } else {
         $watch_icon = 'fa-eye-slash';
         $watch_text = pht('Unwatch Project');
         $watch_href = "/project/unwatch/{$id}/?via=profile";
     }
     $watch_icon = id(new PHUIIconView())->setIcon($watch_icon);
     return id(new PHUIButtonView())->setTag('a')->setWorkflow(true)->setIcon($watch_icon)->setText($watch_text)->setHref($watch_href);
 }
開發者ID:fairyeye,項目名稱:phabricator,代碼行數:18,代碼來源:PhabricatorProjectProfileController.php


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