Пример #1
0
 public function renderAction()
 {
     $menu = $this->_request->getParam('menu');
     $mdlMenuItems = new Application_Model_DbTable_MenuItem();
     $menuItems = $mdlMenuItems->getItemsByMenu($menu);
     //print_r($menuItems);
     if (count($menuItems) > 0) {
         $user = new Zend_Session_Namespace('user');
         foreach ($menuItems as $item) {
             //print_r($user->name);
             $label = $item->label;
             if (empty($item->link)) {
                 $uri = '#';
             } else {
                 if ($menu == 1) {
                     $uri = '/' . BLOGGER_NAME . $item->link;
                     $itemArray[] = array('label' => $label, 'uri' => $uri, 'target' => '_self');
                 } else {
                     $uri = $item->link;
                     $itemArray[] = array('label' => $label, 'uri' => $uri, 'target' => '_blank');
                 }
             }
         }
         $container = new Zend_Navigation($itemArray);
         $this->view->container = $container;
     }
 }
 public function deleteAction()
 {
     $id = $this->_request->getParam('id');
     $mdlMenuItem = new Application_Model_DbTable_MenuItem();
     $currentMenuItem = $mdlMenuItem->find($id)->current();
     $mdlMenuItem->deleteItem($id);
     $this->_request->setParam('menu', $currentMenuItem->menu_id);
     $this->_forward('index');
 }