public function execute($request) { $this->addMenu = QubitMenu::getById(QubitMenu::ADD_EDIT_ID); $this->manageMenu = QubitMenu::getById(QubitMenu::MANAGE_ID); $this->importMenu = QubitMenu::getById(QubitMenu::IMPORT_ID); $this->adminMenu = QubitMenu::getById(QubitMenu::ADMIN_ID); }
public function execute($request) { // Get menu objects $this->browseMenu = QubitMenu::getById(QubitMenu::BROWSE_ID); if (!$this->browseMenu instanceof QubitMenu) { return sfView::NONE; } }
public function execute($request) { // Get menu objects $this->mainMenu = QubitMenu::getById(QubitMenu::MAIN_MENU_ID); if (!$this->mainMenu instanceof QubitMenu) { return sfView::NONE; } }
public function execute($request) { // Get menu objects $this->quickLinksMenu = QubitMenu::getById(QubitMenu::QUICK_LINKS_ID); if (!$this->quickLinksMenu instanceof QubitMenu) { return sfView::NONE; } }
public function execute($request) { $this->form = new sfForm(); $this->menu = QubitMenu::getById($request->id); if (!isset($this->menu)) { $this->forward404(); } if ($request->isMethod('delete')) { if (!$this->menu->isProtected()) { $this->menu->delete(); } // Remove cache if ($this->context->getViewCacheManager() !== null) { $this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*'); $this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*'); } $this->redirect(array('module' => 'menu', 'action' => 'list')); } }
public function execute($request) { // Re-order menus if "move" parameter passed if (isset($request->move) && ($menu = QubitMenu::getById($request->move))) { if (isset($request->before)) { $menu->moveBeforeById($request->before); } else { if (isset($request->after)) { $menu->moveAfterById($request->after); } } // Remove cache if ($this->context->getViewCacheManager() !== null) { $this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*'); $this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*'); } } // Get an array with menu ids and depth (relative to top menu) to create // and indented list $this->menuTree = QubitMenu::getTreeById(QubitMenu::ROOT_ID); foreach ($this->menuTree as $i => $menu) { // Build an array of siblings for each parentId for figuring out // prev/next buttons $siblingList[$menu['parentId']][] = array('id' => $menu['id'], 'pos' => $i); } // Build prev/next values based on number of siblings foreach ($siblingList as $siblings) { foreach ($siblings as $i => $sibling) { if (0 < $i) { $this->menuTree[$sibling['pos']]['prev'] = $siblings[$i - 1]['id']; } if (count($siblings) - 1 > $i) { $this->menuTree[$sibling['pos']]['next'] = $siblings[$i + 1]['id']; } } } }
/** * Find top menu by id, then get all descendents with relative depth * * @param string $topMenuName name of top ancestor * @param array $options optional parameters * @return array of menu columns, with an additional 'depth' column */ public static function getTreeById($id, $options = array()) { // Attempt to grab topMenu object via id if (null === ($topMenu = QubitMenu::getById($id))) { return false; } return QubitMenu::getTree($topMenu, $options); }
public function execute($request) { $this->form = new sfForm(); $this->form->getValidatorSchema()->setOption('allow_extra_fields', true); $this->menu = new QubitMenu(); if (isset($request->id)) { $this->menu = QubitMenu::getById($request->id); if (!isset($this->menu)) { $this->forward404(); } } foreach ($this::$NAMES as $name) { $this->addField($name); } // Handle POST data (form submit) if ($request->isMethod('post')) { $this->form->bind($request->getPostParameters()); if ($this->form->isValid()) { $this->processForm(); $this->menu->save(); // Remove cache if ($this->context->getViewCacheManager() !== null) { $this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_browseMenu&sf_cache_key=*'); $this->context->getViewCacheManager()->remove('@sf_cache_partial?module=menu&action=_mainMenu&sf_cache_key=*'); } $this->redirect(array('module' => 'menu', 'action' => 'list')); } } QubitDescription::addAssets($this->response); }
?> <?php } ?> <?php if ($item['protected']) { ?> <?php echo link_to($item['name'], array(QubitMenu::getById($item['id']), 'module' => 'menu', 'action' => 'edit'), array('class' => 'readOnly', 'title' => __('Edit menu'))); ?> <?php } else { ?> <?php echo link_to($item['name'], array(QubitMenu::getById($item['id']), 'module' => 'menu', 'action' => 'edit'), array('title' => __('Edit menu'))); ?> <?php } ?> </td><td> <?php echo $item['label']; ?> </td> </tr> <?php } ?> </tbody>