本文整理汇总了PHP中AphrontSideNavFilterView::addCustomBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontSideNavFilterView::addCustomBlock方法的具体用法?PHP AphrontSideNavFilterView::addCustomBlock怎么用?PHP AphrontSideNavFilterView::addCustomBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontSideNavFilterView
的用法示例。
在下文中一共展示了AphrontSideNavFilterView::addCustomBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildNav
public function buildNav()
{
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/'));
$applications = id(new PhabricatorApplicationQuery())->setViewer($user)->withInstalled(true)->withUnlisted(false)->withLaunchable(true)->execute();
$pinned = $user->loadPreferences()->getPinnedApplications($applications, $user);
// Force "Applications" to appear at the bottom.
$meta_app = 'PhabricatorApplicationsApplication';
$pinned = array_fuse($pinned);
unset($pinned[$meta_app]);
$pinned[$meta_app] = $meta_app;
$applications[$meta_app] = PhabricatorApplication::getByClass($meta_app);
$tiles = array();
$home_app = new PhabricatorHomeApplication();
$tiles[] = id(new PhabricatorApplicationLaunchView())->setApplication($home_app)->setApplicationStatus($home_app->loadStatus($user))->addClass('phabricator-application-launch-phone-only')->setUser($user);
foreach ($pinned as $pinned_application) {
if (empty($applications[$pinned_application])) {
continue;
}
$application = $applications[$pinned_application];
$tile = id(new PhabricatorApplicationLaunchView())->setApplication($application)->setApplicationStatus($application->loadStatus($user))->setUser($user);
$tiles[] = $tile;
}
$nav->addCustomBlock(phutil_tag('div', array('class' => 'application-tile-group'), $tiles));
$nav->addFilter('', pht('Customize Applications...'), '/settings/panel/home/');
$nav->addClass('phabricator-side-menu-home');
$nav->selectFilter(null);
return $nav;
}
示例2: build
public function build(array $changesets)
{
assert_instances_of($changesets, 'DifferentialChangeset');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI($this->getBaseURI());
$nav->setFlexible(true);
$nav->setCollapsed($this->collapsed);
$anchor = $this->getAnchorName();
$tree = new PhutilFileTree();
foreach ($changesets as $changeset) {
try {
$tree->addPath($changeset->getFilename(), $changeset);
} catch (Exception $ex) {
// TODO: See T1702. When viewing the versus diff of diffs, we may
// have files with the same filename. For example, if you have a setup
// like this in SVN:
//
// a/
// README
// b/
// README
//
// ...and you run "arc diff" once from a/, and again from b/, you'll
// get two diffs with path README. However, in the versus diff view we
// will compute their absolute repository paths and detect that they
// aren't really the same file. This is correct, but causes us to
// throw when inserting them.
//
// We should probably compute the smallest unique path for each file
// and show these as "a/README" and "b/README" when diffed against
// one another. However, we get this wrong in a lot of places (the
// other TOC shows two "README" files, and we generate the same anchor
// hash for both) so I'm just stopping the bleeding until we can get
// a proper fix in place.
}
}
require_celerity_resource('phabricator-filetree-view-css');
$filetree = array();
$path = $tree;
while ($path = $path->getNextNode()) {
$data = $path->getData();
$name = $path->getName();
$style = 'padding-left: ' . (2 + 3 * $path->getDepth()) . 'px';
$href = null;
if ($data) {
$href = '#' . $data->getAnchorName();
$title = $name;
$icon = id(new PHUIIconView())->setIconFont('fa-file-text-o bluetext');
} else {
$name .= '/';
$title = $path->getFullPath() . '/';
$icon = id(new PHUIIconView())->setIconFont('fa-folder-open blue');
}
$name_element = phutil_tag('span', array('class' => 'phabricator-filetree-name'), $name);
$filetree[] = javelin_tag($href ? 'a' : 'span', array('href' => $href, 'style' => $style, 'title' => $title, 'class' => 'phabricator-filetree-item'), array($icon, $name_element));
}
$tree->destroy();
$filetree = phutil_tag('div', array('class' => 'phabricator-filetree'), $filetree);
Javelin::initBehavior('phabricator-file-tree', array());
$nav->addLabel(pht('Changed Files'));
$nav->addCustomBlock($filetree);
$nav->setActive(true);
$nav->selectFilter(null);
return $nav;
}
示例3: buildSideNavView
private function buildSideNavView(DifferentialRevision $revision, array $changesets)
{
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/D' . $revision->getID()));
$nav->setFlexible(true);
$nav->addFilter('top', 'D' . $revision->getID(), '#top', $relative = false, 'phabricator-active-nav-focus');
$tree = new PhutilFileTree();
foreach ($changesets as $changeset) {
$tree->addPath($changeset->getFilename(), $changeset);
}
require_celerity_resource('phabricator-filetree-view-css');
$filetree = array();
$path = $tree;
while ($path = $path->getNextNode()) {
$data = $path->getData();
$name = $path->getName();
$style = 'padding-left: ' . (2 + 3 * $path->getDepth()) . 'px';
$href = null;
if ($data) {
$href = '#' . $data->getAnchorName();
$icon = 'phabricator-filetree-icon-file';
} else {
$name .= '/';
$icon = 'phabricator-filetree-icon-dir';
}
$icon = phutil_render_tag('span', array('class' => 'phabricator-filetree-icon ' . $icon), '');
$name_element = phutil_render_tag('span', array('class' => 'phabricator-filetree-name'), phutil_escape_html($name));
$filetree[] = javelin_render_tag($href ? 'a' : 'span', array('href' => $href, 'style' => $style, 'title' => $name, 'class' => 'phabricator-filetree-item'), $icon . $name_element);
}
$tree->destroy();
$filetree = '<div class="phabricator-filetree">' . implode("\n", $filetree) . '</div>';
$nav->addFilter('toc', 'Table of Contents', '#toc');
$nav->addCustomBlock($filetree);
$nav->addFilter('comment', 'Add Comment', '#comment');
$nav->setActive(true);
return $nav;
}
示例4: buildSideNavView
private function buildSideNavView(DifferentialRevision $revision, array $changesets)
{
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/D' . $revision->getID()));
$nav->setFlexible(true);
$nav->addFilter('top', 'D' . $revision->getID(), '#top', $relative = false, 'phabricator-active-nav-focus');
$tree = new PhutilFileTree();
foreach ($changesets as $changeset) {
try {
$tree->addPath($changeset->getFilename(), $changeset);
} catch (Exception $ex) {
// TODO: See T1702. When viewing the versus diff of diffs, we may
// have files with the same filename. For example, if you have a setup
// like this in SVN:
//
// a/
// README
// b/
// README
//
// ...and you run "arc diff" once from a/, and again from b/, you'll
// get two diffs with path README. However, in the versus diff view we
// will compute their absolute repository paths and detect that they
// aren't really the same file. This is correct, but causes us to
// throw when inserting them.
//
// We should probably compute the smallest unique path for each file
// and show these as "a/README" and "b/README" when diffed against
// one another. However, we get this wrong in a lot of places (the
// other TOC shows two "README" files, and we generate the same anchor
// hash for both) so I'm just stopping the bleeding until we can get
// a proper fix in place.
}
}
require_celerity_resource('phabricator-filetree-view-css');
$filetree = array();
$path = $tree;
while ($path = $path->getNextNode()) {
$data = $path->getData();
$name = $path->getName();
$style = 'padding-left: ' . (2 + 3 * $path->getDepth()) . 'px';
$href = null;
if ($data) {
$href = '#' . $data->getAnchorName();
$title = $name;
$icon = 'phabricator-filetree-icon-file';
} else {
$name .= '/';
$title = $path->getFullPath() . '/';
$icon = 'phabricator-filetree-icon-dir';
}
$icon = phutil_render_tag('span', array('class' => 'phabricator-filetree-icon ' . $icon), '');
$name_element = phutil_render_tag('span', array('class' => 'phabricator-filetree-name'), phutil_escape_html($name));
$filetree[] = javelin_render_tag($href ? 'a' : 'span', array('href' => $href, 'style' => $style, 'title' => $title, 'class' => 'phabricator-filetree-item'), $icon . $name_element);
}
$tree->destroy();
$filetree = '<div class="phabricator-filetree">' . implode("\n", $filetree) . '</div>';
$nav->addFilter('toc', 'Table of Contents', '#toc');
$nav->addCustomBlock($filetree);
$nav->addFilter('comment', 'Add Comment', '#comment');
$nav->setActive(true);
return $nav;
}