Changeset 18031
- Timestamp:
- 2009/05/30 23:48:56 (14 years ago)
- Location:
- branches/comu-ver2/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/Smarty/templates/default/admin/products/review_edit.tpl
r17997 r18031 24 24 <form name="form1" id="form1" method="post" action="?" > 25 25 <input type="hidden" name="mode" value="complete" /> 26 <input type="hidden" name="review_id" value="<!--{$tpl_review_id}-->" /> 27 <input type="hidden" name="pre_status" value="<!--{$tpl_pre_status}-->" /> 28 <!--{foreach key=key item=item from=$arrReview}--> 29 <!--{if $key ne "mode"}--> 30 <input type="hidden" name="<!--{$key}-->" value="<!--{$item|escape}-->" /> 31 <!--{/if}--> 32 <!--{/foreach}--> 26 <input type="hidden" name="review_id" value="<!--{$arrReview.review_id|escape}-->" /> 33 27 <!--{foreach key=key item=item from=$arrSearchHidden}--> 34 28 <input type="hidden" name="<!--{$key}-->" value="<!--{$item|escape}-->" /> -
branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_ReviewEdit.php
r17109 r18031 67 67 SC_Utils_Ex::sfIsSuccess($objSess); 68 68 69 // 検索ワードの引継ぎ69 // 検索ワードの引継ぎ 70 70 foreach ($_POST as $key => $val){ 71 71 if (ereg("^search_", $key)){ … … 74 74 } 75 75 76 //取得文字列の変換用カラム 77 $arrRegistColumn = array ( 78 array( "column" => "update_date"), 79 array( "column" => "status"), 80 array( "column" => "recommend_level"), 81 array( "column" => "title","convert" => "KVa"), 82 array( "column" => "comment","convert" => "KVa"), 83 array( "column" => "reviewer_name","convert" => "KVa"), 84 array( "column" => "reviewer_url","convert" => "KVa"), 85 array( "column" => "sex","convert" => "n") 86 87 ); 88 89 //レビューIDを渡す 90 $this->tpl_review_id = isset($_POST['review_id']) ? $_POST['review_id'] : ""; 91 //レビュー情報のカラムの取得 92 $this->arrReview = $this->lfGetReviewData($this->tpl_review_id); 93 //登録済みのステータスを渡す 94 $this->tpl_pre_status = $this->arrReview['status']; 95 //商品ごとのレビュー表示数取得 96 $count = $this->objQuery->count("dtb_review", "del_flg=0 AND status=1 AND product_id=?", array($this->arrReview['product_id'])); 97 //両方選択可能 76 // 両方選択可能 98 77 $this->tpl_status_change = true; 99 78 100 79 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 101 switch($_POST['mode']) { 102 //登録 103 case 'complete': 104 //フォーム値の変換 105 $arrReview = $this->lfConvertParam($_POST, $arrRegistColumn); 106 $this->arrErr = $this->lfCheckError($arrReview); 107 //エラー無し 108 if (!$this->arrErr){ 109 //レビュー情報の編集登録 110 $this->lfRegistReviewData($arrReview, $arrRegistColumn); 111 $this->arrReview = $arrReview; 112 $this->tpl_onload = "confirm('登録が完了しました。');"; 113 } 114 break; 115 default: 116 break; 80 switch ($_POST['mode']) { 81 // 登録 82 case 'complete': 83 // 取得文字列の変換用カラム 84 $arrRegistColumn = array ( 85 array("column" => "status"), 86 array("column" => "recommend_level"), 87 array("column" => "title", "convert" => "KVa"), 88 array("column" => "comment", "convert" => "KVa"), 89 array("column" => "reviewer_name", "convert" => "KVa"), 90 array("column" => "reviewer_url", "convert" => "KVa"), 91 array("column" => "sex", "convert" => "n") 92 ); 93 94 // フォーム値の変換 95 $arrReview = $this->lfConvertParam($_POST, $arrRegistColumn); 96 $this->arrErr = $this->lfCheckError($arrReview); 97 98 // エラー有り 99 if ($this->arrErr) { 100 // 入力内容を引き継ぐ 101 $this->arrReview = $arrReview; 102 } 103 // エラー無し 104 else { 105 // レビュー情報の更新 106 $this->lfRegistReviewData($arrReview, $arrRegistColumn); 107 108 // レビュー情報のDB取得 109 $this->arrReview = $this->lfGetReviewData($arrReview['review_id']); 110 111 $this->tpl_onload = "alert('登録が完了しました。');"; 112 } 113 break; 114 115 default: 116 // レビュー情報のDB取得 117 $this->arrReview = $this->lfGetReviewData($_POST['review_id']); 118 break; 117 119 } 118 120 … … 131 133 132 134 133 // 入力エラーチェック 134 function lfCheckError($array) { 135 $objErr = new SC_CheckError($array); 135 /** 136 * 入力エラーチェック 137 * 138 */ 139 function lfCheckError($arrReview) { 140 $objErr = new SC_CheckError($arrReview); 136 141 $objErr->doFunc(array("おすすめレベル", "recommend_level"), array("SELECT_CHECK")); 137 142 $objErr->doFunc(array("タイトル", "title", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); … … 143 148 } 144 149 145 //---- 取得文字列の変換 150 /** 151 * 取得文字列の変換 152 * 153 */ 146 154 function lfConvertParam($array, $arrRegistColumn) { 147 155 /* … … 169 177 } 170 178 171 //レビュー情報の取得 179 /** 180 * レビュー情報のDB取得 181 * 182 */ 172 183 function lfGetReviewData($review_id){ 173 184 $select="review_id, A.product_id, reviewer_name, sex, recommend_level, "; … … 176 187 $where = "A.del_flg = 0 AND B.del_flg = 0 AND review_id = ? "; 177 188 $arrReview = $this->objQuery->select($select, $from, $where, array($review_id)); 178 if(!empty($arrReview)) { 179 $this->arrReview = $arrReview[0]; 180 } else { 189 190 if (empty($arrReview)) { 181 191 SC_Utils_Ex::sfDispError(""); 182 192 } 183 return $this->arrReview; 184 } 185 186 //レビュー情報の編集登録 187 function lfRegistReviewData($array, $arrRegistColumn){ 193 194 return $arrReview[0]; 195 } 196 197 /** 198 * レビュー情報の更新 199 * 200 */ 201 function lfRegistReviewData($arrReview, $arrRegistColumn){ 188 202 foreach ($arrRegistColumn as $data) { 189 if (strlen($array[ $data["column"] ]) > 0 ) { 190 $arrRegist[ $data["column"] ] = $array[ $data["column"] ]; 191 } 192 if ($data['column'] == 'update_date'){ 193 $arrRegist['update_date'] = 'now()'; 194 } 195 } 196 //登録実行 197 $this->objQuery->begin(); 198 $this->objQuery->update("dtb_review", $arrRegist, "review_id='".$_POST['review_id']."'"); 199 $this->objQuery->commit(); 203 $arrRegist[ $data["column"] ] = $arrReview[ $data["column"] ]; 204 } 205 $arrRegist['update_date'] = 'now()'; 206 207 // 更新実行 208 $this->objQuery->update("dtb_review", $arrRegist, "review_id = ?", array($arrReview['review_id'])); 200 209 } 201 210 }
Note: See TracChangeset
for help on using the changeset viewer.