| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * http://www.lockon.co.jp/
|
|---|
| 6 | */
|
|---|
| 7 | require_once("../require.php");
|
|---|
| 8 |
|
|---|
| 9 | class LC_Page {
|
|---|
| 10 |
|
|---|
| 11 | function LC_Page() {
|
|---|
| 12 | $this->tpl_mainpage = 'contents/recomend.tpl';
|
|---|
| 13 | $this->tpl_mainno = 'contents';
|
|---|
| 14 | $this->tpl_subnavi = 'contents/subnavi.tpl';
|
|---|
| 15 | $this->tpl_subno = "recommend";
|
|---|
| 16 | $this->tpl_subtitle = '¥ª¥¹¥¹¥á´ÉÍý';
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | $conn = new SC_DBConn();
|
|---|
| 21 | $objPage = new LC_Page();
|
|---|
| 22 | $objView = new SC_AdminView();
|
|---|
| 23 | $objSess = new SC_Session();
|
|---|
| 24 |
|
|---|
| 25 | $arrRegistColumn = array(
|
|---|
| 26 | array( "column" => "product_id", "convert" => "n" ),
|
|---|
| 27 | array( "column" => "category_id", "convert" => "n" ),
|
|---|
| 28 | array( "column" => "rank", "convert" => "n" ),
|
|---|
| 29 | array( "column" => "title", "convert" => "aKV" ),
|
|---|
| 30 | array( "column" => "comment", "convert" => "aKV" ),
|
|---|
| 31 | );
|
|---|
| 32 |
|
|---|
| 33 | // ǧ¾Ú²ÄÈݤÎȽÄê
|
|---|
| 34 | sfIsSuccess($objSess);
|
|---|
| 35 |
|
|---|
| 36 | //ºÇÂçÅÐÏ¿¿ô¤Îɽ¼¨
|
|---|
| 37 | $objPage->tpl_disp_max = RECOMMEND_NUM;
|
|---|
| 38 |
|
|---|
| 39 | // ÅÐÏ¿»þ
|
|---|
| 40 | if ( $_POST['mode'] == 'regist' ){
|
|---|
| 41 |
|
|---|
| 42 | // ÆþÎÏʸ»ú¤Î¶¯À©ÊÑ´¹
|
|---|
| 43 | $objPage->arrForm = $_POST;
|
|---|
| 44 | $objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
|
|---|
| 45 | // ¥¨¥é¡¼¥Á¥§¥Ã¥¯
|
|---|
| 46 | $objPage->arrErr[$objPage->arrForm['rank']] = lfErrorCheck();
|
|---|
| 47 | if ( ! $objPage->arrErr[$objPage->arrForm['rank']]) {
|
|---|
| 48 | // ¸Å¤¤¤Î¤ò¾Ã¤¹
|
|---|
| 49 | $sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
|
|---|
| 50 | $conn->query($sql, array($objPage->arrForm['category_id'] ,$objPage->arrForm['rank']));
|
|---|
| 51 |
|
|---|
| 52 | // £Ä£ÂÅÐÏ¿
|
|---|
| 53 | $objPage->arrForm['creator_id'] = $_SESSION['member_id'];
|
|---|
| 54 | $objPage->arrForm['update_date'] = "NOW()";
|
|---|
| 55 | $objPage->arrForm['create_date'] = "NOW()";
|
|---|
| 56 |
|
|---|
| 57 | $objQuery = new SC_Query();
|
|---|
| 58 | $objQuery->insert("dtb_best_products", $objPage->arrForm );
|
|---|
| 59 | // $conn->autoExecute("dtb_best_products", $objPage->arrForm );
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | } elseif ( $_POST['mode'] == 'delete' ){
|
|---|
| 63 | // ºï½ü»þ
|
|---|
| 64 |
|
|---|
| 65 | $sql = "DELETE FROM dtb_best_products WHERE category_id = ? AND rank = ?";
|
|---|
| 66 | $conn->query($sql, array($_POST['category_id'] ,$_POST['rank']));
|
|---|
| 67 |
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | // ¥«¥Æ¥´¥êID¼èÆÀ ̵¤¤¤È¤¤Ï¥È¥Ã¥×¥Ú¡¼¥¸
|
|---|
| 71 | if ( sfCheckNumLength($_POST['category_id']) ){
|
|---|
| 72 | $objPage->category_id = $_POST['category_id'];
|
|---|
| 73 | } else {
|
|---|
| 74 | $objPage->category_id = 0;
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | // ´û¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÆâÍÆ¤ò¼èÆÀ¤¹¤ë
|
|---|
| 78 | $sql = "SELECT B.name, B.main_list_image, A.* FROM dtb_best_products as A INNER JOIN dtb_products as B USING (product_id)
|
|---|
| 79 | WHERE A.del_flg = 0 ORDER BY rank";
|
|---|
| 80 | $arrItems = $conn->getAll($sql);
|
|---|
| 81 | foreach( $arrItems as $data ){
|
|---|
| 82 | $objPage->arrItems[$data['rank']] = $data;
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | // ¾¦ÉÊÊѹ¹»þ¤Ï¡¢ÁªÂò¤µ¤ì¤¿¾¦Éʤ˰ì»þŪ¤ËÃÖ¤´¹¤¨¤ë
|
|---|
| 86 | if ( $_POST['mode'] == 'set_item'){
|
|---|
| 87 | $sql = "SELECT product_id, name, main_list_image FROM dtb_products WHERE product_id = ? AND del_flg = 0";
|
|---|
| 88 | $result = $conn->getAll($sql, array($_POST['product_id']));
|
|---|
| 89 | if ( $result ){
|
|---|
| 90 | $data = $result[0];
|
|---|
| 91 | foreach( $data as $key=>$val){
|
|---|
| 92 | $objPage->arrItems[$_POST['rank']][$key] = $val;
|
|---|
| 93 | }
|
|---|
| 94 | $objPage->arrItems[$_POST['rank']]['rank'] = $_POST['rank'];
|
|---|
| 95 | }
|
|---|
| 96 | $objPage->checkRank = $_POST['rank'];
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 | //³Æ¥Ú¡¼¥¸¶¦ÄÌ
|
|---|
| 100 | $objPage->cnt_question = 6;
|
|---|
| 101 | $objPage->arrActive = $arrActive;
|
|---|
| 102 | $objPage->arrQuestion = $arrQuestion;
|
|---|
| 103 |
|
|---|
| 104 | // ¥«¥Æ¥´¥ê¼èÆÀ
|
|---|
| 105 | $objPage->arrCatList = sfGetCategoryList("level = 1");
|
|---|
| 106 |
|
|---|
| 107 | //----¡¡¥Ú¡¼¥¸É½¼¨
|
|---|
| 108 | $objView->assignobj($objPage);
|
|---|
| 109 | $objView->display(MAIN_FRAME);
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 | //---------------------------------------------------------------------------------------------------------------------------------------------------------
|
|---|
| 113 | //----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
|
|---|
| 114 | function lfConvertParam($array, $arrRegistColumn) {
|
|---|
| 115 |
|
|---|
| 116 | // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
|
|---|
| 117 | foreach ($arrRegistColumn as $data) {
|
|---|
| 118 | $arrConvList[ $data["column"] ] = $data["convert"];
|
|---|
| 119 | }
|
|---|
| 120 | // ʸ»úÊÑ´¹
|
|---|
| 121 | $new_array = array();
|
|---|
| 122 | foreach ($arrConvList as $key => $val) {
|
|---|
| 123 | $new_array[$key] = $array[$key];
|
|---|
| 124 | if( strlen($val) > 0) {
|
|---|
| 125 | $new_array[$key] = mb_convert_kana($new_array[$key] ,$val);
|
|---|
| 126 | }
|
|---|
| 127 | }
|
|---|
| 128 | return $new_array;
|
|---|
| 129 |
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | /* ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯ */
|
|---|
| 133 | function lfErrorCheck() {
|
|---|
| 134 | $objQuery = new SC_Query;
|
|---|
| 135 | $objErr = new SC_CheckError();
|
|---|
| 136 |
|
|---|
| 137 | $objErr->doFunc(array("¸«½Ð¤·¥³¥á¥ó¥È", "title", STEXT_LEN), array("MAX_LENGTH_CHECK"));
|
|---|
| 138 | $objErr->doFunc(array("¥ª¥¹¥¹¥á¥³¥á¥ó¥È", "comment", LTEXT_LEN), array("EXIST_CHECK","MAX_LENGTH_CHECK"));
|
|---|
| 139 |
|
|---|
| 140 | return $objErr->arrErr;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | ?> |
|---|