当前位置: 首页>>代码示例>>PHP>>正文


PHP Default_Model_Menu::addOrUpdateMenuLogManager方法代码示例

本文整理汇总了PHP中Default_Model_Menu::addOrUpdateMenuLogManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Menu::addOrUpdateMenuLogManager方法的具体用法?PHP Default_Model_Menu::addOrUpdateMenuLogManager怎么用?PHP Default_Model_Menu::addOrUpdateMenuLogManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Default_Model_Menu的用法示例。


在下文中一共展示了Default_Model_Menu::addOrUpdateMenuLogManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: savemenuAction

 public function savemenuAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $date = new Zend_Date();
     $wizard_model = new Default_Model_Wizard();
     $wizardData = $wizard_model->getWizardData();
     $trDb = Zend_Db_Table::getDefaultAdapter();
     // starting transaction
     $trDb->beginTransaction();
     try {
         if ($this->_request->getPost()) {
             $defined_menus = array(TIMEMANAGEMENT, RESOURCEREQUISITION, BGCHECKS, STAFFING, COMPLIANCES, REPORTS, BENEFITS, SERVICEDESK);
             $chk_menu = $this->_request->getParam('chk_menu');
             // menus to be activate
             $chk_menu = trim($chk_menu, ',');
             $logmenus = $chk_menu;
             if ($chk_menu != '' && $chk_menu != ',' && !is_array($chk_menu)) {
                 $chk_menu = explode(',', $chk_menu);
             } else {
                 $chk_menu = array();
             }
             $disable_menus = array_diff($defined_menus, $chk_menu);
             //menus to be deactivated
             if (!empty($chk_menu)) {
                 foreach ($chk_menu as $menu) {
                     $this->save_helper(1, $menu);
                 }
             }
             if (!empty($disable_menus)) {
                 foreach ($disable_menus as $menu) {
                     $this->save_helper(0, $menu);
                 }
             }
             // Code to Update Logmanager table with comma separated menuids
             $menumodel = new Default_Model_Menu();
             $menuNames = $menumodel->getMenusNamesByIds($logmenus);
             $logarr = array('userid' => $loginUserId, 'recordid' => $logmenus, 'childrecordid' => $menuNames, 'date' => $date->get('yyyy-MM-dd HH:mm:ss'));
             $jsonlogarr = json_encode($logarr);
             $menuID = MANAGEMODULE;
             $actionflag = 2;
             if (!empty($logmenus)) {
                 //only activated records are logged in log manager.
                 $menumodel->addOrUpdateMenuLogManager($menuID, $actionflag, $jsonlogarr, $loginUserId, $menuNames);
             }
             $wizardarray = array('manage_modules' => 2, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($wizardData['site_config'] == 2 && $wizardData['org_details'] == 2) {
                 $wizardarray['iscomplete'] = 2;
             }
             $wizard_model->SaveorUpdateWizardData($wizardarray, '');
             $trDb->commit();
             sapp_Global::generateAccessControl();
             $this->_helper->getHelper("FlashMessenger")->addMessage("Modules updated successfully.");
             $this->_redirect('wizard/managemenu');
         } else {
             $this->_helper->getHelper("FlashMessenger")->addMessage("No Menus were added.");
             $this->_redirect('wizard/managemenu');
         }
     } catch (Exception $e) {
         $trDb->rollBack();
         $msg = $e->getMessage();
         $this->_helper->getHelper("FlashMessenger")->addMessage($msg);
         $this->_redirect('managemenu');
     }
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:67,代码来源:WizardController.php

示例2: saveAction

 public function saveAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $date = new Zend_Date();
     $trDb = Zend_Db_Table::getDefaultAdapter();
     // starting transaction
     $trDb->beginTransaction();
     try {
         if ($this->_request->getPost()) {
             $defined_menus = unserialize(MANAGE_MODULE_ARRAY);
             $chk_menu = $this->_request->getParam('chk_menu');
             // menus to be activate
             $chk_menu = trim($chk_menu, ',');
             $logmenus = $chk_menu;
             if ($chk_menu != '' && $chk_menu != ',' && !is_array($chk_menu)) {
                 $chk_menu = explode(',', $chk_menu);
             } else {
                 $chk_menu = array();
             }
             $disable_menus = array_diff($defined_menus, $chk_menu);
             //menus to be deactivated
             if (!empty($chk_menu)) {
                 foreach ($chk_menu as $menu) {
                     $this->save_helper(1, $menu);
                 }
             }
             if (!empty($disable_menus)) {
                 foreach ($disable_menus as $menu) {
                     $this->save_helper(0, $menu);
                 }
             }
             // Code to Update Logmanager table with comma separated menuids
             $menumodel = new Default_Model_Menu();
             $menuNames = $menumodel->getMenusNamesByIds($logmenus);
             $logarr = array('userid' => $loginUserId, 'recordid' => $logmenus, 'childrecordid' => $menuNames, 'date' => $date->get('yyyy-MM-dd HH:mm:ss'));
             $jsonlogarr = json_encode($logarr);
             $menuID = MANAGEMODULE;
             $actionflag = 2;
             if (!empty($logmenus)) {
                 //only activated records are logged in log manager.
                 $menumodel->addOrUpdateMenuLogManager($menuID, $actionflag, $jsonlogarr, $loginUserId, $menuNames);
             }
             $this->_helper->getHelper("FlashMessenger")->addMessage("Modules updated successfully.");
             $trDb->commit();
             sapp_Global::generateAccessControl();
             $this->_redirect('managemenus');
         } else {
             $this->_helper->getHelper("FlashMessenger")->addMessage("No Menus were added.");
             $this->_redirect('managemenus');
         }
     } catch (Exception $e) {
         $trDb->rollBack();
         $msg = $e->getMessage();
         //echo $msg; die;
         $this->_helper->getHelper("FlashMessenger")->addMessage($msg);
         $this->_redirect('managemenus');
     }
 }
开发者ID:sura2k,项目名称:sentrifugo,代码行数:61,代码来源:ManagemenusController.php


注:本文中的Default_Model_Menu::addOrUpdateMenuLogManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。