Revision 15078,
1.7 KB
checked in by nanasess, 17 years ago
(diff) |
r15064 から svn cp
とりあえず暫定コミット.
- UTF-8 に変更
- slib.php, glib.php のクラス化
- LC_Page の抽象化(一部)
|
Line | |
---|
1 | <?php
|
---|
2 | /**
|
---|
3 | *
|
---|
4 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
|
---|
5 | *
|
---|
6 | * http://www.lockon.co.jp/
|
---|
7 | *
|
---|
8 | * モバイルサイト/メインカテゴリー
|
---|
9 | */
|
---|
10 |
|
---|
11 | class LC_CatPage {
|
---|
12 | function LC_CatPage() {
|
---|
13 | /** 必ず変更する **/
|
---|
14 | $this->tpl_mainpage = 'frontparts/bloc/category.tpl'; // メインテンプレート
|
---|
15 | }
|
---|
16 | }
|
---|
17 |
|
---|
18 | $objSubPage = new LC_CatPage();
|
---|
19 | $objSubView = new SC_MobileView();
|
---|
20 |
|
---|
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 | }
|
---|
58 | ?>
|
---|
Note: See
TracBrowser
for help on using the repository browser.