Changeset 20155
- Timestamp:
- 2011/02/12 14:44:10 (13 years ago)
- Location:
- branches/version-2_5-dev/data
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/Smarty/templates/default/mypage/index.tpl
r20116 r20155 33 33 <form name="form1" method="post" action="?"> 34 34 <input type="hidden" name="order_id" value="" /> 35 <input type="hidden" name="pageno" value="<!--{$ tpl_pageno}-->" />35 <input type="hidden" name="pageno" value="<!--{$objNavi->nowpage}-->" /> 36 36 <h3><!--{$tpl_subtitle|h}--></h3> 37 37 38 <!--{if $ tpl_linemax> 0}-->38 <!--{if $objNavi->all_row > 0}--> 39 39 40 <p><!--{$ tpl_linemax}-->件の購入履歴があります。</p>40 <p><!--{$objNavi->all_row}-->件の購入履歴があります。</p> 41 41 <div> 42 42 <!--▼ページナビ--> 43 <!--{$ tpl_strnavi}-->43 <!--{$objNavi->strnavi}--> 44 44 <!--▲ページナビ--> 45 45 </div> -
branches/version-2_5-dev/data/Smarty/templates/mobile/mypage/index.tpl
r20116 r20155 35 35 <hr> 36 36 ■購入履歴一覧<br> 37 <!--{if $ tpl_linemax> 0}-->38 <!--{$ tpl_linemax}-->件の購入履歴があります。<br>37 <!--{if $objNavi->all_row > 0}--> 38 <!--{$objNavi->all_row}-->件の購入履歴があります。<br> 39 39 <!--{section name=cnt loop=$arrOrder}--> 40 40 <hr> … … 55 55 <!--{/if}--> 56 56 57 <!--{if $ tpl_strnavi != ""}-->58 <!--{$ tpl_strnavi}-->57 <!--{if $objNavi->strnavi != ""}--> 58 <!--{$objNavi->strnavi}--> 59 59 <br> 60 60 <!--{/if}--> -
branches/version-2_5-dev/data/Smarty/templates/sphone/mypage/index.tpl
r20116 r20155 33 33 <form name="form1" method="post" action="?"> 34 34 <input type="hidden" name="order_id" value="" /> 35 <input type="hidden" name="pageno" value="<!--{$ tpl_pageno}-->" />35 <input type="hidden" name="pageno" value="<!--{$objNavi->nowpage}-->" /> 36 36 <h3><!--{$tpl_subtitle|h}--></h3> 37 37 38 <!--{if $ tpl_linemax> 0}-->38 <!--{if $objNavi->all_row > 0}--> 39 39 40 <p><!--{$ tpl_linemax}-->件の購入履歴があります。</p>40 <p><!--{$objNavi->all_row}-->件の購入履歴があります。</p> 41 41 <div> 42 42 <!--▼ページナビ--> 43 <!--{$ tpl_strnavi}-->43 <!--{$objNavi->all_row}--> 44 44 <!--▲ページナビ--> 45 45 </div> -
branches/version-2_5-dev/data/class/SC_PageNavi.php
r18701 r20155 42 42 43 43 // コンストラクタ 44 function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX, $urlParam = '' ) {44 function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX, $urlParam = '', $display_number = true) { 45 45 $this->arrPagenavi['mode'] = 'search'; 46 46 47 47 //現在ページ($now_page)が正しい数値でない場合 48 if (! eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || strlen($now_page) == 0) {48 if (!preg_match("/^[[:digit:]]+$/", $now_page) || $now_page < 1 || strlen($now_page) == 0) { 49 49 $this->now_page = 1; 50 50 } else { 51 $this->now_page = $now_page;51 $this->now_page = htmlspecialchars($now_page, ENT_QUOTES, CHAR_CODE); 52 52 } 53 53 $this->arrPagenavi['now_page'] = $this->now_page; … … 61 61 } 62 62 63 $this->start_row = ($this->now_page - 1) * $page_row; 63 $this->start_row = ($this->now_page - 1) * $page_row; 64 $this->all_row = $all_row; 64 65 65 66 // 開始行が不正な場合 … … 137 138 138 139 if ($before || $next) { 139 $this->strnavi = $before . $page_number.$next;140 $this->strnavi = $before .(($display_number) ? $page_number : ' | ') .$next; 140 141 } 141 142 } else { -
branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage.php
r20148 r20155 49 49 function init() { 50 50 parent::init(); 51 $this->tpl_ title = 'MYページ';52 if ( Net_UserAgent_Mobile::isMobile() === true){51 $this->tpl_mypageno = 'index'; 52 if (SC_Display::detectDevice() === DEVICE_TYPE_MOBILE){ 53 53 $this->tpl_subtitle = 'MYページ'; 54 54 } else { 55 55 $this->tpl_subtitle = '購入履歴一覧'; 56 56 } 57 $this->tpl_navi = TEMPLATE_REALDIR . 'mypage/navi.tpl';58 $this->tpl_mainno = 'mypage';59 $this->tpl_mypageno = 'index';60 57 $this->httpCacheControl('nocache'); 61 58 } … … 77 74 function action() { 78 75 79 $objQuery = new SC_Query();80 76 $objCustomer = new SC_Customer(); 77 $customer_id = $objCustomer->getvalue('customer_id'); 81 78 82 79 //ページ送り用 83 if (isset($_POST['pageno'])) { 84 $this->tpl_pageno = htmlspecialchars($_POST['pageno'], ENT_QUOTES, CHAR_CODE); 85 } 80 $this->objNavi = new SC_PageNavi($_REQUEST['pageno'], 81 $this->lfGetOrderHistory($customer_id), 82 SEARCH_PMAX, 83 "fnNaviPage", 84 NAVI_PMAX, 85 'pageno=#page#', 86 SC_Display::detectDevice() !== DEVICE_TYPE_MOBILE); 86 87 87 $col = "order_id, create_date, payment_id, payment_total"; 88 $from = "dtb_order"; 89 $where = "del_flg = 0 AND customer_id=?"; 90 $arrval = array($objCustomer->getvalue('customer_id')); 91 $order = "order_id DESC"; 92 93 $linemax = $objQuery->count($from, $where, $arrval); 94 $this->tpl_linemax = $linemax; 95 96 if (Net_UserAgent_Mobile::isMobile() === true){ 97 define ("HISTORY_NUM", 5); // TODO 98 $pageNo = isset($_GET['pageno']) ? (int) $_GET['pageno'] : 0; // TODO 99 100 // ページ送りの取得 101 // next 102 if ($pageNo + HISTORY_NUM < $linemax) { 103 $next = "<a href='?pageno=" . ($pageNo + HISTORY_NUM) . "'>次へ→</a>"; 104 } else { 105 $next = ""; 106 } 107 108 // previous 109 if ($pageNo - HISTORY_NUM > 0) { 110 $previous = "<a href='?pageno=" . ($pageNo - HISTORY_NUM) . "'>←前へ</a>"; 111 } elseif ($pageNo == 0) { 112 $previous = ""; 113 } else { 114 $previous = "<a href='?pageno=0'>←前へ</a>"; 115 } 116 117 // bar 118 if ($next != '' && $previous != '') { 119 $bar = " | "; 120 } else { 121 $bar = ""; 122 } 123 124 $this->tpl_strnavi = $previous . $bar . $next; 125 126 // 取得範囲の指定(開始行番号、行数のセット) 127 $objQuery->setLimitOffset(HISTORY_NUM, $pageNo); 128 } else { 129 // ページ送りの取得 130 $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX); 131 $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 132 $startno = $objNavi->start_row; 133 134 // 取得範囲の指定(開始行番号、行数のセット) 135 $objQuery->setLimitOffset(SEARCH_PMAX, $startno); 136 } 137 138 // 表示順序 139 $objQuery->setOrder($order); 140 141 //購入履歴の取得 142 $this->arrOrder = $objQuery->select($col, $from, $where, $arrval); 88 $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row); 143 89 144 90 // 支払い方法の取得 145 $objDb = new SC_Helper_DB_Ex(); 146 $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); 147 91 $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); 148 92 } 149 93 … … 156 100 parent::destroy(); 157 101 } 102 103 104 /** 105 * 受注履歴を返す 106 * 107 * @param mixed $customer_id 108 * @param mixed $startno 0以上の場合は受注履歴を返却する -1の場合は件数を返す 109 * @access private 110 * @return void 111 */ 112 function lfGetOrderHistory($customer_id, $startno = -1) { 113 $objQuery = SC_Query::getSingletonInstance(); 114 115 $col = "order_id, create_date, payment_id, payment_total"; 116 $from = "dtb_order"; 117 $where = "del_flg = 0 AND customer_id = ?"; 118 $arrval = array($customer_id); 119 $order = "order_id DESC"; 120 121 if ($startno == -1) { 122 return $objQuery->count($from, $where, $arrval); 123 } 124 125 $objQuery->setLimitOffset(SEARCH_PMAX, $startno); 126 // 表示順序 127 $objQuery->setOrder($order); 128 129 //購入履歴の取得 130 return $objQuery->select($col, $from, $where, $arrval); 131 } 158 132 }
Note: See TracChangeset
for help on using the changeset viewer.