本文整理汇总了PHP中PhabricatorApplication::isClassInstalledForViewer方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorApplication::isClassInstalledForViewer方法的具体用法?PHP PhabricatorApplication::isClassInstalledForViewer怎么用?PHP PhabricatorApplication::isClassInstalledForViewer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorApplication
的用法示例。
在下文中一共展示了PhabricatorApplication::isClassInstalledForViewer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$viewer = $this->getViewer();
$conpherence_app = 'PhabricatorConpherenceApplication';
$is_c_installed = PhabricatorApplication::isClassInstalledForViewer($conpherence_app, $viewer);
$raw_message_count_number = null;
$message_count_number = null;
if ($is_c_installed) {
$unread_status = ConpherenceParticipationStatus::BEHIND;
$unread = id(new ConpherenceParticipantCountQuery())->withParticipantPHIDs(array($viewer->getPHID()))->withParticipationStatus($unread_status)->execute();
$raw_message_count_number = idx($unread, $viewer->getPHID(), 0);
$message_count_number = $this->formatNumber($raw_message_count_number);
}
$conpherence_data = array('isInstalled' => $is_c_installed, 'countType' => 'messages', 'count' => $message_count_number, 'rawCount' => $raw_message_count_number);
$this->setConpherenceData($conpherence_data);
$notification_app = 'PhabricatorNotificationsApplication';
$is_n_installed = PhabricatorApplication::isClassInstalledForViewer($notification_app, $viewer);
$notification_count_number = null;
$raw_notification_count_number = null;
if ($is_n_installed) {
$raw_notification_count_number = id(new PhabricatorFeedStoryNotification())->countUnread($viewer);
$notification_count_number = $this->formatNumber($raw_notification_count_number);
}
$notification_data = array('isInstalled' => $is_n_installed, 'countType' => 'notifications', 'count' => $notification_count_number, 'rawCount' => $raw_notification_count_number);
$this->setNotificationData($notification_data);
return array($notification_app => $this->getNotificationData(), $conpherence_app => $this->getConpherenceData());
}
示例2: buildIconNavView
public function buildIconNavView(PhabricatorProject $project)
{
$this->setProject($project);
$viewer = $this->getViewer();
$id = $project->getID();
$picture = $project->getProfileImageURI();
$name = $project->getName();
$columns = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withProjectPHIDs(array($project->getPHID()))->execute();
if ($columns) {
$board_icon = 'fa-columns';
} else {
$board_icon = 'fa-columns grey';
}
$nav = new AphrontSideNavFilterView();
$nav->setIconNav(true);
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$nav->addIcon("profile/{$id}/", $name, null, $picture);
$class = 'PhabricatorManiphestApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$phid = $project->getPHID();
$nav->addIcon("board/{$id}/", pht('Workboard'), $board_icon);
$query_uri = urisprintf('/maniphest/?statuses=open()&projects=%s#R', $phid);
$nav->addIcon(null, pht('Open Tasks'), 'fa-anchor', null, $query_uri);
}
$nav->addIcon("feed/{$id}/", pht('Feed'), 'fa-newspaper-o');
$nav->addIcon("members/{$id}/", pht('Members'), 'fa-group');
$nav->addIcon("details/{$id}/", pht('Edit Details'), 'fa-pencil');
return $nav;
}
示例3: getBuiltinProfilePanels
protected function getBuiltinProfilePanels($object)
{
$viewer = $this->getViewer();
$panels = array();
$panels[] = $this->newPanel()->setBuiltinKey(self::PANEL_PROFILE)->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY);
// TODO: Convert this into a proper panel type.
$have_calendar = PhabricatorApplication::isClassInstalledForViewer('PhabricatorCalendarApplication', $viewer);
if ($have_calendar) {
$uri = urisprintf('/p/%s/calendar/', $object->getUsername());
$panels[] = $this->newPanel()->setBuiltinKey('calendar')->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)->setPanelProperty('icon', 'calendar')->setPanelProperty('name', pht('Calendar'))->setPanelProperty('uri', $uri);
}
$have_maniphest = PhabricatorApplication::isClassInstalledForViewer('PhabricatorManiphestApplication', $viewer);
if ($have_maniphest) {
$uri = urisprintf('/maniphest/?statuses=open()&assigned=%s#R', $object->getPHID());
$panels[] = $this->newPanel()->setBuiltinKey('tasks')->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)->setPanelProperty('icon', 'maniphest')->setPanelProperty('name', pht('Open Tasks'))->setPanelProperty('uri', $uri);
}
$have_differential = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDifferentialApplication', $viewer);
if ($have_differential) {
$uri = urisprintf('/differential/?authors=%s#R', $object->getPHID());
$panels[] = $this->newPanel()->setBuiltinKey('revisions')->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)->setPanelProperty('icon', 'differential')->setPanelProperty('name', pht('Revisions'))->setPanelProperty('uri', $uri);
}
$have_diffusion = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDiffusionApplication', $viewer);
if ($have_diffusion) {
$uri = urisprintf('/audit/?authors=%s#R', $object->getPHID());
$panels[] = $this->newPanel()->setBuiltinKey('commits')->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)->setPanelProperty('icon', 'diffusion')->setPanelProperty('name', pht('Commits'))->setPanelProperty('uri', $uri);
}
$panels[] = $this->newPanel()->setBuiltinKey(self::PANEL_MANAGE)->setPanelKey(PhabricatorPeopleManageProfilePanel::PANELKEY);
return $panels;
}
示例4: buildIconNavView
public function buildIconNavView(PhabricatorUser $user)
{
$viewer = $this->getViewer();
$picture = $user->getProfileImageURI();
$name = $user->getUsername();
$nav = new AphrontSideNavFilterView();
$nav->setIconNav(true);
$nav->setBaseURI(new PhutilURI('/p/'));
$nav->addIcon("{$name}/", $name, null, $picture);
$class = 'PhabricatorCalendarApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$nav->addIcon("{$name}/calendar/", pht('Calendar'), 'fa-calendar');
}
$class = 'PhabricatorManiphestApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$phid = $user->getPHID();
$view_uri = sprintf('/maniphest/?statuses=open()&assigned=%s#R', $phid);
$nav->addIcon('maniphest', pht('Open Tasks'), 'fa-anchor', null, $view_uri);
}
$class = 'PhabricatorDifferentialApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$username = phutil_escape_uri($name);
$view_uri = '/differential/?authors=' . $username;
$nav->addIcon('differential', pht('Revisions'), 'fa-cog', null, $view_uri);
}
$class = 'PhabricatorAuditApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$username = phutil_escape_uri($name);
$view_uri = '/audit/?authors=' . $username;
$nav->addIcon('audit', pht('Commits'), 'fa-code', null, $view_uri);
}
return $nav;
}
示例5: buildMainResponse
private function buildMainResponse()
{
require_celerity_resource('phabricator-dashboard-css');
$viewer = $this->getViewer();
$has_maniphest = PhabricatorApplication::isClassInstalledForViewer('PhabricatorManiphestApplication', $viewer);
$has_diffusion = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDiffusionApplication', $viewer);
$has_differential = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDifferentialApplication', $viewer);
$revision_panel = null;
if ($has_differential) {
$revision_panel = $this->buildRevisionPanel();
}
$tasks_panel = null;
if ($has_maniphest) {
$tasks_panel = $this->buildTasksPanel();
}
$repository_panel = null;
if ($has_diffusion) {
$repository_panel = $this->buildRepositoryPanel();
}
$feed_panel = $this->buildFeedPanel();
$dashboard = id(new AphrontMultiColumnView())->setFluidlayout(true)->setGutter(AphrontMultiColumnView::GUTTER_LARGE);
$main_panel = phutil_tag('div', array('class' => 'homepage-panel'), array($revision_panel, $tasks_panel, $repository_panel));
$dashboard->addColumn($main_panel, 'thirds');
$side_panel = phutil_tag('div', array('class' => 'homepage-side-panel'), array($feed_panel));
$dashboard->addColumn($side_panel, 'third');
$view = id(new PHUIBoxView())->addClass('dashboard-view')->appendChild($dashboard);
return $view;
}
示例6: execute
public function execute()
{
$viewer = $this->getViewer();
$conpherence_app = 'PhabricatorConpherenceApplication';
$is_c_installed = PhabricatorApplication::isClassInstalledForViewer($conpherence_app, $viewer);
if ($is_c_installed) {
$raw_message_count_number = $viewer->getUnreadMessageCount();
$message_count_number = $this->formatNumber($raw_message_count_number);
} else {
$raw_message_count_number = null;
$message_count_number = null;
}
$conpherence_data = array('isInstalled' => $is_c_installed, 'countType' => 'messages', 'count' => $message_count_number, 'rawCount' => $raw_message_count_number);
$this->setConpherenceData($conpherence_data);
$notification_app = 'PhabricatorNotificationsApplication';
$is_n_installed = PhabricatorApplication::isClassInstalledForViewer($notification_app, $viewer);
if ($is_n_installed) {
$raw_notification_count_number = $viewer->getUnreadNotificationCount();
$notification_count_number = $this->formatNumber($raw_notification_count_number);
} else {
$notification_count_number = null;
$raw_notification_count_number = null;
}
$notification_data = array('isInstalled' => $is_n_installed, 'countType' => 'notifications', 'count' => $notification_count_number, 'rawCount' => $raw_notification_count_number);
$this->setNotificationData($notification_data);
return array($notification_app => $this->getNotificationData(), $conpherence_app => $this->getConpherenceData());
}
示例7: buildMainResponse
private function buildMainResponse(array $projects)
{
assert_instances_of($projects, 'PhabricatorProject');
$viewer = $this->getRequest()->getUser();
$has_maniphest = PhabricatorApplication::isClassInstalledForViewer('PhabricatorManiphestApplication', $viewer);
$has_audit = PhabricatorApplication::isClassInstalledForViewer('PhabricatorAuditApplication', $viewer);
$has_differential = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDifferentialApplication', $viewer);
if ($has_maniphest) {
$unbreak_panel = $this->buildUnbreakNowPanel();
$triage_panel = $this->buildNeedsTriagePanel($projects);
$tasks_panel = $this->buildTasksPanel();
} else {
$unbreak_panel = null;
$triage_panel = null;
$tasks_panel = null;
}
if ($has_audit) {
$audit_panel = $this->buildAuditPanel();
$commit_panel = $this->buildCommitPanel();
} else {
$audit_panel = null;
$commit_panel = null;
}
if (PhabricatorEnv::getEnvConfig('welcome.html') !== null) {
$welcome_panel = $this->buildWelcomePanel();
} else {
$welcome_panel = null;
}
if ($has_differential) {
$revision_panel = $this->buildRevisionPanel();
} else {
$revision_panel = null;
}
return array($welcome_panel, $unbreak_panel, $triage_panel, $revision_panel, $tasks_panel, $audit_panel, $commit_panel, $this->minipanels);
}
示例8: isEnabledForObject
public function isEnabledForObject($object)
{
$viewer = $this->getViewer();
$has_app = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDifferentialApplication', $viewer);
if (!$has_app) {
return false;
}
return $object instanceof DifferentialRevision;
}
示例9: isEnabledForObject
public function isEnabledForObject($object)
{
$viewer = $this->getViewer();
$has_app = PhabricatorApplication::isClassInstalledForViewer('PhabricatorManiphestApplication', $viewer);
if (!$has_app) {
return false;
}
return $object instanceof ManiphestTask;
}
示例10: isEnabledForObject
public function isEnabledForObject($object)
{
$viewer = $this->getViewer();
$has_app = PhabricatorApplication::isClassInstalledForViewer('PhabricatorDiffusionApplication', $viewer);
if (!$has_app) {
return false;
}
return $object instanceof PhabricatorRepositoryCommit;
}
示例11: shouldEnableForObject
public function shouldEnableForObject($object)
{
$viewer = $this->getViewer();
// Workboards are only available if Maniphest is installed.
$class = 'PhabricatorManiphestApplication';
if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
return false;
}
return true;
}
示例12: processRequest
public function processRequest()
{
$viewer = $this->getRequest()->getUser();
$user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($this->username))->needProfileImage(true)->needAvailability(true)->executeOne();
if (!$user) {
return new Aphront404Response();
}
require_celerity_resource('phabricator-profile-css');
$profile = $user->loadUserProfile();
$username = phutil_escape_uri($user->getUserName());
$picture = $user->getProfileImageURI();
$header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader($profile->getTitle())->setImage($picture);
$actions = id(new PhabricatorActionListView())->setObject($user)->setObjectURI($this->getRequest()->getRequestURI())->setUser($viewer);
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Profile'))->setHref($this->getApplicationURI('editprofile/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-picture-o')->setName(pht('Edit Profile Picture'))->setHref($this->getApplicationURI('picture/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
if ($viewer->getIsAdmin()) {
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-wrench')->setName(pht('Edit Settings'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref('/settings/' . $user->getID() . '/'));
if ($user->getIsAdmin()) {
$empower_icon = 'fa-arrow-circle-o-down';
$empower_name = pht('Remove Administrator');
} else {
$empower_icon = 'fa-arrow-circle-o-up';
$empower_name = pht('Make Administrator');
}
$actions->addAction(id(new PhabricatorActionView())->setIcon($empower_icon)->setName($empower_name)->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('empower/' . $user->getID() . '/')));
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-tag')->setName(pht('Change Username'))->setWorkflow(true)->setHref($this->getApplicationURI('rename/' . $user->getID() . '/')));
if ($user->getIsDisabled()) {
$disable_icon = 'fa-check-circle-o';
$disable_name = pht('Enable User');
} else {
$disable_icon = 'fa-ban';
$disable_name = pht('Disable User');
}
$actions->addAction(id(new PhabricatorActionView())->setIcon($disable_icon)->setName($disable_name)->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('disable/' . $user->getID() . '/')));
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-times')->setName(pht('Delete User'))->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('delete/' . $user->getID() . '/')));
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-envelope')->setName(pht('Send Welcome Email'))->setWorkflow(true)->setHref($this->getApplicationURI('welcome/' . $user->getID() . '/')));
}
$properties = $this->buildPropertyView($user, $actions);
$name = $user->getUsername();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($name);
$class = 'PhabricatorConpherenceApplication';
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$href = '/conpherence/new/?participant=' . $user->getPHID();
$image = id(new PHUIIconView())->setIconFont('fa-comments');
$button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::SIMPLE)->setIcon($image)->setHref($href)->setText(pht('Send Message'))->setWorkflow(true);
$header->addActionLink($button);
}
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$nav = $this->buildIconNavView($user);
$nav->selectFilter("{$name}/");
$nav->appendChild($object_box);
return $this->buildApplicationPage($nav, array('title' => $user->getUsername()));
}
示例13: buildBadges
private function buildBadges(PhabricatorUser $user, $viewer)
{
$class = 'PhabricatorBadgesApplication';
$items = array();
if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
$badge_phids = $user->getBadgePHIDs();
if ($badge_phids) {
$badges = id(new PhabricatorBadgesQuery())->setViewer($viewer)->withPHIDs($badge_phids)->execute();
foreach ($badges as $badge) {
$items[] = id(new PHUIBadgeMiniView())->setIcon($badge->getIcon())->setHeader($badge->getName())->setQuality($badge->getQuality());
}
}
}
return $items;
}
示例14: newNavigationMenuItems
protected function newNavigationMenuItems(PhabricatorProfilePanelConfiguration $config)
{
$viewer = $this->getViewer();
// Workboards are only available if Maniphest is installed.
$class = 'PhabricatorManiphestApplication';
if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
return array();
}
$project = $config->getProfileObject();
$has_workboard = $project->getHasWorkboard();
$id = $project->getID();
$href = "/project/board/{$id}/";
$name = $this->getDisplayName($config);
$item = $this->newItem()->setHref($href)->setName($name)->setDisabled(!$has_workboard)->setIcon('fa-columns');
return array($item);
}
示例15: processRequest
public function processRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
// TODO: It would be nice to simply disable this panel, but we can't do
// viewer-based checks for enabled panels right now.
$app_class = 'PhabricatorOAuthServerApplication';
$installed = PhabricatorApplication::isClassInstalledForViewer($app_class, $viewer);
if (!$installed) {
$dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('OAuth Not Available'))->appendParagraph(pht('You do not have access to OAuth authorizations.'))->addCancelButton('/settings/');
return id(new AphrontDialogResponse())->setDialog($dialog);
}
$authorizations = id(new PhabricatorOAuthClientAuthorizationQuery())->setViewer($viewer)->withUserPHIDs(array($viewer->getPHID()))->execute();
$authorizations = mpull($authorizations, null, 'getID');
$panel_uri = $this->getPanelURI();
$revoke = $request->getInt('revoke');
if ($revoke) {
if (empty($authorizations[$revoke])) {
return new Aphront404Response();
}
if ($request->isFormPost()) {
$authorizations[$revoke]->delete();
return id(new AphrontRedirectResponse())->setURI($panel_uri);
}
$dialog = id(new AphrontDialogView())->setUser($viewer)->setTitle(pht('Revoke Authorization?'))->appendParagraph(pht('This application will no longer be able to access Phabricator ' . 'on your behalf.'))->addSubmitButton(pht('Revoke Authorization'))->addCancelButton($panel_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
$highlight = $request->getInt('id');
$rows = array();
$rowc = array();
foreach ($authorizations as $authorization) {
if ($highlight == $authorization->getID()) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
$button = javelin_tag('a', array('href' => $this->getPanelURI('?revoke=' . $authorization->getID()), 'class' => 'small grey button', 'sigil' => 'workflow'), pht('Revoke'));
$rows[] = array(phutil_tag('a', array('href' => $authorization->getClient()->getViewURI()), $authorization->getClient()->getName()), $authorization->getScopeString(), phabricator_datetime($authorization->getDateCreated(), $viewer), phabricator_datetime($authorization->getDateModified(), $viewer), $button);
}
$table = new AphrontTableView($rows);
$table->setNoDataString(pht("You haven't authorized any OAuth applications."));
$table->setRowClasses($rowc);
$table->setHeaders(array(pht('Application'), pht('Scope'), pht('Created'), pht('Updated'), null));
$table->setColumnClasses(array('pri', 'wide', 'right', 'right', 'action'));
$header = id(new PHUIHeaderView())->setHeader(pht('OAuth Application Authorizations'));
$panel = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($table);
return $panel;
}