コード例 #1
0
 public function edit($nNavigationSubmenuId, $aData)
 {
     $oModelNavigationMenu = new Admin_Model_NavigationMenu();
     $oModelNavigationResource = new Admin_Model_NavigationResource();
     $oModelNavigationOption = new Admin_Model_NavigationOption();
     $oGenereteSessionId = new AppCms2_GenereteSessionId();
     try {
         $this->_db->beginTransaction();
         $oRow = $this->find($nNavigationSubmenuId)->current();
         if ($oRow instanceof Zend_Db_Table_Row_Abstract) {
             $oRow->label = $aData["label"];
             $oRow->visible = $aData["visible"];
             $oRow->navigation_menu_id = $aData["navigation_menu_id"];
             if ($oRow->save()) {
                 $nNavigatinMenuOptionId = $oModelNavigationMenu->findOptionId($aData["navigation_menu_id"]);
                 $aData["navigation_module_id"] = $oModelNavigationOption->findModuleId($nNavigatinMenuOptionId);
                 $aData["navigation_controller_id"] = $oModelNavigationOption->findControllerId($nNavigatinMenuOptionId);
                 $aGenereteSessionId = $oGenereteSessionId->generatePassword();
                 $sNavigationResource = "menu_resource_{$aData["navigation_module_id"]}_{$aData["navigation_controller_id"]}_{$aData["navigation_action_id"]}_{$aGenereteSessionId["user_password"]}";
                 $nNavigationResourceId = $oModelNavigationResource->add($sNavigationResource);
                 if (isset($nNavigationResourceId)) {
                     $aData["navigation_resource_id"] = $nNavigationResourceId;
                     $nNavigationOptionId = $oRow->navigation_option_id;
                     if ($oModelNavigationOption->edit($nNavigationOptionId, $aData)) {
                         $this->_db->commit();
                         return $nNavigationOptionId;
                     }
                 }
             }
         }
         $this->_db->rollBack();
         return null;
     } catch (Zend_Exception $e) {
         $this->_db->rollBack();
         return null;
     }
 }