| 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 | function LC_Page() { |
|---|
| 11 | $this->tpl_mainpage = 'products/product_rank.tpl'; |
|---|
| 12 | $this->tpl_subnavi = 'products/subnavi.tpl'; |
|---|
| 13 | $this->tpl_mainno = 'products'; |
|---|
| 14 | $this->tpl_subno = 'product_rank'; |
|---|
| 15 | $this->tpl_subtitle = '¾¦ÉÊʤÓÂØ¤¨'; |
|---|
| 16 | } |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | $conn = new SC_DBConn(); |
|---|
| 20 | $objPage = new LC_Page(); |
|---|
| 21 | $objView = new SC_AdminView(); |
|---|
| 22 | $objSess = new SC_Session(); |
|---|
| 23 | |
|---|
| 24 | // ǧ¾Ú²ÄÈݤÎȽÄê |
|---|
| 25 | sfIsSuccess($objSess); |
|---|
| 26 | |
|---|
| 27 | $objPage->tpl_pageno = $_POST['pageno']; |
|---|
| 28 | |
|---|
| 29 | // Ä̾ï»þ¤Ï¿Æ¥«¥Æ¥´¥ê¤ò0¤ËÀßÄꤹ¤ë¡£ |
|---|
| 30 | $objPage->arrForm['parent_category_id'] = $_POST['parent_category_id']; |
|---|
| 31 | |
|---|
| 32 | switch($_POST['mode']) { |
|---|
| 33 | case 'up': |
|---|
| 34 | $where = "category_id = " . addslashes($_POST['parent_category_id']); |
|---|
| 35 | sfRankUp("dtb_products", "product_id", $_POST['product_id'], $where); |
|---|
| 36 | break; |
|---|
| 37 | case 'down': |
|---|
| 38 | $where = "category_id = " . addslashes($_POST['parent_category_id']); |
|---|
| 39 | sfRankDown("dtb_products", "product_id", $_POST['product_id'], $where); |
|---|
| 40 | break; |
|---|
| 41 | case 'move': |
|---|
| 42 | $key = "pos-".$_POST['product_id']; |
|---|
| 43 | $input_pos = mb_convert_kana($_POST[$key], "n"); |
|---|
| 44 | if(sfIsInt($input_pos)) { |
|---|
| 45 | $where = "category_id = " . addslashes($_POST['parent_category_id']); |
|---|
| 46 | sfMoveRank("dtb_products", "product_id", $_POST['product_id'], $input_pos, $where); |
|---|
| 47 | } |
|---|
| 48 | break; |
|---|
| 49 | case 'tree': |
|---|
| 50 | // ¥«¥Æ¥´¥ê¤ÎÀÚÂØ¤Ï¡¢¥Ú¡¼¥¸ÈÖ¹æ¤ò¥¯¥ê¥¢¤¹¤ë¡£ |
|---|
| 51 | $objPage->tpl_pageno = ""; |
|---|
| 52 | break; |
|---|
| 53 | default: |
|---|
| 54 | break; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | $objPage->arrTree = sfGetCatTree($_POST['parent_category_id']); |
|---|
| 58 | $objPage->arrProductsList = lfGetProduct($_POST['parent_category_id']); |
|---|
| 59 | |
|---|
| 60 | $objView->assignobj($objPage); |
|---|
| 61 | $objView->display(MAIN_FRAME); |
|---|
| 62 | |
|---|
| 63 | //----------------------------------------------------------------------------------------------------------------------------------- |
|---|
| 64 | /* ¾¦ÉÊÆÉ¤ß¹þ¤ß */ |
|---|
| 65 | function lfGetProduct($category_id) { |
|---|
| 66 | global $objPage; |
|---|
| 67 | |
|---|
| 68 | $objQuery = new SC_Query(); |
|---|
| 69 | $col = "product_id, name, main_list_image, rank, product_code"; |
|---|
| 70 | $table = "vw_products_nonclass AS noncls "; |
|---|
| 71 | $where = "del_flg = 0 AND category_id = ?"; |
|---|
| 72 | |
|---|
| 73 | // ¹Ô¿ô¤Î¼èÆÀ |
|---|
| 74 | $linemax = $objQuery->count("dtb_products", $where, array($category_id)); |
|---|
| 75 | // ½ç°Ì¡¢³ºÅö·ï¿ôɽ¼¨ÍÑ |
|---|
| 76 | $objPage->tpl_linemax = $linemax; |
|---|
| 77 | |
|---|
| 78 | $objNavi = new SC_PageNavi($objPage->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX); |
|---|
| 79 | $startno = $objNavi->start_row; |
|---|
| 80 | $objPage->tpl_strnavi = $objNavi->strnavi; // Naviɽ¼¨Ê¸»úÎó |
|---|
| 81 | $objPage->tpl_pagemax = $objNavi->max_page; // ¥Ú¡¼¥¸ºÇÂç¿ô¡Ê¡Ö¾å¤Ø²¼¤Ø¡×ɽ¼¨È½ÄêÍÑ¡Ë |
|---|
| 82 | $objPage->tpl_disppage = $objNavi->now_page; // ɽ¼¨¥Ú¡¼¥¸ÈÖ¹æ¡Ê¡Ö¾å¤Ø²¼¤Ø¡×ɽ¼¨È½ÄêÍÑ¡Ë |
|---|
| 83 | |
|---|
| 84 | // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È) |
|---|
| 85 | if(DB_TYPE != "mysql") $objQuery->setlimitoffset(SEARCH_PMAX, $startno); |
|---|
| 86 | |
|---|
| 87 | $objQuery->setorder("rank DESC"); |
|---|
| 88 | |
|---|
| 89 | // view¤â¹Ê¹þ¤ß¤ò¤«¤±¤ë(mysqlÍÑ) |
|---|
| 90 | sfViewWhere("&&noncls_where&&", $where, array($category_id), $objQuery->order . " " . $objQuery->setlimitoffset(SEARCH_PMAX, $startno, true)); |
|---|
| 91 | |
|---|
| 92 | $arrRet = $objQuery->select($col, $table, $where, array($category_id)); |
|---|
| 93 | return $arrRet; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | ?> |
|---|