- Timestamp:
- 2007/07/20 15:58:59 (17 years ago)
- Location:
- branches/feature-module-update
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update
-
Property
svn:ignore
set to
.cache
.settings
.projectOptions
-
Property
svn:ignore
set to
-
branches/feature-module-update/html/admin/products/classcategory.php
r12157 r15078 17 17 $this->tpl_subnavi = 'products/subnavi.tpl'; 18 18 $this->tpl_subno = 'class'; 19 $this->tpl_subtitle = ' µ¬³ÊÅÐÏ¿';19 $this->tpl_subtitle = '規格登録'; 20 20 $this->tpl_mainno = 'products'; 21 21 } … … 27 27 $objQuery = new SC_Query(); 28 28 29 // ǧ¾Ú²ÄÈݤÎȽÄê29 // 認証可否の判定 30 30 $objSess = new SC_Session(); 31 31 sfIsSuccess($objSess); … … 33 33 $get_check = false; 34 34 35 // µ¬³ÊID¤Î¥Á¥§¥Ã¥¯35 // 規格IDのチェック 36 36 if(sfIsInt($_GET['class_id'])) { 37 // µ¬³Ê̾¤Î¼èÆÀ37 // 規格名の取得 38 38 $objPage->tpl_class_name = $objQuery->get("dtb_class", "name", "class_id = ?", array($_GET['class_id'])); 39 39 if($objPage->tpl_class_name != "") { 40 // µ¬³ÊID¤Î°ú¤·Ñ¤®40 // 規格IDの引き継ぎ 41 41 $objPage->arrHidden['class_id'] = $_GET['class_id']; 42 42 $get_check = true; … … 45 45 46 46 if(!$get_check) { 47 // µ¬³ÊÅÐÏ¿¥Ú¡¼¥¸¤ËÈô¤Ð¤¹¡£47 // 規格登録ページに飛ばす。 48 48 header("Location: " . URL_CLASS_REGIST); 49 49 exit; 50 50 } 51 51 52 // ¿·µ¬ºîÀ® or ÊÔ½¸52 // 新規作成 or 編集 53 53 switch($_POST['mode']) { 54 // ÅÐÏ¿¥Ü¥¿¥ó²¡²¼54 // 登録ボタン押下 55 55 case 'edit': 56 // POST Ãͤΰú¤·Ñ¤®56 // POST値の引き継ぎ 57 57 $objPage->arrForm = $_POST; 58 // ÆþÎÏʸ»ú¤ÎÊÑ´¹58 // 入力文字の変換 59 59 $_POST = lfConvertParam($_POST); 60 // ¥¨¥é¡¼¥Á¥§¥Ã¥¯60 // エラーチェック 61 61 $objPage->arrErr = lfErrorCheck(); 62 62 if(count($objPage->arrErr) <= 0) { 63 63 if($_POST['classcategory_id'] == "") { 64 lfInsertClass(); // DB ¤Ø¤Î½ñ¤¹þ¤ß64 lfInsertClass(); // DBへの書き込み 65 65 } else { 66 lfUpdateClass(); // DB ¤Ø¤Î½ñ¤¹þ¤ß66 lfUpdateClass(); // DBへの書き込み 67 67 } 68 // ºÆɽ¼¨68 // 再表示 69 69 sfReload("class_id=" . $_GET['class_id']); 70 70 } else { 71 // POST ¥Ç¡¼¥¿¤ò°ú¤·Ñ¤°71 // POSTデータを引き継ぐ 72 72 $objPage->tpl_classcategory_id = $_POST['classcategory_id']; 73 73 } 74 74 break; 75 // ºï½ü75 // 削除 76 76 case 'delete': 77 // ¥é¥ó¥¯ÉÕ¤¥ì¥³¡¼¥É¤Îºï½ü77 // ランク付きレコードの削除 78 78 $where = "class_id = " . addslashes($_POST['class_id']); 79 79 sfDeleteRankRecord("dtb_classcategory", "classcategory_id", $_POST['classcategory_id'], $where, true); 80 80 break; 81 // ÊÔ½¸Á°½èÍý81 // 編集前処理 82 82 case 'pre_edit': 83 // ÊÔ½¸¹àÌܤòDB¤è¤ê¼èÆÀ¤¹¤ë¡£83 // 編集項目をDBより取得する。 84 84 $where = "classcategory_id = ?"; 85 85 $name = $objQuery->get("dtb_classcategory", "name", $where, array($_POST['classcategory_id'])); 86 // ÆþÎϹàÌܤ˥«¥Æ¥´¥ê̾¤òÆþÎϤ¹¤ë¡£86 // 入力項目にカテゴリ名を入力する。 87 87 $objPage->arrForm['name'] = $name; 88 // POST ¥Ç¡¼¥¿¤ò°ú¤·Ñ¤°88 // POSTデータを引き継ぐ 89 89 $objPage->tpl_classcategory_id = $_POST['classcategory_id']; 90 90 break; … … 101 101 } 102 102 103 // µ¬³ÊʬÎà¤ÎÆɹþ103 // 規格分類の読込 104 104 $where = "del_flg <> 1 AND class_id = ?"; 105 105 $objQuery->setorder("rank DESC"); … … 111 111 //----------------------------------------------------------------------------------------------------------------------------- 112 112 113 /* DB ¤Ø¤ÎÁÞÆþ*/113 /* DBへの挿入 */ 114 114 function lfInsertClass() { 115 115 $objQuery = new SC_Query(); 116 116 $objQuery->begin(); 117 // ¿Æµ¬³ÊID¤Î¸ºß¥Á¥§¥Ã¥¯117 // 親規格IDの存在チェック 118 118 $where = "del_flg <> 1 AND class_id = ?"; 119 119 $ret = $objQuery->get("dtb_class", "class_id", $where, array($_POST['class_id'])); 120 120 if($ret != "") { 121 // INSERT ¤¹¤ëÃͤòºîÀ®¤¹¤ë¡£121 // INSERTする値を作成する。 122 122 $sqlval['name'] = $_POST['name']; 123 123 $sqlval['class_id'] = $_POST['class_id']; … … 126 126 $sqlval['create_date'] = "now()"; 127 127 $sqlval['update_date'] = "now()"; 128 // INSERT ¤Î¼Â¹Ô128 // INSERTの実行 129 129 $ret = $objQuery->insert("dtb_classcategory", $sqlval); 130 130 } … … 133 133 } 134 134 135 /* DB ¤Ø¤Î¹¹¿·*/135 /* DBへの更新 */ 136 136 function lfUpdateClass() { 137 137 $objQuery = new SC_Query(); 138 // UPDATE ¤¹¤ëÃͤòºîÀ®¤¹¤ë¡£138 // UPDATEする値を作成する。 139 139 $sqlval['name'] = $_POST['name']; 140 140 $sqlval['update_date'] = "Now()"; 141 141 $where = "classcategory_id = ?"; 142 // UPDATE ¤Î¼Â¹Ô142 // UPDATEの実行 143 143 $ret = $objQuery->update("dtb_classcategory", $sqlval, $where, array($_POST['classcategory_id'])); 144 144 return $ret; 145 145 } 146 146 147 /* ¼èÆÀʸ»úÎó¤ÎÊÑ´¹*/147 /* 取得文字列の変換 */ 148 148 function lfConvertParam($array) { 149 // ʸ»úÊÑ´¹149 // 文字変換 150 150 $arrConvList['name'] = "KVa"; 151 151 152 152 foreach ($arrConvList as $key => $val) { 153 // POST ¤µ¤ì¤Æ¤¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£153 // POSTされてきた値のみ変換する。 154 154 if(isset($array[$key])) { 155 155 $array[$key] = mb_convert_kana($array[$key] ,$val); … … 159 159 } 160 160 161 /* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯*/161 /* 入力エラーチェック */ 162 162 function lfErrorCheck() { 163 163 $objErr = new SC_CheckError(); 164 $objErr->doFunc(array(" ʬÎà̾", "name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));164 $objErr->doFunc(array("分類名", "name", STEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK")); 165 165 if(!isset($objErr->arrErr['name'])) { 166 166 $objQuery = new SC_Query(); 167 167 $where = "class_id = ? AND name = ?"; 168 168 $arrRet = $objQuery->select("classcategory_id, name", "dtb_classcategory", $where, array($_GET['class_id'], $_POST['name'])); 169 // ÊÔ½¸Ãæ¤Î¥ì¥³¡¼¥É°Ê³°¤ËƱ¤¸Ì¾¾Î¤¬Â¸ºß¤¹¤ë¾ì¹ç169 // 編集中のレコード以外に同じ名称が存在する場合 170 170 if ($arrRet[0]['classcategory_id'] != $_POST['classcategory_id'] && $arrRet[0]['name'] == $_POST['name']) { 171 $objErr->arrErr['name'] = " ¢¨ ´û¤ËƱ¤¸ÆâÍƤÎÅÐÏ¿¤¬Â¸ºß¤·¤Þ¤¹¡£<br>";171 $objErr->arrErr['name'] = "※ 既に同じ内容の登録が存在します。<br>"; 172 172 } 173 173 }
Note: See TracChangeset
for help on using the changeset viewer.