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


PHP DaoFactory::MenuRoleD方法代码示例

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


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

示例1: perform

 /**
  * ロールマスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // get request params
     $role_id_arr = $this->af->get('role_id_arr');
     // get session params
     $s_user_id = $this->session->get('user_id');
     $company_id = $this->session->get('company_id');
     // dao
     $roleDao = DaoFactory::RoleMst();
     $menuRoleDDao = DaoFactory::MenuRoleD();
     try {
         // begin
         $roleDao->BeginTransaction();
         $params = array('company_id' => $company_id);
         if ($_REQUEST['del'] == 'all') {
             $roleDao->Delete(' company_id = ? ', $params);
             $menuRoleDDao->Delete(' company_id = ? ', $params);
         } else {
             foreach ($role_id_arr as $role_id) {
                 $where = ' company_id = ? AND role_id = ? ';
                 $params['role_id'] = $role_id;
                 $roleDao->Delete($where, $params);
                 $menuRoleDDao->Delete($where, $params);
             }
         }
         // commit
         $roleDao->CommitTransaction();
     } catch (Exception $e) {
         // rollback
         $roleDao->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:40,代码来源:Delete.php

示例2: perform

 /**
  * ロールマスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // get request params
     $role_name = $this->af->get('role_name');
     $child_menu_id_arr = $this->af->get('child_menu_id_arr');
     // get session params
     $company_id = $this->session->get('company_id');
     $s_user_id = $this->session->get('user_id');
     // dao
     $menuRoleDao = DaoFactory::MenuRoleD();
     $roleMstDao = DaoFactory::RoleMst();
     try {
         // begin
         $menuRoleDao->BeginTransaction();
         // ROLE_MST に insert
         $role_id = intval($roleMstDao->maxByColumn('ROLE_ID', ' company_id = ? ', array('company_id' => $company_id))) + 1;
         $params = array('company_id' => $company_id, 'role_id' => $role_id, 'role_name' => $role_name, 'UID' => $s_user_id, 'PGM' => get_class());
         $roleMstDao->Insert($params);
         if (!empty($child_menu_id_arr)) {
             foreach ($child_menu_id_arr as $top_menu_id => $child_menu_id_list) {
                 foreach ($child_menu_id_list as $key => $menu_id) {
                     $params = array('company_id' => $company_id, 'menu_id' => $menu_id, 'role_id' => $role_id, 'UID' => $s_user_id, 'PGM' => get_class());
                     $menuRoleDao->Insert($params);
                 }
             }
         }
         // commit
         $menuRoleDao->CommitTransaction();
     } catch (Exception $e) {
         $menuRoleDao->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:40,代码来源:Insert.php

示例3: authenticate

 function authenticate()
 {
     // ログインチェック
     $login = new LoginController();
     if (!$login->isLogin()) {
         return array('401', array());
     }
     // get params
     $action = $this->backend->ctl->getCurrentActionName();
     // アクション名を取得
     $kengen_flg = intval($this->session->get('kengen_flg'));
     // 権限取得
     $company_id = $this->session->get('company_id');
     // 会社CD取得
     $role_id = $this->session->get('role_id');
     // ロールID取得
     // 権限フラグチェック
     if ($kengen_flg != Konst::KENGEN_FLG_KANRI && $kengen_flg != Konst::KENGEN_FLG_SUPER) {
         // 管理者ユーザ(8)、スーパーユーザ(9)以外であれば弾く
         $login->Logout();
         return '403';
     }
     // スーパーユーザはロール権限のチェックを行わない
     if ($kengen_flg != Konst::KENGEN_FLG_SUPER) {
         // ロールDとActionNameを比較して有効であれば通す
         $params = array('company_id' => $company_id, 'role_id' => $role_id, 'action_name' => $action);
         $enable = DaoFactory::MenuRoleD()->getCheckEnableRole($params)->fetch();
         if (empty($enable)) {
             return '403';
         }
     }
     $this->setGuideModal();
     $this->checkLicense();
     return null;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:35,代码来源:Api_ActionClass.php

示例4: authenticate

 function authenticate()
 {
     $this->af->setApp('app_name', $this->config->get('app_name'));
     // ログインチェック
     $login = new LoginController();
     if (!$login->isLogin()) {
         return 'login';
     }
     // パスワード期限チェック
     $company_id = $this->session->get('company_id');
     $user_id = $this->session->get('user_id');
     $params = array('company_id' => $company_id, 'user_id' => $user_id);
     if (DaoFactory::UserMst()->isExpiredPassword($params)) {
         return 'password_list';
     }
     // get params
     $action = $this->backend->ctl->getCurrentActionName();
     // アクション名を取得
     $kengen_flg = intval($this->session->get('kengen_flg'));
     // 権限取得
     $company_id = $this->session->get('company_id');
     // 会社CD取得
     $role_id = $this->session->get('role_id');
     // ロールID取得
     // 権限フラグチェック
     if ($kengen_flg != Konst::KENGEN_FLG_KANRI && $kengen_flg != Konst::KENGEN_FLG_SUPER) {
         // 管理者ユーザ(8)、スーパーユーザ(9)以外であれば弾く
         $login->Logout();
         return 'login';
     }
     // スーパーユーザはロール権限のチェックを行わない
     if ($kengen_flg != Konst::KENGEN_FLG_SUPER) {
         // ロールD と ActionName を比較して有効であれば通す
         $params = array('company_id' => $company_id, 'role_id' => $role_id, 'action_name' => $action);
         $enable = DaoFactory::MenuRoleD()->getCheckEnableRole($params)->fetch();
         if (empty($enable)) {
             return array('redirect', '?action_error=true');
         }
     }
     // パンくず
     // アクション名からメニューを取得
     $params = array('company_id' => $company_id, 'action_name' => $action);
     $current = DaoFactory::MenuRoleD()->getMenuByActionName($params)->fetch();
     // 取得したメニューから親メニューを取得
     $params = array('company_id' => $company_id, 'menu_id' => $current['PARENT_ID']);
     $parent = DaoFactory::MenuRoleD()->getParentMenuByMenuId($params)->fetch();
     $this->af->setApp('crumbs_root', array_change_key_case((array) $parent));
     $this->af->setApp('crumbs_parent', array_change_key_case((array) $current));
     $locale = $this->session->get('current_locale');
     if ($locale) {
         $this->backend->getController()->setLocale($locale);
     }
     $this->setGuideModal();
     $this->checkLicense();
     return null;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:56,代码来源:Screen_ActionClass.php

示例5: perform

 /**
  * ロールマスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // get request params
     $role_id = $this->af->get('role_id');
     $role_name = $this->af->get('role_name');
     $child_menu_id_arr = $this->af->get('child_menu_id_arr');
     // get session params
     $company_id = $this->session->get('company_id');
     $s_user_id = $this->session->get('user_id');
     // dao
     $menuRoleDao = DaoFactory::MenuRoleD();
     $roleMstDao = DaoFactory::RoleMst();
     try {
         // begin
         $menuRoleDao->BeginTransaction();
         // リクエストされたmenu_idを1次元配列に変換する
         $request_menu_id_arr = array();
         if (!empty($child_menu_id_arr)) {
             foreach ($child_menu_id_arr as $key => $child_menu_id_lsit) {
                 foreach ($child_menu_id_lsit as $child_menu) {
                     $request_menu_id_arr[] = $child_menu;
                 }
             }
         }
         $params = array('company_id' => $company_id, 'role_id' => $role_id);
         // exists
         $exists = $roleMstDao->Retrieve(' company_id = ? and role_id = ? ', $params);
         if (empty($exists)) {
             throw new Exception("存在しないロールIDです");
         }
         // delete
         $menuRoleDao->Delete(' company_id = ? and role_id = ? ', $params);
         // insert
         if (!empty($request_menu_id_arr)) {
             foreach ($request_menu_id_arr as $menu_id) {
                 $params = array('company_id' => $company_id, 'menu_id' => $menu_id, 'role_id' => $role_id, 'UID' => $s_user_id, 'PGM' => get_class());
                 $menuRoleDao->Insert($params);
             }
         }
         // role_name update
         $params = array('role_name' => $role_name);
         $roleMstDao->Update($params, ' company_id = ? and role_id = ? ', array('company_id' => $company_id, 'role_id' => $role_id));
         // commit
         $menuRoleDao->CommitTransaction();
     } catch (Exception $e) {
         $menuRoleDao->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:56,代码来源:Update.php

示例6: _setDefault

 public function _setDefault(&$renderer)
 {
     // get session params
     $company_id = $this->session->get('company_id');
     $user_id = $this->session->get('user_id');
     $kengen_flg = $this->session->get('kengen_flg');
     // su?
     if ($kengen_flg == Konst::KENGEN_FLG_SUPER) {
         // get menu mst
         $top_menu = DaoFactory::MenuMst()->Select(' company_id = ? and parent_id is null ORDER BY MENU_ID ', array('company_id' => $company_id))->fetchAll();
         // get menu
         $global_menu = array();
         foreach ($top_menu as $menu) {
             $params = array('company_id' => $company_id, 'parent_id' => $menu['MENU_ID']);
             $child_menu = DaoFactory::MenuMst()->Select(' company_id = ? AND parent_id = ? ORDER BY MENU_ID ', $params)->fetchAll();
             if (!empty($child_menu)) {
                 $global_menu[$menu['MENU_ID']]['child_menu'] = $child_menu;
                 $global_menu[$menu['MENU_ID']]['top_menu_name'] = $menu['MENU_NAME'];
             }
         }
     } else {
         // get user
         $params = array('company_id' => $company_id, 'user_id' => $user_id);
         $user = DaoFactory::UserMst()->Retrieve(' company_id = ? and user_id = ? and del_flg = 0 ', $params);
         $user_role_id = $user['ROLE_ID'];
         // get menu mst
         $top_menu = DaoFactory::MenuMst()->Select(' company_id = ? and parent_id is null ORDER BY MENU_ID ', array('company_id' => $company_id))->fetchAll();
         // get menu
         $global_menu = array();
         foreach ($top_menu as $menu) {
             $params = array('company_id' => $company_id, 'role_id' => $user_role_id, 'parent_id' => $menu['MENU_ID']);
             $child_menu = DaoFactory::MenuRoleD()->getMenuRoleDAtParentIdByRoleIdAndParentId($params)->fetchAll();
             if (!empty($child_menu)) {
                 $global_menu[$menu['MENU_ID']]['child_menu'] = $child_menu;
                 $global_menu[$menu['MENU_ID']]['top_menu_name'] = $menu['MENU_NAME'];
             }
         }
     }
     // Renderer からテンプレートエンジンを取得
     $smarty =& $renderer->getEngine();
     $smarty->assign('global_menu', $global_menu);
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:42,代码来源:ViewClass.php


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