Beispiel #1
0
 public function fabMenu(FactoryInterface $factory)
 {
     /**
      * @var Journal $journal
      * @var AuthorizationChecker $checker
      */
     $dispatcher = $this->container->get('event_dispatcher');
     $checker = $this->container->get('security.authorization_checker');
     $menu = $factory->createItem('root')->setChildrenAttribute('class', 'dropdown-menu dropdown-menu-right');
     $menu->addChild('dashboard', ['route' => 'dashboard', 'attributes' => array('data-toggle' => 'tooltip', 'data-placement' => 'left'), 'extras' => ['icon' => 'dashboard']]);
     $journal = $this->container->get('ojs.journal_service')->getSelectedJournal();
     if ($journal) {
         $journalId = $journal->getId();
         if ($checker->isGranted('CREATE', $journal, 'articles')) {
             $menu->addChild('article.submit', ['route' => 'ojs_journal_submission_new', 'routeParameters' => ['journalId' => $journalId], 'attributes' => array('data-toggle' => 'tooltip', 'data-placement' => 'left'), 'extras' => ['icon' => 'file-text']]);
         }
         if ($checker->isGranted('EDIT', $journal, 'userRole')) {
             $menu->addChild('title.users', ['route' => 'ojs_journal_user_index', 'routeParameters' => ['journalId' => $journalId], 'attributes' => array('data-toggle' => 'tooltip', 'data-placement' => 'left'), 'extras' => ['icon' => 'key']]);
         }
         if ($checker->isGranted('EDIT', $journal, 'issues')) {
             $menu->addChild('title.issues', ['route' => 'ojs_journal_issue_index', 'routeParameters' => ['journalId' => $journalId], 'attributes' => array('data-toggle' => 'tooltip', 'data-placement' => 'left'), 'extras' => ['icon' => 'plug']]);
         }
         if ($checker->isGranted('VIEW', $journal, 'articles')) {
             $menu->addChild('articles', ['route' => 'ojs_journal_submission_me', 'routeParameters' => ['journalId' => $journalId], 'attributes' => array('data-toggle' => 'tooltip', 'data-placement' => 'left'), 'extras' => ['icon' => 'file-o']]);
         }
     }
     $menuEvent = new MenuEvent();
     $menuEvent->setMenuItem($menu);
     $dispatcher->dispatch(MenuEvents::FAB_MENU_INITIALIZED, $menuEvent);
     return $menuEvent->getMenuItem();
 }
Beispiel #2
0
 public function footerMenu(FactoryInterface $factory, array $options)
 {
     $menuOptions = array_merge($options, ['childrenAttributes' => ['class' => 'dark-main-color  nav navbar-nav navbar-center', 'id' => 'footer-nav']]);
     $menu = $factory->createItem('footer', $menuOptions);
     $this->addSharedItemsToMenu($menu, $this->sharedMenuItems);
     return $menu;
 }
 /**
  * Build menu.
  *
  * @param  string        $alias
  * @param  array         $options
  * @return ItemInterface
  */
 public function get($alias, array $options = [])
 {
     $this->assertAlias($alias);
     if (!array_key_exists($alias, $this->menus)) {
         if ($this->cache && $this->cache->contains($alias)) {
             $menuData = $this->cache->fetch($alias);
             $this->menus[$alias] = $this->factory->createFromArray($menuData);
         } else {
             $menu = $this->factory->createItem($alias);
             /** @var BuilderInterface $builder */
             // try to find builder for the specified menu alias
             if (array_key_exists($alias, $this->builders)) {
                 foreach ($this->builders[$alias] as $builder) {
                     $builder->build($menu, $options, $alias);
                 }
             }
             // In any case we must run common builder
             if (array_key_exists(self::COMMON_BUILDER_ALIAS, $this->builders)) {
                 foreach ($this->builders[self::COMMON_BUILDER_ALIAS] as $builder) {
                     $builder->build($menu, $options, $alias);
                 }
             }
             $this->menus[$alias] = $menu;
             $this->eventDispatcher->dispatch(ConfigureMenuEvent::getEventName($alias), new ConfigureMenuEvent($this->factory, $menu));
             $this->sort($menu);
             if ($this->cache) {
                 $this->cache->save($alias, $menu->toArray());
             }
         }
     }
     return $this->menus[$alias];
 }
Beispiel #4
0
 /**
  * Set main menu
  * 
  * @param FactoryInterface $factory
  * @param array $options
  *
  * @return \Knp\Menu\MenuItem
  */
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Home', array('route' => 'homepage'))->setLinkAttribute('title', 'Back to the home page');
     $menu->addChild('Home', array('route' => 'homepage'));
     return $menu;
 }
Beispiel #5
0
 /**
  * @param Item $rootMenuItem
  * @return KnpItemInterface
  */
 protected function createMenuRoot(Item $rootMenuItem)
 {
     $menu = $this->factory->createItem('root');
     $menu->setChildrenAttribute('class', $rootMenuItem->getOption('attr')['class']);
     $menu->setChildrenAttribute('id', $rootMenuItem->getOption('attr')['id']);
     return $menu;
 }
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     //$requestStack = $this->container->get('request_stack');
     //$request = $requestStack->getCurrentRequest();
     $user = $this->container->get('security.context')->getToken()->getUser();
     $user_role = null;
     if (method_exists($user, 'getRole')) {
         $user_role = $user->getRole();
     }
     $menu = $factory->createItem('Navigation')->setChildrenAttributes(array('class' => 'navigation widget'));
     /*
      * Tableau de bord
      */
     $menu->addChild('Tableau de bord', array('route' => 'core_dashboard'))->setAttribute('icon', 'icon-dashboard');
     $menu->addChild('Suivie des articles')->setUri('#')->setAttribute('icon', 'icon-tasks')->setLinkAttribute('class', 'expand');
     $menu['Suivie des articles']->addChild('Liste des articles', array('route' => 'articles'));
     $menu['Suivie des articles']->addChild('Liste des commentaires', array('route' => 'commentaire'));
     $menu->addChild('Administration')->setUri('#')->setAttribute('icon', 'icon-group')->setLinkAttribute('class', 'expand');
     $menu['Administration']->addChild('Gérer les membres', array('route' => 'utilisateur'));
     $menu['Administration']->addChild('Membres premium', array('route' => 'utilisateur_premium'));
     $menu['Administration']->addChild('Gestion des flux RSS', array('route' => 'flux_rss'));
     $menu['Administration']->addChild('Gestion des articles', array('route' => 'article_flux_rss'));
     $menu['Administration']->addChild('Gérer les pays', array('route' => 'pays'));
     $menu['Administration']->addChild('Gestion des blocs affichés', array('route' => 'bloc'));
     $menu['Administration']->addChild('Gestion des sondages', array('route' => 'sondage'));
     return $menu;
 }
Beispiel #7
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $token = $this->container->get('security.token_storage')->getToken();
     $checker = $this->container->get('security.authorization_checker');
     //$user = $token->getUser()->getRoles();
     //dump($user);
     $menu = $factory->createItem('root');
     $menu->addChild('Start', ['route' => 'app_homepage']);
     if ($checker->isGranted(USER::ROLE_ADMIN)) {
         $menu->addChild('Dodaj ogłoszenie', array('route' => 'add_product'));
         $menu->addChild('Add House', array('route' => 'house_add'));
         $menu->addChild('Dodaj miasto', array('route' => 'category_add'));
         $menu->addChild('Konto', array('route' => 'account'));
         $menu->addChild('Rejestracja', array('route' => 'register_account'));
         $menu->addChild('Konta', array('route' => 'view_account'));
         $menu->addChild('Dodaj mieszkańie', array('route' => 'house_add'));
         $menu->addChild('Zobacz mieszkania', array('route' => 'house_view'));
     }
     if ($checker->isGranted(USER::ROLE_USER)) {
         $menu->addChild('Add Product', array('route' => 'add_product'));
         $menu->addChild('View House', array('route' => 'house_view'));
         $menu->addChild('View Profiles', array('route' => 'allproduct'));
         $menu->addChild('Account', array('route' => 'account'));
     } else {
         $menu->addChild('Zarejestruj się!', array('route' => 'register_account'));
         $menu->addChild('Zobacz profile', array('route' => 'allproduct'));
         $menu->addChild('Zobacz mieszkania', array('route' => 'house_view'));
     }
     //$menu->addChild('Messages', array('route' => 'messages'));
     // ... add more children
     return $menu;
 }
Beispiel #8
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');
     //ul
     if ($this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         $menu->addChild('userInfo', array());
     }
     if ($this->container->get('request')->get('_route') == 'default_homepage') {
         $menu->addChild('homePage', array('route' => 'default_homepage', 'label' => '首页'))->setAttribute('class', 'active')->setLabelAttribute('class', 'sr-only');
     } else {
         $menu->addChild('homePage', array('route' => 'default_homepage', 'label' => '首页'));
     }
     $menu->addChild('report', array('route' => 'default_homepage', 'label' => '上报故障'));
     $menu->addChild('RepairForm', array('route' => 'default_homepage', 'label' => '我的工单'))->setAttribute('class', 'dropdown')->setLinkAttribute('class', 'dropdown-toggle')->setLinkAttribute('data-toggle', 'dropdown')->setLinkAttribute('role', 'button')->setLinkAttribute('aria-haspopup', 'true')->setLinkAttribute('aria-expanded', 'false')->setLabelAttribute('class', 'caret')->setChildrenAttribute('class', 'dropdown-menu');
     //ul
     $menu['RepairForm']->addChild('myRepairForm', array('route' => 'default_homepage', 'label' => '我的工单'));
     $menu['RepairForm']->addChild('reportHistory', array('route' => 'reported_history', 'label' => '历史记录'));
     // access services from the container!
     $em = $this->container->get('doctrine')->getManager();
     // findMostRecent and Blog are just imaginary examples
     /*
     $blog = $em->getRepository('AppBundle:Blog')->findMostRecent();
     
     $menu->addChild('Latest Blog Post', array(
         'route' => 'blog_show',
         'routeParameters' => array('id' => $blog->getId())
     ));
     */
     // create another menu item
     // ... add more children
     return $menu;
 }
Beispiel #9
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $em = $this->container->get('doctrine')->getManager();
     /**
      * @var Player $player
      */
     $player = $this->container->get('security.token_storage')->getToken()->getUser();
     $menu->setChildrenAttribute('class', 'sidebar-menu');
     $menu->addChild('Dash', array('route' => '_index'));
     //        // findMostRecent and Blog are just imaginary examples
     //        $blog = $em->getRepository('AppBundle:Blog')->findMostRecent();
     //        $menu->addChild('Latest Blog Post', array(
     //            'route' => 'blog_show',
     //            'routeParameters' => array('id' => $blog->getId())
     //        ));
     // create another menu item
     $menu->addChild('Auctions', array('route' => 'view_auctions'));
     if ($player->hasActiveCar()) {
         $menu->addChild('Garage', array('route' => 'view_garage'));
         $menu->addChild('Go Touge', array('uri' => 'javascript:;', 'attributes' => array('class' => 'sub-menu'), 'childrenAttributes' => array('class' => 'sub')));
         $availableTracks = $em->getRepository('ZaZakretemModelsBundle:Track')->findAll();
         foreach ($availableTracks as $track) {
             $menu['Go Touge']->addChild($track->getName(), array('route' => 'view_track', 'routeParameters' => array('trackId' => $track->getId())));
         }
     }
     // you can also add sub level's to your menu's as follows
     //        $menu['About Me']->addChild('Edit profile', array('route' => 'edit_profile'));
     // ... add more children
     return $menu;
 }
Beispiel #10
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     //        $menu->setAttribute('class', 'left');
     $menu->setChildrenAttribute('class', 'left');
     $securityContext = $this->container->get('security.context');
     if ($securityContext->isGranted('ROLE_SCHEDULE')) {
         $menu->addChild('Phân lịch', array('route' => 'qtu_tkb_timetable_builder'));
     }
     if ($securityContext->isGranted('ROLE_SCHEDULE') || $securityContext->isGranted('ROLE_LECTUREHALL')) {
         $menu->addChild('Sử dụng phòng', array('route' => 'qtu_tkb_room_byweek'));
     }
     if ($securityContext->isGranted('IS_AUTHENTICATED_FULLY')) {
         $menu->addChild('Lịch cá nhân', array('route' => 'qtu_tkb_mytimetable'));
     }
     //        $menu->addChild('Thời khóa biểu', array('route' => 'qtu_tkb_timetable'));
     $menu->addChild('Thời gian biểu', array('route' => 'qtu_tkb_time'));
     $menu->addChild('Liên hệ', array('route' => 'qtu_common_contact'));
     $menu->addChild('Về chúng tôi', array('route' => 'qtu_tkb_about'));
     if ($securityContext->isGranted('ROLE_ADMIN')) {
         $menu->addChild('Quản trị', array('route' => 'sonata_admin_dashboard'));
     }
     //        $menu['root']->setAttribute('class', 'left');
     return $menu;
 }
Beispiel #11
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setChildrenAttribute('class', 'navbar-nav nav');
     $menu->addChild('Stojimas į JK')->setExtra('translation_domain', 'messages')->setAttribute('dropdown', true);
     $menu['Stojimas į JK']->addChild('Oksbridžo etapas', array('route' => 'about_oxbridge'))->setExtra('translation_domain', 'messages');
     $menu['Stojimas į JK']->addChild('JK (II-asis) etapas', array('route' => 'about_uk'))->setExtra('translation_domain', 'messages');
     $menu['Stojimas į JK']->addChild('Mentoriai', array('route' => 'mentor_list'))->setExtra('translation_domain', 'messages');
     $menu->addChild('Stojimas į JAV')->setExtra('translation_domain', 'messages')->setAttribute('dropdown', true);
     $menu['Stojimas į JAV']->addChild('Apie JAV etapą', array('route' => 'about_usa'))->setExtra('translation_domain', 'messages');
     $menu['Stojimas į JAV']->addChild('JAV mentoriai', array('route' => 'about_usa_mentors'))->setExtra('translation_domain', 'messages');
     $menu['Stojimas į JAV']->addChild('Registracija', array('uri' => 'https://goo.gl/forms/thkpGrMSRJiHLdmZ2'))->setExtra('translation_domain', 'messages');
     $menu->addChild('Apie mus', array('route' => 'about_ab'))->setExtra('translation_domain', 'messages');
     /*$menu->addChild('Parama', array(
           'route' => 'support'
       ))->setExtra('translation_domain', 'messages');*/
     /*$securityContext = $this->container->get('security.context');
     
             if ($securityContext->isGranted('ROLE_ADMIN')) {
                 $menu->addChild('Moksleiviai', array(
                     'route' => 'pupil_list'
                 ));
     
                 $menu->addChild('El. paštai', array(
                     'route' => 'user_export'
                 ));
             }*/
     return $menu;
 }
 /**
  * Builds the menu from a given route
  *
  * @param null|string $fromRoute
  * @param array $options
  *
  * @return ItemInterface
  */
 public function buildMenu($fromRoute = null, array $options = [])
 {
     $root = $this->factory->createItem("root");
     // prepare menu for bootstrap
     $this->appendNodes($root, $this->pageTreeModel->getPageTree($fromRoute), $options);
     return $root;
 }
 public function userMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setChildrenAttribute('class', 'nav navbar-nav navbar-right');
     //        $menu->addChild('User', array('label' => 'Hi visitor'))
     //			->setAttribute('dropdown', true)
     //			->setAttribute('icon', 'gl gl-user');
     //		$menu['User']->addChild('Edit profile', array('uri' => '#'))
     //			->setAttribute('icon', 'fa fa-edit');
     //        $menu['User']->addChild('Menu Item', array('uri' => '#'));
     //        $menu['User']->addChild('Menu Item', array('uri' => '#'));
     //        $menu['User']->addChild('Menu Item', array('uri' => '#'));
     // access servies from the container!
     //$em = $this->container->get('doctrine')->getManager();
     $securityContext = $this->container->get('security.authorization_checker');
     if ($securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         $username = $this->container->get('security.context')->getToken()->getUser()->getUsername();
         // Get username of the current logged in user
         $menu->addChild('User')->setAttribute('dropdown', true)->setAttribute('divider_prepend', true);
         $menu['User']->addChild("Hello {$username}");
         $menu['User']->addChild('Edit profile', array('route' => 'fos_user_profile_edit'))->setAttribute('icon', 'glyphicon glyphicon-user');
         $menu['User']->addChild('Logout', array('route' => 'fos_user_security_logout'));
     } else {
         $menu->addChild('Login', array('route' => 'fos_user_security_login'));
     }
     return $menu;
 }
 /**
  * Retrieves the menu based on the group options.
  *
  * @param string $name
  * @param array  $options
  *
  * @return \Knp\Menu\ItemInterface
  *
  * @throws \InvalidArgumentException if the menu does not exists
  */
 public function get($name, array $options = array())
 {
     $group = $options['group'];
     $menuItem = $this->menuFactory->createItem($options['name'], array('label' => $group['label']));
     foreach ($group['items'] as $item) {
         if (isset($item['admin']) && !empty($item['admin'])) {
             $admin = $this->pool->getInstance($item['admin']);
             // skip menu item if no `list` url is available or user doesn't have the LIST access rights
             if (!$admin->hasRoute('list') || !$admin->isGranted('LIST')) {
                 continue;
             }
             $label = $admin->getLabel();
             $options = $admin->generateMenuUrl('list');
             $options['extras'] = array('translation_domain' => $admin->getTranslationDomain(), 'admin' => $admin);
         } else {
             $label = $item['label'];
             $options = array('route' => $item['route'], 'routeParameters' => $item['route_params'], 'extras' => array('translation_domain' => $group['label_catalogue']));
         }
         $menuItem->addChild($label, $options);
     }
     if (false === $menuItem->hasChildren()) {
         $menuItem->setDisplay(false);
     }
     return $menuItem;
 }
Beispiel #15
0
 public function optionMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Profil', array('route' => 'symbb_user_options', 'routeParameters' => array()))->setExtra('translation_domain', 'symbb_frontend');
     $menu->addChild('Security', array('route' => 'symbb_user_options_security'))->setExtra('translation_domain', 'symbb_frontend');
     return $menu;
 }
 public function rolesNewMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setChildrenAttribute('class', 'menu-plus');
     $menu->addChild('+', array('route' => 'artesanus_console_acl_roles_new'))->setAttribute('icon', 'icon-list');
     return $menu;
 }
Beispiel #17
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Home', array('route' => 'start'));
     $menu->addChild('About Me', array('route' => ''));
     return $menu;
 }
Beispiel #18
0
 public function userMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Выход', array('route' => 'fos_user_security_logout'));
     $menu->setCurrent($this->container->get('request')->getRequestUri());
     return $menu;
 }
 public function load($data)
 {
     if (!$this->supports($data)) {
         throw new \InvalidArgumentException(sprintf('NodeLoader can only handle data implementing NodeInterface, "%s" given.', is_object($data) ? get_class($data) : gettype($data)));
     }
     $event = new CreateMenuItemFromNodeEvent($data);
     $this->dispatcher->dispatch(Events::CREATE_ITEM_FROM_NODE, $event);
     if ($event->isSkipNode()) {
         if ($data instanceof Menu) {
             // create an empty menu root to avoid the knp menu from failing.
             return $this->menuFactory->createItem('');
         }
         return;
     }
     $item = $event->getItem() ?: $this->menuFactory->createItem($data->getName(), $data->getOptions());
     if (empty($item)) {
         return;
     }
     if ($event->isSkipChildren()) {
         return $item;
     }
     foreach ($data->getChildren() as $childNode) {
         if ($childNode instanceof NodeInterface) {
             $child = $this->load($childNode);
             if (!empty($child)) {
                 $item->addChild($child);
             }
         }
     }
     return $item;
 }
Beispiel #20
0
 /**
  * @param FactoryInterface $factory
  * @param array $items
  * @param null $event
  * @return \Knp\Menu\ItemInterface
  */
 private function generateMenu(FactoryInterface $factory, $items = [], $event = null)
 {
     /**
      * @var Journal $journal
      * @var AuthorizationChecker $checker
      */
     $dispatcher = $this->container->get('event_dispatcher');
     $menu = $factory->createItem('root')->setChildrenAttribute('class', 'list-unstyled');
     foreach ($items as $item) {
         $label = $item[0];
         $path = $item[1];
         $icon = $item[2];
         $unreadFeedbackCount = 0;
         if (isset($item[3])) {
             $unreadFeedbackCount = $item[3];
         }
         $menu->addChild($label, ['route' => $path, 'extras' => ['icon' => $icon, 'unreadFeedbackCount' => $unreadFeedbackCount]]);
     }
     $menuEvent = new MenuEvent();
     $menuEvent->setMenuItem($menu);
     if (!is_null($event)) {
         $dispatcher->dispatch($event, $menuEvent);
     }
     return $menuEvent->getMenuItem();
 }
Beispiel #21
0
 /**
  * Returns the external menu
  *
  * @return \Knp\Menu\ItemInterface
  */
 public function getExternal()
 {
     $menu = $this->factory->createItem('external');
     $menu->addChild('GitHub', ['uri' => 'https://github.com/tomaskadlec/lunch_guy', 'attributes' => ['icon' => 'fa-github', 'no_label' => true]]);
     $menu->addChild('Slack', ['uri' => 'https://ictfit.slack.com/messages/obed/', 'attributes' => ['icon' => 'fa-slack', 'no_label' => true]]);
     return $menu;
 }
Beispiel #22
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setChildrenAttribute('class', 'nav navbar-nav');
     $menu->addChild('homepage', array('route' => 'homepage'))->setExtra('translation_domain', 'blog');
     $em = $this->container->get('doctrine')->getManager();
     $posts = $em->getRepository('BeluhaBlogBundle:Post')->findAll();
     $menu->addChild('posts')->setAttribute('icon', 'fa fa-list')->setAttribute('dropdown', true)->setExtra('translation_domain', 'blog');
     foreach ($posts as $post) {
         $menu['posts']->addChild($post->getTitle(), array('route' => 'beluha_blog_post_show', 'routeParameters' => array('slug' => $post->getSlug())));
     }
     #$em = $this->container->get('doctrine')->getManager();
     // findMostRecent and Blog are just imaginary examples
     #$authors = $em->getRepository('BeluhaBlogBundle:AuthorQuote')->findAll();
     //$menu->addChild('Авторы', array('route' => 'authorquote_index'))->setAttribute('icon', 'fa fa-list')->setAttribute('dropdown', true);
     #$menu->addChild('authors')->setAttribute('icon', 'fa fa-list')->setAttribute('dropdown', true)->setExtra('translation_domain', 'blog');
     #$menu['authors']->addChild('all_authors',['route' => 'authorquote_index'])->setExtra('translation_domain', 'blog');
     /*foreach ($authors as $author){
           $menu['authors']->addChild($author->getName(), array(
               'route' => 'authorquote_show',
               'routeParameters' => array('id' => $author->getId())
           ));
       }*/
     //$menu->addChild('Цитаты', array('route' => 'authorquote_quote_index'));
     #$menu->addChild('quotes')->setAttribute('icon', 'fa fa-list')->setAttribute('dropdown', true)->setExtra('translation_domain', 'blog');
     #$menu['quotes']->addChild('all_quotes', array('route' => 'authorquote_quote_index'))->setExtra('translation_domain', 'blog');
     #$menu['quotes']->addChild('create_new_quote', array('route' => 'authorquote_quote_new'))->setExtra('translation_domain', 'blog');
     // create another menu item
     //$menu->addChild('About Me', array('route' => 'about'));
     // you can also add sub level's to your menu's as follows
     //$menu['About Me']->addChild('Edit profile', array('route' => 'edit_profile'));
     // ... add more children
     return $menu;
 }
Beispiel #23
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Home', array('route' => 'homepage'));
     $menu->addChild('Lucky', array('route' => 'lucky', 'routeParameters' => array('count' => 2)));
     $menu->addChild('Category', array('route' => 'category_index'));
     $menu->addChild('Product', array('route' => 'product_index'));
     $menu->addChild('Form', array('route' => 'form'));
     $menu['Form']->addChild('Form1', array('route' => 'form1'));
     $menu['Form']->addChild('Form2', array('route' => 'form2'));
     $menu->addChild('Test', array('route' => 'test'));
     $menu['Test']->addChild('Test1', array('route' => 'test1'));
     $menu['Test']->addChild('Test2', array('route' => 'test2'));
     $menu['Test']->addChild('Test3', array('route' => 'test3'));
     $menu['Test']->addChild('Test4', array('route' => 'test4'));
     $menu['Test']->addChild('Test5', array('route' => 'test5'));
     $menu['Test']->addChild('Test6', array('route' => 'test6'));
     // access services from the container!
     //    $em = $this->container->get('doctrine')->getManager();
     // findMostRecent and Blog are just imaginary examples
     //    $blog = $em->getRepository('AppBundle:Blog')->findMostRecent();
     //    $menu->addChild('Latest Blog Post', array(
     //      'route' => 'blog_show',
     //      'routeParameters' => array('id' => $blog->getId())
     //    ));
     // create another menu item
     $menu->addChild('About Me', array('route' => 'product_index'));
     // you can also add sub level's to your menu's as follows
     $menu['About Me']->addChild('Edit profile', array('route' => 'lucky'));
     // ... add more children
     return $menu;
 }
Beispiel #24
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setAttribute('class', 'nav navbar-nav');
     // Add translations in src/Pumukit/NewAdminBundle/Resource/translations/NewAdminBundle.locale.yml
     $menu->addChild('Dashboard', array('route' => 'pumukit_newadmin_dashboard_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $series = $menu->addChild('Multimedia Series', array('route' => 'pumukitnewadmin_series_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $series->addChild('Multimedia', array('route' => 'pumukitnewadmin_mms_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $series->setDisplayChildren(false);
     $live = $menu->addChild('Live')->setExtra('translation_domain', 'NewAdminBundle');
     $live->addChild('Live Channels', array('route' => 'pumukitnewadmin_live_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $live->addChild('Live Events', array('route' => 'pumukitnewadmin_event_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $menu->addChild('Encoder jobs', array('route' => 'pumukit_encoder_info'))->setExtra('translation_domain', 'NewAdminBundle');
     $tables = $menu->addChild('Tables')->setExtra('translation_domain', 'NewAdminBundle');
     $tables->addChild('People', array('route' => 'pumukitnewadmin_person_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $tables->addChild('Tags', array('route' => 'pumukitnewadmin_tag_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $tables->addChild('Access profiles', array('route' => 'pumukitnewadmin_broadcast_index'))->setExtra('translation_domain', 'NewAdminBundle');
     $tables->addChild('Series types', array('route' => 'pumukitnewadmin_seriestype_index'))->setExtra('translation_domain', 'NewAdminBundle');
     if ($this->container->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
         $management = $menu->addChild('Management')->setExtra('translation_domain', 'NewAdminBundle');
         $management->addChild('Admin users', array('route' => 'pumukitnewadmin_user_index'))->setExtra('translation_domain', 'NewAdminBundle');
         $management->addChild('Roles', array('route' => 'pumukitnewadmin_role_index'))->setExtra('translation_domain', 'NewAdminBundle');
     }
     if ($this->container->has("pumukit_opencast.client")) {
         $ingester = $menu->addChild('Ingester')->setExtra('translation_domain', 'NewAdminBundle');
         $ingester->addChild('Opencast Ingester', array('route' => 'pumukitopencast'))->setExtra('translation_domain', 'NewAdminBundle');
     }
     return $menu;
 }
Beispiel #25
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Liste des livres', array('route' => 'book_list'));
     $menu->addChild('Ajouter un livre', array('route' => 'book_new'));
     return $menu;
 }
Beispiel #26
0
 /**
  * Creates the header menu
  *
  * @param FactoryInterface $factory
  * @param array            $options
  *
  * @return \Knp\Menu\ItemInterface
  */
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $isFooter = array_key_exists('is_footer', $options) ? $options['is_footer'] : false;
     $shopCategories = $this->container->get('sonata.classification.manager.category')->getRootCategory('product_catalog');
     $menuOptions = array_merge($options, array('childrenAttributes' => array('class' => 'nav nav-pills')));
     $menu = $factory->createItem('main', $menuOptions);
     $shopMenuParams = array('route' => 'sonata_catalog_index');
     if (count($shopCategories->hasChildren()) > 0 && !$isFooter) {
         $shopMenuParams = array_merge($shopMenuParams, array('attributes' => array('class' => 'dropdown'), 'childrenAttributes' => array('class' => 'dropdown-menu'), 'linkAttributes' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#'), 'label' => 'Products <b class="caret caret-menu"></b>', 'extras' => array('safe_label' => true)));
     }
     if ($isFooter) {
         $shopMenuParams = array_merge($shopMenuParams, array('attributes' => array('class' => 'span2'), "childrenAttributes" => array('class' => 'nav')));
     }
     $shop = $menu->addChild('Shop', $shopMenuParams);
     $menu->addChild('News', array('route' => 'sonata_news_home'));
     foreach ($shopCategories->getChildren() as $category) {
         $shop->addChild($category->getName(), array('route' => 'sonata_catalog_category', 'routeParameters' => array('category_id' => $category->getId(), 'category_slug' => $category->getSlug())));
     }
     $dropdownExtrasOptions = $isFooter ? array('uri' => "#", 'attributes' => array('class' => 'span2'), 'childrenAttributes' => array('class' => 'nav')) : array('uri' => "#", 'attributes' => array('class' => 'dropdown'), 'childrenAttributes' => array('class' => 'dropdown-menu'), 'linkAttributes' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#'), 'label' => 'Solutions <b class="caret caret-menu"></b>', 'extras' => array('safe_label' => true));
     $extras = $factory->createItem('Discover', $dropdownExtrasOptions);
     $extras->addChild('Bundles', array('route' => 'page_slug', 'routeParameters' => array('path' => '/bundles')));
     $extras->addChild('Api', array('route' => 'page_slug', 'routeParameters' => array('path' => '/api-landing')));
     $extras->addChild('Gallery', array('route' => 'sonata_media_gallery_index'));
     $extras->addChild('Media & SEO', array('route' => 'sonata_demo_media'));
     $menu->addChild($extras);
     $menu->addChild('Admin', array('route' => 'page_slug', 'routeParameters' => array('path' => '/user')));
     if ($isFooter) {
         $menu->addChild('Legal notes', array('route' => 'page_slug', 'routeParameters' => array('path' => '/legal-notes')));
     }
     return $menu;
 }
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->addChild('Home', array('route' => 'adam_thomason_main_homepage'));
     $menu->addChild('Resume', array('route' => 'adam_thomason_main_resume'));
     return $menu;
 }
Beispiel #28
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root');
     $menu->setChildrenAttribute('class', 'nav navbar-nav');
     $menu->addChild('Home', array('route' => 'gs_festival_homepage'));
     return $menu;
 }
Beispiel #29
0
 public function mainMenu(FactoryInterface $factory, array $options)
 {
     $menu = $factory->createItem('root', array('childrenAttributes' => array('class' => 'nav navbar-nav')));
     $menu->addChild('Przeglądaj', array('route' => 'homepage'));
     $menu->addChild('Dodaj', array('route' => 'meme_add'));
     $menu->addChild('Losuj i taguj', array('route' => 'meme_random'));
     /*
             // access services from the container!
             $em = $this->container->get('doctrine')->getManager();
             // findMostRecent and Blog are just imaginary examples
             $blog = $em->getRepository('AppBundle:Blog')->findMostRecent();
     
             $menu->addChild('Latest Blog Post', array(
        'route' => 'blog_show',
        'routeParameters' => array('id' => $blog->getId())
             ));
     
             // create another menu item
             $menu->addChild('About Me', array('route' => 'about'));
             // you can also add sub level's to your menu's as follows
             $menu['About Me']->addChild('Edit profile', array('route' => 'edit_profile'));
     
             // ... add more children
     * 
     */
     return $menu;
 }
Beispiel #30
0
 public function createMainMenu()
 {
     $menu = $this->factory->createItem('root')->setChildrenAttribute('class', 'nav navbar-nav');
     $menu->addChild('menu.start', ['route' => 'app_index']);
     $this->createSceneMenu($menu);
     return $menu;
 }