当前位置: 首页>>代码示例>>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;未经允许,请勿转载。