Changeset 20260
- Timestamp:
- 2011/02/20 19:36:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/admin/system/LC_Page_Admin_System_Input.php
r20041 r20260 47 47 $this->tpl_mainpage = 'system/input.tpl'; 48 48 49 // ページ送り用ナンバーの取得50 $this->tpl_pageno = isset($_REQUEST['pageno']) ? $_REQUEST['pageno'] : 1;51 52 49 // マスタ-データから権限配列を取得 53 50 $masterData = new SC_DB_MasterData_Ex(); … … 78 75 // トランザクショントークンの取得 79 76 $this->transactionid = SC_Helper_Session_Ex::getToken(); 77 78 // ページ送りの処理 $_REQUEST['pageno']が信頼しうる値かどうかチェックする。 79 $this->tpl_pageno = $this->lfCheckPageNo($_REQUEST['pageno']); 80 80 81 81 switch($this->getMode()) { … … 88 88 break; 89 89 90 case 'parent_reload':91 $this->execParentReloadMode();92 // defaultアクションも実行させるためbreakしない93 94 90 default: 95 91 $this->execDefaultMode(); … … 120 116 } 121 117 122 $this-> initNewMode();118 $this->objForm = $this->initNewMode(); 123 119 124 120 $arrErr = $this->validateNewMode(); 121 122 $this->arrForm = $this->objForm->getHashArray(); 125 123 126 124 if (count($arrErr) > 0) { 127 125 // 入力された値を保持する 128 126 $this->tpl_mode = $this->getMode(); 129 $this->tpl_member_id = $_POST['member_id'];130 $this->tpl_old_login_id = $_POST['old_login_id'];131 $this->arrForm = $this->objForm->getHashArray(); 127 $this->tpl_member_id = ''; 128 $this->tpl_old_login_id = ''; 129 132 130 // パスワードは保持しない 133 131 $this->arrForm['password'] = ''; … … 139 137 } 140 138 141 $this->insertMemberData($this-> objForm->getHashArray());139 $this->insertMemberData($this->arrForm); 142 140 // 親ウィンドウを更新後、自ウィンドウを閉じる。 143 $url = ADMIN_SYSTEM_URLPATH . "?pageno=" . $ _POST['pageno'];141 $url = ADMIN_SYSTEM_URLPATH . "?pageno=" . $this->arrForm['pageno']; 144 142 $this->tpl_onload = "fnUpdateParent('".$url."'); window.close();"; 145 143 } … … 149 147 * SC_FormParamのインスタンスをメンバ変数にセットする. 150 148 * 151 * @param void152 * @return void149 * @param string $mode editの時は指定 150 * @return object SC_FormParamのインスタンス 153 151 */ 154 152 function initNewMode($mode = "") { 155 153 $objForm = new SC_FormParam(); 156 154 155 $objForm->addParam('メンバーID', 'member_id', INT_LEN, 'n', array('NUM_CHECK')); 157 156 $objForm->addParam('名前', 'name', STEXT_LEN, 'KV', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); 158 157 $objForm->addParam('所属', 'department', STEXT_LEN, 'KV', array('MAX_LENGTH_CHECK')); 159 158 $objForm->addParam('ログインID', 'login_id', '' , '', array('EXIST_CHECK', 'ALNUM_CHECK')); 159 $objForm->addParam('変更前ログインID', 'old_login_id', '' , '', array('ALNUM_CHECK')); 160 160 if ($mode == "edit" && $_POST['password'] == DEFAULT_PASSWORD) { 161 161 $objForm->addParam('パスワード', 'password', '' , '', array('EXIST_CHECK')); … … 165 165 $objForm->addParam('権限', 'authority', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); 166 166 $objForm->addParam('稼働/非稼働', 'work', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); 167 $objForm->addParam('ページ', 'pageno', INT_LEN, 'n', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); 167 168 168 169 $objForm->setParam($_POST); 169 170 $objForm->convParam(); 170 171 171 $this->objForm =$objForm;172 return $objForm; 172 173 } 173 174 … … 213 214 } 214 215 215 $this-> initNewMode("edit");216 $this->objForm = $this->initNewMode("edit"); 216 217 217 218 $arrErr = $this->validateEditMode(); 219 220 $this->arrForm = $this->objForm->getHashArray(); 218 221 219 222 if (count($arrErr) > 0) { 220 223 // 入力された値を保持する 221 224 $this->tpl_mode = $this->getMode(); 222 $this->tpl_member_id = $ _POST['member_id'];223 $this->tpl_old_login_id = $ _POST['old_login_id'];224 $this->arrForm = $this->objForm->getHashArray(); 225 $this->tpl_member_id = $this->arrForm['member_id']; 226 $this->tpl_old_login_id = $this->arrForm['old_login_id']; 227 225 228 // パスワードは保持しない 226 229 $this->arrForm['password'] = ''; … … 232 235 } 233 236 234 $this->updateMemberData($ _POST['member_id'], $this->objForm->getHashArray());237 $this->updateMemberData($this->arrForm['member_id'], $this->arrForm); 235 238 // 親ウィンドウを更新後、自ウィンドウを閉じる。 236 $url = ADMIN_SYSTEM_URLPATH . "?pageno=" . $ _POST['pageno'];239 $url = ADMIN_SYSTEM_URLPATH . "?pageno=" . $this->arrForm['pageno']; 237 240 $this->tpl_onload = "fnUpdateParent('".$url."'); window.close();"; 238 241 } … … 267 270 268 271 /** 269 * parent_reloadアクションを実行する.270 * テンプレートに親windowをリロードするjavascriptをセットする.271 *272 * @param void273 * @return void274 */275 function execParentReloadMode() {276 $url = ADMIN_SYSTEM_URLPATH;277 $this->tpl_onload = "fnUpdateParent('$url')";278 }279 280 /**281 272 * defaultアクションを実行する. 282 273 * 初回表示時に実行される. … … 288 279 */ 289 280 function execDefaultMode() { 290 // $_GET['id']があれば編集モードで表示する 291 if (isset($_GET['id']) && SC_Utils::sfIsInt($_GET['id'])) { 292 $this->tpl_mode = 'edit'; 293 $this->tpl_member_id = $_GET['id']; 281 282 // $_GET['id'](member_id)が登録済みのものかチェック。 283 // 登録されていない場合は不正なものとして、新規扱いとする。 284 $clean_id = ""; 285 $clean_mode_flg = "new"; 286 287 // idが0より大きい数字で整数の場合 288 if (isset($_GET['id']) && SC_Utils::sfIsInt($_GET['id']) && $_GET['id'] > 0) { 289 if ($this->memberDataExists('member_id = ? AND del_flg = 0', $_GET['id'])) { 290 $clean_id = $_GET['id']; 291 $clean_mode_flg = "edit"; 292 } 293 } 294 295 switch($clean_mode_flg) { 296 case 'edit': 297 $this->tpl_mode = $clean_mode_flg; 298 $this->tpl_member_id = $clean_id; 294 299 $this->tpl_onfocus = "fnClearText(this.name);"; 295 $this->arrForm = $this->getMemberData($ _GET['id']);300 $this->arrForm = $this->getMemberData($clean_id); 296 301 $this->arrForm['password'] = DEFAULT_PASSWORD; 297 302 $this->tpl_old_login_id = $this->arrForm['login_id']; 298 // 新規作成モードで表示 299 } else { 300 $this->tpl_mode = "new"; 303 break; 304 305 case 'new': 306 default: 307 $this->tpl_mode = $clean_mode_flg; 301 308 $this->arrForm['authority'] = -1; 309 break; 302 310 } 303 311 } … … 314 322 $where = 'member_id = ?'; 315 323 316 $objQuery = new SC_Query();324 $objQuery =& SC_Query::getSingletonInstance(); 317 325 $arrRet = $objQuery->select($columns, $table, $where, array($id)); 318 326 … … 332 340 $table = 'dtb_member'; 333 341 334 $objQuery = new SC_Query();342 $objQuery =& SC_Query::getSingletonInstance(); 335 343 $count = $objQuery->count($table, $where, array($val)); 336 344 … … 340 348 341 349 /** 350 * ページ番号が信頼しうる値かチェックする. 351 * 352 * @access private 353 * @param integer $pageno ページの番号 354 * @return integer $clean_pageno チェック後のページの番号 355 */ 356 function lfCheckPageNo($pageno) { 357 358 $clean_pageno = ""; 359 360 // $pagenoが0以上の整数かチェック 361 if(SC_Utils_Ex::sfIsInt($pageno) && $pageno > 0) { 362 $clean_pageno = $pageno; 363 } 364 365 // 例外は全て1とする 366 else { 367 $clean_pageno = 1; 368 } 369 370 return $clean_pageno; 371 } 372 373 /** 342 374 * 入力された管理者データをInsertする. 343 375 * … … 346 378 */ 347 379 function insertMemberData($arrMemberData) { 348 $objQuery = new SC_Query();380 $objQuery =& SC_Query::getSingletonInstance(); 349 381 350 382 // INSERTする値を作成する. … … 376 408 */ 377 409 function updateMemberData($member_id, $arrMemberData) { 378 $objQuery = new SC_Query();410 $objQuery =& SC_Query::getSingletonInstance(); 379 411 380 412 // Updateする値を作成する.
Note: See TracChangeset
for help on using the changeset viewer.
