当前位置: 首页>>代码示例>>PHP>>正文


PHP Menu\FactoryInterface类代码示例

本文整理汇总了PHP中Knp\Menu\FactoryInterface的典型用法代码示例。如果您正苦于以下问题:PHP FactoryInterface类的具体用法?PHP FactoryInterface怎么用?PHP FactoryInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FactoryInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fabMenu

 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();
 }
开发者ID:beyzakokcan,项目名称:ojs,代码行数:31,代码来源:MenuBuilder.php

示例2: footerMenu

 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;
 }
开发者ID:Richard-NL,项目名称:sonata,代码行数:7,代码来源:Builder.php

示例3: mainMenu

 /**
  * 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;
 }
开发者ID:javierugalde,项目名称:symfony2-quiz,代码行数:15,代码来源:Builder.php

示例4: mainMenu

 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;
 }
开发者ID:Bobarisoa,项目名称:noucoz-release,代码行数:27,代码来源:Navigation.php

示例5: mainMenu

 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;
 }
开发者ID:highcmd,项目名称:home,代码行数:32,代码来源:Builder.php

示例6: mainMenu

 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;
 }
开发者ID:nistlrooy,项目名称:repairsystem,代码行数:33,代码来源:Builder.php

示例7: mainMenu

 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;
 }
开发者ID:BelegUS,项目名称:zazakretem_game,代码行数:31,代码来源:Builder.php

示例8: mainMenu

 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;
 }
开发者ID:princedominh,项目名称:tkb,代码行数:25,代码来源:Builder.php

示例9: mainMenu

 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;
 }
开发者ID:eliberis,项目名称:academicbuddy,代码行数:29,代码来源:Builder.php

示例10: userMenu

 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;
 }
开发者ID:broadcasttechie,项目名称:theatresignage-server,代码行数:27,代码来源:Builder.php

示例11: optionMenu

 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;
 }
开发者ID:symbb,项目名称:symbb,代码行数:7,代码来源:Builder.php

示例12: rolesNewMenu

 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;
 }
开发者ID:ArtesanIO,项目名称:ArtesanusBundle,代码行数:7,代码来源:ConsoleBuilder.php

示例13: mainMenu

 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;
 }
开发者ID:AlexNosach,项目名称:boile,代码行数:7,代码来源:Builder.php

示例14: userMenu

 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;
 }
开发者ID:olegfox,项目名称:landing,代码行数:7,代码来源:BackendMenuBuilder.php

示例15: generateMenu

 /**
  * @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();
 }
开发者ID:beyzakokcan,项目名称:ojs,代码行数:31,代码来源:MenuBuilder.php


注:本文中的Knp\Menu\FactoryInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。