예제 #1
0
 protected function saveMenuItem(Model\CMS\Entity\Menu $menuItem, Form $form)
 {
     $menuItem->setTranslatableLocale($this->getEditControl()->getLocale());
     $this->menuService->getRepository()->persistAsLastChildOf($menuItem, $this->parentMenu);
     $this->menuService->flush();
     $this->flashMessage('common.alert.newEntrySaved', 'success');
     $this->getEditControl()->go('this', ['selectItem' => $menuItem->id]);
 }
예제 #2
0
 protected function saveMenuItem(Model\CMS\Entity\Menu $menuItem, Form $form)
 {
     $menuItem->setTranslatableLocale($this->getEditControl()->getLocale());
     $this->menuService->persist($menuItem);
     $this->menuService->flush();
     $this->flashMessage('common.alert.changesSaved', 'success');
     $this->getEditControl()->go('this', ['selectItem' => $menuItem->id]);
 }
예제 #3
0
 public function isActive(ZaxCMS\Model\CMS\Entity\Menu $menuItem)
 {
     $activePresenter = $this->request->presenterName === $menuItem->getPresenterName();
     $actionMatch = $this->request->parameters['action'] === $menuItem->getActionName();
     if (!$activePresenter || !$actionMatch) {
         return FALSE;
     }
     $slugs = ['category', 'article', 'author', 'tag'];
     $isAnySet = FALSE;
     foreach ($slugs as $slug) {
         if (isset($menuItem->nhrefParams[$slug . '-slug'])) {
             $isAnySet = TRUE;
             if (isset($this->request->parameters[$slug . '-slug']) && $this->request->parameters[$slug . '-slug'] === $menuItem->nhrefParams[$slug . '-slug']) {
                 return TRUE;
             }
         }
     }
     return !$isAnySet;
 }
예제 #4
0
파일: Service.php 프로젝트: zaxxx/zaxcms
 public function __construct(Kdyby\Doctrine\EntityManager $entityManager)
 {
     parent::__construct($entityManager);
     $this->entityClassName = Entity\Menu::getClassName();
 }
예제 #5
0
 public function isActive(ZaxCMS\Model\CMS\Entity\Menu $menuItem)
 {
     $activePresenter = $this->request->presenterName === $menuItem->getPresenterName();
     $activePage = isset($this->request->parameters['page']) && $this->request->parameters['page'] === $menuItem->nhrefParams['page'];
     return $activePresenter && $activePage;
 }
예제 #6
0
 public function isActive(ZaxCMS\Model\CMS\Entity\Menu $menuItem)
 {
     return $this->request->presenterName === $menuItem->getPresenterName();
 }