本文整理汇总了PHP中PhabricatorProject::isUserAncestorWatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorProject::isUserAncestorWatcher方法的具体用法?PHP PhabricatorProject::isUserAncestorWatcher怎么用?PHP PhabricatorProject::isUserAncestorWatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorProject
的用法示例。
在下文中一共展示了PhabricatorProject::isUserAncestorWatcher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}