本文整理汇总了PHP中DaoFactory::RoleMst方法的典型用法代码示例。如果您正苦于以下问题:PHP DaoFactory::RoleMst方法的具体用法?PHP DaoFactory::RoleMst怎么用?PHP DaoFactory::RoleMst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DaoFactory
的用法示例。
在下文中一共展示了DaoFactory::RoleMst方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: perform
/**
* ロールマスタのデータをJSON形式で返す
* @access public
* @return array ロールマスタ
* @see Admin_ActionClass::perform()
*/
public function perform()
{
// get request params ( search )
$role_name = $this->af->get('role_name');
$keyword = $this->af->get('keyword');
// get request params ( pager )
$limit = $this->af->get('limit');
$page = $this->af->get('page');
$order = $this->af->get('order');
$column = $this->af->get('column');
// get session params
$company_id = $this->session->get('company_id');
// pager setting
$start_page = ($page - 1) * $limit + 1;
$end_page = ($page - 1) * $limit + $limit;
try {
$params = array('role_name' => $role_name, 'keyword' => $keyword, 'company_id' => $company_id, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'start_page' => $start_page, 'end_page' => $end_page);
// ロールマスタ取得
$list = DaoFactory::RoleMst()->getRoleMstList($params)->fetchAll();
foreach ($list as &$role) {
// ロールIDごとの各マスタ権限を取得する
$role['ROLE_SUMMARY'] = DaoFactory::MenuMst()->getMstAndD2Count(array('company_id' => $company_id, 'role_id' => $role['ROLE_ID']))->fetchAll();
}
// ページ情報を設定
$pager = array('result_page' => $page, 'result_start_num' => $start_page, 'result_end_num' => $end_page, 'result_all_count' => count($list) ? $list[0]['FOUND_ROWS'] : 0, 'result_get_count' => count($list), 'result_limit' => $limit);
// output にセット
$output['totalData'] = array();
$output['listData'] = $list;
$output['pagerData'] = $pager;
} catch (Exception $e) {
// 致命的なエラーが発生
return array('500', $e->getMessage());
}
return array('json', $output);
}
示例4: perform
/**
* ユーザマスタの保存が成功したかJSON形式で返す
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
// get request params
$user_id = $this->af->get('user_id');
$login_id = $this->af->get('login_id');
$user_name = $this->af->get('user_name');
$e_mail = $this->af->get('e_mail');
$role_id = $this->af->get('role_id');
$default_locale = $this->af->get('default_locale');
// get session params
$company_id = $this->session->get('company_id');
$s_user_id = $this->session->get('user_id');
// dao
$userDao = DaoFactory::UserMst();
$roleDao = DaoFactory::RoleMst();
try {
// begin
$userDao->BeginTransaction();
// exists ( user_id, login_id )
$exist = $userDao->Retrieve(' company_id = ? AND user_id = ?', array($company_id, $user_id));
if (empty($exist)) {
$def1 = $this->af->getDef('user_id');
$err_msg = array('user_id' => "入力された" . $def1['name'] . "は登録されていません");
return array(400, $err_msg);
}
// 入力したログインIDとuser_idで引っ張ってきたログインIDを比較し、
// 異なっていれば(変更しようとしていれば)login_idの一意チェックを行う
if ($exist['LOGIN_ID'] !== $login_id) {
// exists ( user_id, login_id )
$wheresql = ' company_id = ? AND login_id = ? ';
$bindarr = array($company_id, $login_id);
$exist = $userDao->Retrieve($wheresql, $bindarr);
if (!empty($exist)) {
$def = $this->af->getDef('login_id');
$err_msg = array('login_id' => "入力された" . $def['name'] . "は既に登録されています");
return array(400, $err_msg);
}
}
// exists ( role_id )
$exist = $roleDao->Retrieve(' company_id = ? AND role_id = ? ', array($company_id, $role_id));
if (empty($exist)) {
$def1 = $this->af->getDef('role_id');
$err_msg = array('role_id' => "入力された" . $def1['name'] . "は登録されていません");
return array(400, $err_msg);
}
// set params
$params = array('login_id' => $login_id, 'user_name' => $user_name, 'e_mail' => $e_mail, 'role_id' => $role_id, 'default_locale' => $default_locale, 'UID' => $s_user_id, 'PGM' => get_class());
// dao update
$userDao->Update($params, ' company_id = ? AND user_id = ? ', array($company_id, $user_id));
// commit
$userDao->CommitTransaction();
} catch (Exception $e) {
// rollback
$userDao->AbortTransaction();
$this->logger->log(LOG_DEBUG, $e->getTraceAsString());
return array(500, $e->getMessage());
}
exit;
}
示例5: getArrayOption_role_id
/**
* ロールIDの取得
* @param string $name フォーム名
*/
public function getArrayOption_role_id()
{
$list = DaoFactory::RoleMst()->Select(' company_id = ? ', array('company_id' => $this->backend->getSession()->get('company_id')));
foreach ($list as $val) {
$ret[$val['ROLE_ID']] = $val['ROLE_NAME'];
}
return $ret;
}
示例6: perform
/**
* ユーザマスタの保存が成功したかJSON形式で返す
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
// get request params
$login_id = $this->af->get('login_id');
$user_name = $this->af->get('user_name');
$warehouse_id = $this->af->get('warehouse_id');
$e_mail = $this->af->get('e_mail');
$pwd_settei = $this->af->get('pwd_settei');
$default_locale = $this->af->get('default_locale');
$raw_user_pwd = Util::makeRandomPassword();
//パスワード生成
$user_pwd = $pwd_settei == 1 ? md5($raw_user_pwd) : '';
// pwd_settei が 1 であれば、ランダムな文字を生成してパスワードとする。
$role_id = $this->af->get('role_id');
// get session params
$company_id = $this->session->get('company_id');
$s_user_id = $this->session->get('user_id');
$kengen_flg = $this->session->get('kengen_flg');
// dao
$userDao = DaoFactory::UserMst();
$roleDao = DaoFactory::RoleMst();
try {
// begin
$userDao->BeginTransaction();
// FIXME: このへんのトランザクション内存在チェック処理、共通化できればもう少しスッキリする… @ 2012/05/01 myoshii@asx.co.jp
// exists ( user_id, login_id )
$wheresql = ' company_id = ? AND login_id = ? ';
$bindarr = array($company_id, $login_id);
$exist = $userDao->Retrieve($wheresql, $bindarr);
if (!empty($exist)) {
$def = $this->af->getDef('login_id');
$err_msg = array('login_id' => "入力された" . $def['name'] . "は既に登録されています");
return array(400, $err_msg);
}
// exists ( role_id )
$exist = $roleDao->Retrieve(' company_id = ? AND role_id = ? ', array($company_id, $role_id));
if (empty($exist)) {
$def1 = $this->af->getDef('role_id');
$err_msg = array('role_id' => "入力された" . $def1['name'] . "は登録されていません");
return array(400, $err_msg);
}
// set params
$params = array('login_id' => $login_id, 'user_name' => $user_name, 'warehouse_id' => $warehouse_id, 'e_mail' => $e_mail, 'kengen_flg' => $kengen_flg, 'user_pwd' => $user_pwd, 'company_id' => $company_id, 'role_id' => $role_id, 'default_locale' => $default_locale, 'upd_uid' => $s_user_id, 'crt_uid' => $s_user_id, 'upd_pgm' => get_class(), 'crt_pgm' => get_class());
// dao insert
$userDao->UserMst_Insert($params);
// commit
$userDao->CommitTransaction();
if ($pwd_settei == 1) {
$params = array('login_id' => $login_id, 'user_name' => $user_name, 'email' => $e_mail, 'user_pwd' => $raw_user_pwd, 'url' => $this->config->get('url'), 'current_locale' => $default_locale);
Util::sendPasswordMail($params);
}
} catch (Exception $e) {
$userDao->AbortTransaction();
$this->logger->log(LOG_DEBUG, $e->getTraceAsString());
return array(500, $e->getMessage());
}
exit;
}
示例7: check_role_id_exists
/**
* リクエストの商品コードがDBに登録されているかチェックする
* @param string $name フォーム名
*/
public function check_role_id_exists($name)
{
// 商品を取得
$params = array('company_id' => $this->backend->getSession()->get('company_id'), 'role_id' => $this->form_vars['role_id']);
$role = DaoFactory::RoleMst()->Retrieve(' company_id = ? AND role_id = ? ', $params);
// 商品が存在しない場合
if (empty($role)) {
$this->ae->add($name, "入力された{form}は登録されていません", E_FORM_INVALIDCHAR);
}
}
示例8: 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;
}