本文整理匯總了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);
}