public function __construct($options = null) { $oModelNavigationModule = new Admin_Model_NavigationModule(); $oModelNavigationController = new Admin_Model_NavigationController(); $oModelNavigationAction = new Admin_Model_NavigationAction(); $oModelNavigationResource = new Admin_Model_NavigationResource(); $oModelNavigationPrivilege = new Admin_Model_NavigationPrivilege(); $oModelUserRole = new Admin_Model_UserRole(); $aAllModule = $oModelNavigationModule->getAll()->toArray(); if (count($aAllModule)) { foreach ($aAllModule as $aValue) { $this->_aAllModule[$aValue["id"]] = $aValue["value"]; } } $aAllController = $oModelNavigationController->getAll()->toArray(); if (count($aAllController)) { foreach ($aAllController as $aValue) { $this->_aAllController[$aValue["id"]] = $aValue["value"]; } } $aAllAction = $oModelNavigationAction->getAll()->toArray(); if (count($aAllAction)) { foreach ($aAllAction as $aValue) { $this->_aAllAction[$aValue["id"]] = $aValue["value"]; } } $aAllRosource = $oModelNavigationResource->getAll()->toArray(); if (count($aAllRosource)) { foreach ($aAllRosource as $aValue) { $this->_aAllResource[$aValue["id"]] = $aValue["value"]; } } $aAllPriviage = $oModelNavigationPrivilege->getAll()->toArray(); if (count($aAllPriviage)) { foreach ($aAllPriviage as $aValue) { $this->_aAllPrivilege[$aValue["id"]] = $aValue["value"]; } } $aAllUserRole = $oModelUserRole->getAll()->toArray(); if (count($aAllUserRole)) { foreach ($aAllUserRole as $aValue) { $this->_aAllUserRole[$aValue["id"]] = $aValue["role_name"]; } } $oModelImage = new Admin_Model_Image(); $aImage = $oModelImage->getAll()->toArray(); $this->_aAllImage[0] = "-"; if (count($aImage)) { foreach ($aImage as $nKey => $aValue) { $this->_aAllImage[$aValue["id"]] = $aValue["user_name"]; } } $this->getSiteLayout(); parent::__construct($options); }
public function elementAction() { $oFormNavigationElement = new Admin_Form_NavigationElement(); $oModelNavigationModule = new Admin_Model_NavigationModule(); $oModelNavigationController = new Admin_Model_NavigationController(); $oModelNavigationAction = new Admin_Model_NavigationAction(); $oModelNavigationResource = new Admin_Model_NavigationResource(); $oModelNavigationPrivilege = new Admin_Model_NavigationPrivilege(); $aPostData = array(); if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); if ($oFormNavigationElement->isValid($aPostData)) { $nNavigationElementId = $aPostData["navigation_element_id"]; $nNavigationElementEditId = $aPostData["navigation_element_edit_id"]; $sValue = $aPostData["value"]; switch ($nNavigationElementId) { case 0: $oModelNavigationElement = $oModelNavigationModule; break; case 1: $oModelNavigationElement = $oModelNavigationController; break; case 2: $oModelNavigationElement = $oModelNavigationAction; break; case 3: $oModelNavigationElement = $oModelNavigationResource; break; case 4: $oModelNavigationElement = $oModelNavigationPrivilege; break; } if ($nNavigationElementEditId != 0) { $oModelNavigationElement->edit($nNavigationElementEditId, strtolower($sValue)); $oFormNavigationElement->clearForm(); } else { $oModelNavigationElement->add(strtolower($sValue)); $oFormNavigationElement->clearForm(); } } } $this->view->aAllModule = $oModelNavigationModule->getAll()->toArray(); $this->view->aAllController = $oModelNavigationController->getAll()->toArray(); $this->view->aAllAction = $oModelNavigationAction->getAll()->toArray(); $this->view->aAllResource = $oModelNavigationResource->getAll()->toArray(); $this->view->aAllPrivilege = $oModelNavigationPrivilege->getAll()->toArray(); $this->view->oFormNavigationElement = $oFormNavigationElement; }