本文整理汇总了PHP中PhabricatorApplication::getApplicationGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorApplication::getApplicationGroups方法的具体用法?PHP PhabricatorApplication::getApplicationGroups怎么用?PHP PhabricatorApplication::getApplicationGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorApplication
的用法示例。
在下文中一共展示了PhabricatorApplication::getApplicationGroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$applications = PhabricatorApplication::getAllInstalledApplications();
foreach ($applications as $key => $application) {
if (!$application->shouldAppearInLaunchView()) {
unset($applications[$key]);
}
}
$groups = PhabricatorApplication::getApplicationGroups();
$applications = msort($applications, 'getApplicationOrder');
$applications = mgroup($applications, 'getApplicationGroup');
$applications = array_select_keys($applications, array_keys($groups));
$view = array();
foreach ($applications as $group => $application_list) {
$status = array();
foreach ($application_list as $key => $application) {
$status[$key] = $application->loadStatus($user);
}
$views = array();
foreach ($application_list as $key => $application) {
$views[] = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus(idx($status, $key, array()))->setUser($user);
}
$view[] = id(new PhabricatorHeaderView())->setHeader($groups[$group]);
$view[] = phutil_render_tag('div', array('class' => 'phabricator-application-list'), id(new AphrontNullView())->appendChild($views)->render());
}
return $this->buildApplicationPage($view, array('title' => 'Applications', 'device' => true));
}
示例2: renderResultList
protected function renderResultList(array $all_applications, PhabricatorSavedQuery $query, array $handle)
{
assert_instances_of($all_applications, 'PhabricatorApplication');
$all_applications = msort($all_applications, 'getName');
if ($query->getQueryKey() == 'launcher') {
$groups = mgroup($all_applications, 'getApplicationGroup');
} else {
$groups = array($all_applications);
}
$group_names = PhabricatorApplication::getApplicationGroups();
$groups = array_select_keys($groups, array_keys($group_names)) + $groups;
$results = array();
foreach ($groups as $group => $applications) {
if (count($groups) > 1) {
$results[] = phutil_tag('h1', array('class' => 'launcher-header'), idx($group_names, $group, $group));
}
$list = new PHUIObjectItemListView();
$list->addClass('phui-object-item-launcher-list');
foreach ($applications as $application) {
$icon = $application->getIconName();
if (!$icon) {
$icon = 'application';
}
// TODO: This sheet doesn't work the same way other sheets do so it
// ends up with the wrong classes if we try to use PHUIIconView. This
// is probably all changing in the redesign anyway.
$icon_view = javelin_tag('span', array('class' => 'phui-icon-view ' . 'sprite-apps-large apps-' . $icon . '-dark-large', 'aural' => false), '');
$description = phutil_tag('div', array('style' => 'white-space: nowrap; ' . 'overflow: hidden; ' . 'text-overflow: ellipsis;'), $application->getShortDescription());
$item = id(new PHUIObjectItemView())->setHeader($application->getName())->setImageIcon($icon_view)->addAttribute($description)->addAction(id(new PHUIListItemView())->setName(pht('Help/Options'))->setIcon('fa-cog')->setHref('/applications/view/' . get_class($application) . '/'));
if ($application->getBaseURI()) {
$item->setHref($application->getBaseURI());
}
if (!$application->isInstalled()) {
$item->addIcon('fa-times', pht('Uninstalled'));
}
if ($application->isBeta()) {
$item->addIcon('fa-star-half-o grey', pht('Beta'));
}
if (!$application->isFirstParty()) {
$item->addIcon('fa-puzzle-piece', pht('Extension'));
}
$list->addItem($item);
}
$results[] = $list;
}
return $results;
}
示例3: renderResultList
protected function renderResultList(array $all_applications, PhabricatorSavedQuery $query, array $handle)
{
assert_instances_of($all_applications, 'PhabricatorApplication');
$all_applications = msort($all_applications, 'getName');
if ($query->getQueryKey() == 'launcher') {
$groups = mgroup($all_applications, 'getApplicationGroup');
} else {
$groups = array($all_applications);
}
$group_names = PhabricatorApplication::getApplicationGroups();
$groups = array_select_keys($groups, array_keys($group_names)) + $groups;
$results = array();
foreach ($groups as $group => $applications) {
if (count($groups) > 1) {
$results[] = phutil_tag('h1', array('class' => 'phui-object-item-list-header'), idx($group_names, $group, $group));
}
$list = new PHUIObjectItemListView();
foreach ($applications as $application) {
$icon = $application->getFontIcon();
if (!$icon) {
$icon = 'application';
}
// TODO: This sheet doesn't work the same way other sheets do so it
// ends up with the wrong classes if we try to use PHUIIconView. This
// is probably all changing in the redesign anyway.
$icon_view = javelin_tag('span', array('class' => 'phui-icon-view phui-font-fa ' . $icon, 'aural' => false), '');
$description = $application->getShortDescription();
$configure = id(new PHUIButtonView())->setTag('a')->setHref('/applications/view/' . get_class($application) . '/')->setText(pht('Configure'))->setColor(PHUIButtonView::GREY);
$name = $application->getName();
if ($application->isPrototype()) {
$name = $name . ' ' . pht('(Prototype)');
}
$item = id(new PHUIObjectItemView())->setHeader($name)->setImageIcon($icon_view)->setSubhead($description)->setLaunchButton($configure);
if ($application->getBaseURI() && $application->isInstalled()) {
$item->setHref($application->getBaseURI());
}
if (!$application->isInstalled()) {
$item->addAttribute(pht('Uninstalled'));
$item->setDisabled(true);
}
if (!$application->isFirstParty()) {
$item->addAttribute(pht('Extension'));
}
$list->addItem($item);
}
$results[] = $list;
}
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($results);
return $result;
}
示例4: renderResultList
protected function renderResultList(array $all_applications, PhabricatorSavedQuery $query, array $handle)
{
assert_instances_of($all_applications, 'PhabricatorApplication');
$all_applications = msort($all_applications, 'getName');
if ($query->getQueryKey() == 'launcher') {
$groups = mgroup($all_applications, 'getApplicationGroup');
} else {
$groups = array($all_applications);
}
$group_names = PhabricatorApplication::getApplicationGroups();
$groups = array_select_keys($groups, array_keys($group_names)) + $groups;
$results = array();
foreach ($groups as $group => $applications) {
if (count($groups) > 1) {
$results[] = phutil_tag('h1', array('class' => 'phui-object-item-list-header'), idx($group_names, $group, $group));
}
$list = new PHUIObjectItemListView();
foreach ($applications as $application) {
$icon = $application->getIcon();
if (!$icon) {
$icon = 'application';
}
$description = $application->getShortDescription();
$configure = id(new PHUIButtonView())->setTag('a')->setHref('/applications/view/' . get_class($application) . '/')->setText(pht('Configure'))->setColor(PHUIButtonView::GREY);
$name = $application->getName();
if ($application->isPrototype()) {
$name = $name . ' ' . pht('(Prototype)');
}
$item = id(new PHUIObjectItemView())->setHeader($name)->setImageIcon($icon)->setSubhead($description)->setLaunchButton($configure);
if ($application->getBaseURI() && $application->isInstalled()) {
$item->setHref($application->getBaseURI());
}
if (!$application->isInstalled()) {
$item->addAttribute(pht('Uninstalled'));
$item->setDisabled(true);
}
if (!$application->isFirstParty()) {
$item->addAttribute(pht('Extension'));
}
$list->addItem($item);
}
$results[] = $list;
}
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($results);
return $result;
}