addChild() public method

Adds a child to the navigation item.
public addChild ( NavigationItem $child )
$child NavigationItem
Exemplo n.º 1
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $media = new NavigationItem('navigation.media');
     $media->setIcon('image');
     if ($this->securityChecker->hasPermission('sulu.media.collections', 'view')) {
         $collections = new DataNavigationItem('navigation.media.collections', '/admin/api/collections?sortBy=title', $media);
         $collections->setId('collections-edit');
         $collections->setAction('media/collections/root');
         $collections->setInstanceName('collections');
         $collections->setDataNameKey('title');
         $collections->setDataResultKey('collections');
         $collections->setShowAddButton(true);
         $collections->setTitleTranslationKey('navigation.media.collections');
         $collections->setNoDataTranslationKey('');
         $collections->setAddButtonTranslationKey('navigation.media.collections.add');
         $collections->setSearchTranslationKey('navigation.media.collections.search');
     }
     if ($media->hasChildren()) {
         $section->addChild($media);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 2
0
 public function __construct(WebspaceManagerInterface $webspaceManager, SecurityCheckerInterface $securityChecker, SessionManagerInterface $sessionManager, $title)
 {
     $this->webspaceManager = $webspaceManager;
     $this->securityChecker = $securityChecker;
     $this->sessionManager = $sessionManager;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.webspaces');
     $section->setPosition(10);
     $rootNavigationItem->addChild($section);
     $position = 10;
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         if ($this->securityChecker->hasPermission(self::SECURITY_CONTEXT_PREFIX . $webspace->getKey(), PermissionTypes::VIEW)) {
             $webspaceItem = new NavigationItem($webspace->getName());
             $webspaceItem->setPosition($position++);
             $webspaceItem->setIcon('bullseye');
             $indexUuid = $this->sessionManager->getContentNode($webspace->getKey())->getIdentifier();
             $indexPageItem = new NavigationItem('navigation.webspaces.index-page');
             $indexPageItem->setPosition(10);
             $indexPageItem->setAction('content/contents/' . $webspace->getKey() . '/edit:' . $indexUuid . '/content');
             $webspaceItem->addChild($indexPageItem);
             $contentItem = new NavigationItem('navigation.webspaces.content');
             $contentItem->setPosition(20);
             $contentItem->setAction('content/contents/' . $webspace->getKey());
             $webspaceItem->addChild($contentItem);
             $webspaceSettingsItem = new NavigationItem('navigation.webspaces.settings');
             $webspaceSettingsItem->setPosition(30);
             $webspaceSettingsItem->setAction(sprintf('content/webspace/settings:%s/general', $webspace->getKey()));
             $webspaceItem->addChild($webspaceSettingsItem);
             $section->addChild($webspaceItem);
         }
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 3
0
 public function __construct(WebspaceManagerInterface $webspaceManager, SecurityCheckerInterface $securityChecker, SessionManagerInterface $sessionManager, $title)
 {
     $this->webspaceManager = $webspaceManager;
     $this->securityChecker = $securityChecker;
     $this->sessionManager = $sessionManager;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.webspaces');
     $rootNavigationItem->addChild($section);
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         if ($this->securityChecker->hasPermission(self::SECURITY_CONTEXT_PREFIX . $webspace->getKey(), 'view')) {
             $webspaceItem = new NavigationItem($webspace->getName());
             $webspaceItem->setIcon('bullseye');
             $indexUuid = $this->sessionManager->getContentNode($webspace->getKey())->getIdentifier();
             $indexPageItem = new NavigationItem('navigation.webspaces.index-page');
             $indexPageItem->setAction('content/contents/' . $webspace->getKey() . '/edit:' . $indexUuid . '/details');
             $webspaceItem->addChild($indexPageItem);
             $contentItem = new NavigationItem('navigation.webspaces.content');
             $contentItem->setAction('content/contents/' . $webspace->getKey());
             $webspaceItem->addChild($contentItem);
             $section->addChild($webspaceItem);
         }
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 4
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.modules');
     $section->setPosition(20);
     $contacts = new NavigationItem('navigation.contacts');
     $contacts->setPosition(30);
     $contacts->setIcon('user');
     if ($this->securityChecker->hasPermission('sulu.contact.people', PermissionTypes::VIEW)) {
         $people = new NavigationItem('navigation.contacts.people');
         $people->setPosition(10);
         $people->setIcon('users');
         $people->setAction('contacts/contacts');
         $contacts->addChild($people);
     }
     if ($this->securityChecker->hasPermission('sulu.contact.organizations', PermissionTypes::VIEW)) {
         $companies = new NavigationItem('navigation.contacts.companies');
         $companies->setPosition(20);
         $companies->setIcon('building');
         $companies->setAction('contacts/accounts');
         $contacts->addChild($companies);
     }
     if ($contacts->hasChildren()) {
         $rootNavigationItem->addChild($section);
         $section->addChild($contacts);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 5
0
 public function __construct($title)
 {
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $rootNavigationItem->addChild($section);
     $search = new NavigationItem('navigation.search');
     $search->setIcon('search');
     $search->setEvent('search');
     $section->addChild($search);
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
 public function __construct($title)
 {
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.webspaces');
     $global = new NavigationItem('navigation.global-content');
     $section->addChild($global);
     $news = new NavigationItem('navigation.news');
     $news->setAction('news');
     $global->addChild($news);
     $rootNavigationItem->addChild($section);
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 7
0
 public function __construct($title)
 {
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $settings = new NavigationItem('navigation.settings');
     $settings->setIcon('gear');
     $roles = new NavigationItem('navigation.settings.cache', $settings);
     $roles->setAction('settings/cache');
     $roles->setIcon('hdd-o');
     $section->addChild($settings);
     $rootNavigationItem->addChild($section);
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 8
0
 /**
  * @param SecurityCheckerInterface $securityChecker
  * @param string                   $title
  */
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     if ($this->securityChecker->hasPermission('sulu.event.events', 'view')) {
         $shop = new NavigationItem('sulu.navigation.events');
         $shop->setIcon('calendar');
         $shop->setAction('events');
         $section->addChild($shop);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 9
0
 public function __construct($title)
 {
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $sales = new NavigationItem('navigation.sales');
     $sales->setIcon('shopping-cart');
     $section->addChild($sales);
     $shipping = new NavigationItem('navigation.sales.shipping');
     $shipping->setAction('sales/shippings');
     $shipping->setPosition(20);
     $sales->addChild($shipping);
     $rootNavigationItem->addChild($section);
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 10
0
 public function __construct($title)
 {
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $settings = new NavigationItem('navigation.settings');
     $settings->setIcon('cogwheels');
     $translate = new NavigationItem('navigation.settings.translate');
     $translate->setAction('settings/translate');
     $translate->setIcon('book-open');
     $settings->addChild($translate);
     $section->addChild($settings);
     $rootNavigationItem->addChild($section);
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 11
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.modules');
     $section->setPosition(20);
     if ($this->securityChecker->hasPermission('sulu.media.collections', PermissionTypes::VIEW)) {
         $media = new NavigationItem('navigation.media');
         $media->setPosition(20);
         $media->setIcon('image');
         $media->setAction('media/collections');
         $section->addChild($media);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 12
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $settings = new NavigationItem('navigation.settings');
     $settings->setIcon('cog');
     if ($this->securityChecker->hasPermission('sulu.settings.categories', 'view')) {
         $categories = new NavigationItem('navigation.settings.categories', $settings);
         $categories->setAction('settings/categories');
     }
     if ($settings->hasChildren()) {
         $section->addChild($settings);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 13
0
 public function __construct(SecurityCheckerInterface $securityChecker, WebspaceManagerInterface $webspaceManager, $defaultEnabled, $title)
 {
     $this->securityChecker = $securityChecker;
     $this->webspaceManager = $webspaceManager;
     $this->defaultEnabled = $defaultEnabled;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.modules');
     $section->setPosition(20);
     if ($this->securityChecker->hasPermission('sulu.global.snippets', 'view')) {
         $snippet = new NavigationItem('navigation.snippets');
         $snippet->setPosition(10);
         $snippet->setIcon('sticky-note-o');
         $snippet->setAction('snippet/snippets');
         $section->addChild($snippet);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 14
0
 public function setUp()
 {
     $this->adminPool = new AdminPool();
     $this->admin1 = $this->getMockForAbstractClass('Sulu\\Bundle\\AdminBundle\\Admin\\Admin', [], '', true, true, true, ['getCommands', 'getSecurityContexts']);
     $this->admin2 = $this->getMockForAbstractClass('Sulu\\Bundle\\AdminBundle\\Admin\\Admin', [], '', true, true, true, ['getCommands', 'getSecurityContexts']);
     $this->command = $this->getMock('Command');
     $this->admin1->expects($this->any())->method('getCommands')->will($this->returnValue([new $this->command()]));
     $this->admin2->expects($this->any())->method('getCommands')->will($this->returnValue([new $this->command()]));
     $this->admin1->expects($this->any())->method('getSecurityContexts')->will($this->returnValue(['Sulu' => ['Assets' => ['assets.videos', 'assets.pictures', 'assets.documents']]]));
     $this->admin2->expects($this->any())->method('getSecurityContexts')->will($this->returnValue(['Sulu' => ['Portal' => ['portals.com', 'portals.de']]]));
     $rootItem1 = new NavigationItem('Root');
     $rootItem1->addChild(new NavigationItem('Child1'));
     $this->admin1->setNavigation(new Navigation($rootItem1));
     $rootItem2 = new NavigationItem('Root');
     $rootItem2->addChild(new NavigationItem('Child2'));
     $this->admin2->setNavigation(new Navigation($rootItem2));
     $this->adminPool->addAdmin($this->admin1);
     $this->adminPool->addAdmin($this->admin2);
 }
Exemplo n.º 15
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $sales = new NavigationItem('navigation.sales');
     $sales->setPosition(20);
     $sales->setIcon('shopping-cart');
     if ($this->securityChecker->hasPermission('sulu.sales_order.orders', 'view')) {
         $order = new NavigationItem('navigation.sales.order', $sales);
         $order->setAction('sales/orders');
         $order->setPosition(10);
     }
     if ($sales->hasChildren()) {
         $section->addChild($sales);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 16
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.webspaces');
     $global = new NavigationItem('navigation.global-content');
     $global->setIcon('globe');
     $section->addChild($global);
     if ($this->securityChecker->hasPermission('sulu.global.snippets', 'view')) {
         $snippet = new NavigationItem('navigation.snippets');
         $snippet->setIcon('bullseye');
         $snippet->setAction('snippet/snippets');
         $global->addChild($snippet);
     }
     if ($global->hasChildren()) {
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 17
0
 public function __construct(WebspaceManagerInterface $webspaceManager, SecurityCheckerInterface $securityChecker, $title)
 {
     $this->webspaceManager = $webspaceManager;
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.modules');
     $section->setPosition(20);
     if ($this->checkLivePermissionForAllWebspaces()) {
         $settings = new NavigationItem('navigation.settings');
         $settings->setPosition(40);
         $settings->setIcon('gear');
         $cache = new NavigationItem('navigation.settings.cache', $settings);
         $cache->setPosition(50);
         $cache->setAction('settings/cache');
         $cache->setIcon('hdd-o');
         $section->addChild($settings);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 18
0
 public function __construct(SecurityCheckerInterface $securityChecker, $title)
 {
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.modules');
     $section->setPosition(20);
     $settings = new NavigationItem('navigation.settings');
     $settings->setPosition(40);
     $settings->setIcon('gear');
     if ($this->securityChecker->hasPermission('sulu.security.roles', PermissionTypes::VIEW)) {
         $roles = new NavigationItem('security.roles.title', $settings);
         $roles->setPosition(10);
         $roles->setAction('settings/roles');
         $roles->setIcon('gear');
     }
     if ($settings->hasChildren()) {
         $section->addChild($settings);
         $rootNavigationItem->addChild($section);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 19
0
 public function __construct(WebspaceManagerInterface $webspaceManager, SecurityCheckerInterface $securityChecker, $title)
 {
     $this->webspaceManager = $webspaceManager;
     $this->securityChecker = $securityChecker;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.webspaces');
     $rootNavigationItem->addChild($section);
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         if ($this->securityChecker->hasPermission($this->securityContextPrefix . $webspace->getKey(), 'view')) {
             $webspaceItem = new NavigationItem($webspace->getName());
             $webspaceItem->setIcon('bullseye');
             $indexPageItem = new NavigationItem('navigation.webspaces.index-page');
             $indexPageItem->setAction('content/contents/' . $webspace->getKey() . '/edit:index/details');
             $webspaceItem->addChild($indexPageItem);
             $contentItem = new NavigationItem('navigation.webspaces.content');
             $contentItem->setAction('content/contents/' . $webspace->getKey());
             $webspaceItem->addChild($contentItem);
             $section->addChild($webspaceItem);
         }
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 20
0
 /**
  * @param SecurityCheckerInterface $securityChecker
  * @param TokenStorageInterface $tokenStorage
  * @param RepositoryInterface $repository
  * @param Router $router
  * @param string $title
  */
 public function __construct(SecurityCheckerInterface $securityChecker, TokenStorageInterface $tokenStorage, RepositoryInterface $repository, Router $router, $title)
 {
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('');
     $files = new NavigationItem('symcloud.file');
     $files->setIcon('folder-open');
     if ($securityChecker->hasPermission('symcloud.files', 'view') && $tokenStorage->getToken() !== null) {
         $session = $repository->loginByHash($tokenStorage->getToken()->getUser(), 'HEAD');
         $references = $session->getReferences();
         foreach ($references as $reference) {
             $referenceItem = new DataNavigationItem($reference->getName(), $router->generate('get_directory', array('reference' => $reference->getHash(), 'name-as-key' => 'true', 'only-directories' => 'true')));
             $referenceItem->setDataResultKey('children');
             $referenceItem->setAction('symcloud/path:' . $reference->getHash());
             $referenceItem->setShowAddButton(false);
             $files->addChild($referenceItem);
         }
     }
     if ($files->hasChildren()) {
         $rootNavigationItem->addChild($section);
         $section->addChild($files);
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
Exemplo n.º 21
0
 public function testChildren()
 {
     $child = new NavigationItem('Child');
     $this->navigationItem->addChild($child);
     $this->assertEquals($child, $this->navigationItem->getChildren()[0]);
 }