本文整理汇总了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');
}
}
示例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');
}
}