Changeset 16147


Ignore:
Timestamp:
2007/09/28 13:08:06 (16 years ago)
Author:
nanasess
Message:

モバイル対応

Location:
branches/feature-module-update
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php

    r15532 r16147  
    1414 * @package Page 
    1515 * @author LOCKON CO.,LTD. 
    16  * @version $Id$ 
     16 * @version $Id:LC_Page_FrontParts_Bloc_Category.php 15532 2007-08-31 14:39:46Z nanasess $ 
    1717 */ 
    1818class LC_Page_FrontParts_Bloc_Category extends LC_Page { 
     
    4848 
    4949        $objSubView->assignobj($objPage); 
     50        $objSubView->display($this->tpl_mainpage); 
     51    } 
     52 
     53    /** 
     54     * モバイルページを初期化する. 
     55     * 
     56     * @return void 
     57     */ 
     58    function mobileInit() { 
     59        $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "frontparts/" 
     60            . BLOC_DIR . 'category.tpl'; 
     61    } 
     62 
     63    /** 
     64     * Page のプロセス(モバイル). 
     65     * 
     66     * @return void 
     67     */ 
     68    function mobileProcess() { 
     69        $objSubView = new SC_MobileView(); 
     70 
     71       $this->lfGetMainCat(true, $this); 
     72 
     73        $objSubView->assignobj($this); 
    5074        $objSubView->display($this->tpl_mainpage); 
    5175    } 
     
    95119        return $objSubPage; 
    96120    } 
     121 
     122    // メインカテゴリーの取得 
     123    function lfGetMainCat($count_check = false, &$objSubPage) { 
     124        $objQuery = new SC_Query(); 
     125        $col = "*"; 
     126        $from = "dtb_category left join dtb_category_total_count using (category_id)"; 
     127        // メインカテゴリーとその直下のカテゴリーを取得する。 
     128        $where = 'level <= 2 AND del_flg = 0'; 
     129        // 登録商品数のチェック 
     130        if($count_check) { 
     131            $where .= " AND product_count > 0"; 
     132        } 
     133        $objQuery->setoption("ORDER BY rank DESC"); 
     134        $arrRet = $objQuery->select($col, $from, $where); 
     135 
     136        // メインカテゴリーを抽出する。 
     137        $arrMainCat = array(); 
     138        foreach ($arrRet as $cat) { 
     139            if ($cat['level'] != 1) { 
     140                continue; 
     141            } 
     142 
     143            // 子カテゴリーを持つかどうかを調べる。 
     144            $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']); 
     145            $cat['has_children'] = count($arrChildrenID) > 0; 
     146            $arrMainCat[] = $cat; 
     147        } 
     148 
     149        $objSubPage->arrCat = $arrMainCat; 
     150        return $objSubPage; 
     151    } 
    97152} 
    98153?> 
  • branches/feature-module-update/html/mobile/frontparts/bloc/category.php

    r15532 r16147  
    11<?php 
    22/** 
    3  *  
     3 * 
    44 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
    55 * 
    66 * http://www.lockon.co.jp/ 
    7  *  
    8  * モバイルサイト/メインカテゴリー 
     7 * 
     8 * 
     9 * モバイルサイト/カテゴリ 
    910 */ 
    1011 
    11 class LC_CatPage { 
    12     function LC_CatPage() { 
    13         /** 必ず変更する **/ 
    14         $this->tpl_mainpage = 'frontparts/bloc/category.tpl';   // メインテンプレート 
    15     } 
    16 } 
     12// {{{ requires 
     13require_once("../require.php"); 
     14require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Category_Ex.php"); 
    1715 
    18 $objSubPage = new LC_CatPage(); 
    19 $objSubView = new SC_MobileView(); 
     16// }}} 
     17// {{{ generate page 
    2018 
    21 $objSubPage = lfGetMainCat(true, $objSubPage); 
    22  
    23 $objSubView->assignobj($objSubPage); 
    24 $objSubView->display($objSubPage->tpl_mainpage); 
    25  
    26 //----------------------------------------------------------------------------------------------------------------------------------- 
    27  
    28 // メインカテゴリーの取得 
    29 function lfGetMainCat($count_check = false, $objSubPage) { 
    30     $objQuery = new SC_Query(); 
    31     $col = "*"; 
    32     $from = "dtb_category left join dtb_category_total_count using (category_id)"; 
    33     // メインカテゴリーとその直下のカテゴリーを取得する。 
    34     $where = 'level <= 2 AND del_flg = 0'; 
    35     // 登録商品数のチェック 
    36     if($count_check) { 
    37         $where .= " AND product_count > 0"; 
    38     } 
    39     $objQuery->setoption("ORDER BY rank DESC"); 
    40     $arrRet = $objQuery->select($col, $from, $where); 
    41  
    42     // メインカテゴリーを抽出する。 
    43     $arrMainCat = array(); 
    44     foreach ($arrRet as $cat) { 
    45         if ($cat['level'] != 1) { 
    46             continue; 
    47         } 
    48  
    49         // 子カテゴリーを持つかどうかを調べる。 
    50         $arrChildrenID = sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']); 
    51         $cat['has_children'] = count($arrChildrenID) > 0; 
    52         $arrMainCat[] = $cat; 
    53     } 
    54  
    55     $objSubPage->arrCat = $arrMainCat; 
    56     return $objSubPage; 
    57 } 
     19$objPage = new LC_Page_FrontParts_Bloc_Category_Ex(); 
     20$objPage->mobileInit(); 
     21$objPage->mobileProcess(); 
     22register_shutdown_function(array($objPage, "destroy")); 
    5823?> 
Note: See TracChangeset for help on using the changeset viewer.