예제 #1
0
 /**
  * Get setting page url by menu item
  *
  * @param MenuItem $item menu item instance
  * @return string|null
  */
 public function getInstanceSettingURI(MenuItem $item)
 {
     $menuType = $this->modules->getModuleObject($item->type);
     return $menuType::getInstanceSettingURI($item->getKey());
 }
예제 #2
0
 /**
  * updateMenuType
  *
  * @param MenuItem $item           item for menu type instance
  * @param array    $menuTypeParams to store menu type params
  * @param array    $itemParams     if it need, can use item's
  *
  * @return void
  */
 protected function updateMenuType(MenuItem $item, array $menuTypeParams, array $itemParams)
 {
     $menuType = $item->type;
     $menuTypeObj = $this->typeHandler->getModuleObject($menuType);
     $menuTypeObj->updateMenu($item->id, $menuTypeParams, $itemParams);
     if ($menuTypeObj::isRouteAble()) {
         $instanceRoute = $this->routeHandler->getByInstanceId($item->id);
         $instanceRoute->url = $itemParams['itemUrl'];
         $this->routeHandler->put($instanceRoute);
     }
 }
예제 #3
0
 /**
  * testGetModuleObjectThrowException
  *
  * @return void
  */
 public function testGetModuleObjectThrowException()
 {
     $this->setExpectedException('\\XpressEngine\\Module\\Exceptions\\NotFoundModuleException');
     $register = $this->register;
     $register->shouldReceive('get')->andReturn(null);
     $moduleHandler = new ModuleHandler($register);
     $moduleHandler->getModuleObject('module/xpressengine@test');
 }
예제 #4
0
 /**
  * editItemPermission
  * 선택된 메뉴의 아이템을 permission 을 수정하는 페이지 구성
  *
  * @param MenuHandler   $handler menu handler
  * @param ModuleHandler $modules module handler
  * @param string        $menuId  menu id
  * @param string        $itemId  item id
  *
  * @return RendererInterface
  */
 public function editItemPermission(MenuHandler $handler, ModuleHandler $modules, $menuId, $itemId)
 {
     $item = $handler->getItem($itemId);
     $menu = $item->menu;
     if ($menu->getKey() !== $menuId) {
         throw new InvalidArgumentHttpException(400);
     }
     try {
         $menuType = $modules->getModuleObject($item->type);
     } catch (NotFoundModuleException $e) {
         $menuType = null;
     }
     $permArgs = $this->getPermArguments($handler->permKeyString($item), [MenuHandler::ACCESS, MenuHandler::VISIBLE]);
     return XePresenter::make('menu.itemPermission', array_merge(['menu' => $menu, 'item' => $item, 'menuType' => $menuType], $permArgs));
 }
예제 #5
0
 /**
  * editItemPermission
  * 선택된 메뉴의 아이템을 permission 을 수정하는 페이지 구성
  *
  * @param MenuRetrieveHandler                $menuHandler       menu handler
  * @param MenuPermissionHandler              $permissionHandler menu permission handler
  * @param \Xpressengine\Module\ModuleHandler $moduleHandler     module handler
  * @param string                             $menuId            menu id
  * @param string                             $itemId            item id
  *
  * @return RendererInterface
  */
 public function editItemPermission(MenuRetrieveHandler $menuHandler, MenuPermissionHandler $permissionHandler, ModuleHandler $moduleHandler, $menuId, $itemId)
 {
     $menu = $menuHandler->getMenu($menuId);
     $item = $menu->getItem($itemId);
     try {
         $menuType = $moduleHandler->getModuleObject($item->type);
     } catch (NotFoundModuleException $e) {
         $menuType = null;
     }
     $accessPermission = $permissionHandler->getItemAccessPermission($item);
     $visiblePermission = $permissionHandler->getItemVisiblePermission($item);
     return Presenter::make('menu.itemPermission', ['menu' => $menu, 'item' => $item, 'menuType' => $menuType, 'access' => ['mode' => $accessPermission['mode'], 'grant' => $accessPermission, 'title' => 'access'], 'visible' => ['mode' => $visiblePermission['mode'], 'grant' => $visiblePermission, 'title' => 'visible']]);
 }