Changeset 15367 for branches


Ignore:
Timestamp:
2007/08/27 17:49:31 (17 years ago)
Author:
nanasess
Message:

クラス化対応

Location:
branches/feature-module-update
Files:
18 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/html/frontparts/bloc/best5.php

    r15080 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
    7 class LC_Best5Page { 
    8     function LC_Best5Page() { 
    9         /** 必ず変更する **/ 
    10         $this->tpl_mainpage = BLOC_PATH . 'best5.tpl';  // メイン 
    11     } 
    12 } 
    137 
    14 $objSubPage = new LC_Best5Page(); 
    15 $objSubView = new SC_SiteView(); 
    16 $objSiteInfo = $objView->objSiteInfo; 
     8// {{{ requires 
     9require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5_Ex.php"); 
    1710 
    18 // 基本情報を渡す 
    19 $objSiteInfo = new SC_SiteInfo(); 
    20 $objSubPage->arrInfo = $objSiteInfo->data; 
     11// }}} 
     12// {{{ generate page 
    2113 
    22 //おすすめ商品表示 
    23 $objSubPage->arrBestProducts = lfGetRanking(); 
    24  
    25 $objSubView->assignobj($objSubPage); 
    26 $objSubView->display($objSubPage->tpl_mainpage); 
    27 //----------------------------------------------------------------------------------------------------------------------------------- 
    28 //おすすめ商品検索 
    29 function lfGetRanking(){ 
    30     $objQuery = new SC_Query(); 
    31      
    32     $col = "A.*, name, price02_min, price01_min, main_list_image "; 
    33     $from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS allcls using(product_id)"; 
    34     $where = "status = 1"; 
    35     $order = "rank"; 
    36     $objQuery->setorder($order); 
    37      
    38     $arrBestProducts = $objQuery->select($col, $from, $where); 
    39          
    40     return $arrBestProducts; 
    41 } 
    42  
     14$objPage = new LC_Page_FrontParts_BLoc_Best5_Ex(); 
     15$objPage->init(); 
     16$objPage->process(); 
     17register_shutdown_function(array($objPage, "destroy")); 
    4318?> 
  • branches/feature-module-update/html/frontparts/bloc/cart.php

    r15080 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
    7 class LC_CartPage { 
    8     function LC_CartPage() { 
    9         /** 必ず変更する **/ 
    10         $this->tpl_mainpage = BLOC_PATH . 'cart.tpl';   // メイン 
    11     } 
    12 } 
    137 
    14 $objSubPage = new LC_CartPage(); 
    15 $objSubView = new SC_SiteView(); 
    16 $objCart = new SC_CartSession(); 
    17 $objSiteInfo = new SC_SiteInfo; 
     8// {{{ requires 
     9require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart_Ex.php"); 
    1810 
    19 if (count($_SESSION[$objCart->key]) > 0){ 
    20     // カート情報を取得 
    21     $arrCartList = $objCart->getCartList(); 
    22      
    23     // カート内の商品ID一覧を取得 
    24     $arrAllProductID = $objCart->getAllProductID(); 
    25     // 商品が1つ以上入っている場合には商品名称を取得 
    26     if (count($arrAllProductID) > 0){ 
    27         $objQuery = new SC_Query(); 
    28         $arrVal = array(); 
    29         $sql = ""; 
    30         $sql = "SELECT name FROM dtb_products WHERE product_id IN ( ?"; 
    31         $arrVal = array($arrAllProductID[0]); 
    32         for($i = 1 ; $i < count($arrAllProductID) ; $i++){ 
    33             $sql.= " ,? "; 
    34             array_push($arrVal, $arrAllProductID[$i]); 
    35         } 
    36         $sql.= " )"; 
    37          
    38         $arrProduct_name = $objQuery->getAll($sql, $arrVal); 
    39          
    40         foreach($arrProduct_name as $key => $val){ 
    41             $arrCartList[$key]['product_name'] = $val['name']; 
    42         } 
    43     } 
    44     // 店舗情報の取得 
    45     $arrInfo = $objSiteInfo->data; 
    46     // 購入金額合計 
    47     $ProductsTotal = $objCart->getAllProductsTotal($arrInfo); 
    48      
    49     // 合計個数 
    50     $TotalQuantity = $objCart->getTotalQuantity(); 
    51      
    52     // 送料無料までの金額 
    53     $arrCartList[0]['ProductsTotal'] = $ProductsTotal; 
    54     $arrCartList[0]['TotalQuantity'] = $TotalQuantity; 
    55     $deliv_free = $arrInfo['free_rule'] - $ProductsTotal; 
    56     $arrCartList[0]['free_rule'] = $arrInfo['free_rule']; 
    57     $arrCartList[0]['deliv_free'] = $deliv_free; 
    58      
    59     $objSubPage->arrCartList = $arrCartList; 
    60 } 
     11// }}} 
     12// {{{ generate page 
    6113 
    62 $objSubView->assignobj($objSubPage); 
    63 $objSubView->display($objSubPage->tpl_mainpage); 
    64 //----------------------------------------------------------------------------------------------------------------------------------- 
    65  
     14$objPage = new LC_Page_FrontParts_BLoc_Cart_Ex(); 
     15$objPage->init(); 
     16$objPage->process(); 
     17register_shutdown_function(array($objPage, "destroy")); 
    6618?> 
  • branches/feature-module-update/html/frontparts/bloc/category.php

    r15152 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
    7 class LC_CatPage { 
    8     function LC_CatPage() { 
    9         /** 必ず変更する **/ 
    10         $this->tpl_mainpage = BLOC_PATH . 'category.tpl';   // メイン 
    11     } 
    12 } 
    137 
    14 $objSubPage = new LC_CatPage(); 
    15 $objSubView = new SC_SiteView(); 
     8// {{{ requires 
     9require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Category_Ex.php"); 
    1610 
    17 // 選択中のカテゴリIDを判定する 
    18 $category_id = SC_Utils::sfGetCategoryId($_GET['product_id'], $_GET['category_id']); 
     11// }}} 
     12// {{{ generate page 
    1913 
    20 // 選択中のカテゴリID 
    21 $objSubPage->tpl_category_id = $category_id; 
    22 $objSubPage = lfGetCatTree($category_id, true, $objSubPage); 
    23  
    24 $objSubView->assignobj($objSubPage); 
    25 $objSubView->display($objSubPage->tpl_mainpage); 
    26 //----------------------------------------------------------------------------------------------------------------------------------- 
    27 // カテゴリツリーの取得 
    28 function lfGetCatTree($parent_category_id, $count_check = false, $objSubPage) { 
    29     $objQuery = new SC_Query(); 
    30     $col = "*"; 
    31     $from = "dtb_category left join dtb_category_total_count using (category_id)"; 
    32     // 登録商品数のチェック 
    33     if($count_check) { 
    34         $where = "del_flg = 0 AND product_count > 0"; 
    35     } else { 
    36         $where = "del_flg = 0"; 
    37     } 
    38     $objQuery->setoption("ORDER BY rank DESC"); 
    39     $arrRet = $objQuery->select($col, $from, $where); 
    40  
    41     $arrParentID = SC_Utils_Ex::sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 
    42     $arrBrothersID = SC_Utils_Ex::sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID); 
    43     $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $parent_category_id); 
    44  
    45     $objSubPage->root_parent_id = $arrParentID[0]; 
    46  
    47     $arrDispID = array_merge($arrBrothersID, $arrChildrenID); 
    48  
    49     foreach($arrRet as $key => $array) { 
    50         foreach($arrDispID as $val) { 
    51             if($array['category_id'] == $val) { 
    52                 $arrRet[$key]['display'] = 1; 
    53                 break; 
    54             } 
    55         } 
    56     } 
    57  
    58     $objSubPage->arrTree = $arrRet; 
    59     return $objSubPage; 
    60 } 
     14$objPage = new LC_Page_FrontParts_BLoc_Category_Ex(); 
     15$objPage->init(); 
     16$objPage->process(); 
     17register_shutdown_function(array($objPage, "destroy")); 
    6118?> 
  • branches/feature-module-update/html/frontparts/bloc/login.php

    r15080 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
    7 class LC_LoginPage { 
    8     var $tpl_login_email; 
    9     function LC_LoginPage() { 
    10         /** 必ず変更する **/ 
    11         $this->tpl_mainpage = BLOC_PATH . 'login.tpl';  // メイン 
    12         $this->tpl_login = false; 
    13         $this->tpl_disable_logout = false; 
    14     } 
    15 } 
    167 
    17 $objSubPage = new LC_LoginPage(); 
    18 $objCustomer = new SC_Customer(); 
    19 // クッキー管理クラス 
    20 $objCookie = new SC_Cookie(COOKIE_EXPIRE); 
     8// {{{ requires 
     9require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Login_Ex.php"); 
    2110 
    22 // ログイン判定 
    23 if($objCustomer->isLoginSuccess()) { 
    24     $objSubPage->tpl_login = true; 
    25     $objSubPage->tpl_user_point = $objCustomer->getValue('point'); 
    26     $objSubPage->tpl_name1 = $objCustomer->getValue('name01'); 
    27     $objSubPage->tpl_name2 = $objCustomer->getValue('name02'); 
    28 } else { 
    29     // クッキー判定 
    30     $objSubPage->tpl_login_email = $objCookie->getCookie('login_email'); 
    31     if($objSubPage->tpl_login_email != "") { 
    32         $objSubPage->tpl_login_memory = "1"; 
    33     } 
    34      
    35     // POSTされてきたIDがある場合は優先する。 
    36     if($_POST['login_email'] != "") { 
    37         $objSubPage->tpl_login_email = $_POST['login_email']; 
    38     } 
    39 } 
     11// }}} 
     12// {{{ generate page 
    4013 
    41 $objSubPage->tpl_disable_logout = lfCheckDisableLogout(); 
    42 $objSubView = new SC_SiteView(); 
    43 $objSubView->assignobj($objSubPage); 
    44 $objSubView->display($objSubPage->tpl_mainpage); 
    45 //----------------------------------------------------------------------------------------------------------------------------------- 
    46 function lfCheckDisableLogout() { 
    47     global $arrDISABLE_LOGOUT; 
    48      
    49     $nowpage = $_SERVER['PHP_SELF']; 
    50      
    51     foreach($arrDISABLE_LOGOUT as $val) { 
    52         if($nowpage == $val) { 
    53             return true; 
    54         } 
    55     } 
    56     return false; 
    57 } 
     14$objPage = new LC_Page_FrontParts_BLoc_Login_Ex(); 
     15$objPage->init(); 
     16$objPage->process(); 
     17register_shutdown_function(array($objPage, "destroy")); 
    5818?> 
  • branches/feature-module-update/html/frontparts/bloc/news.php

    r15080 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
    7 class LC_NewsPage { 
    8     function LC_NewsPage() { 
    9         /** 必ず変更する **/ 
    10         $this->tpl_mainpage = BLOC_PATH . 'news.tpl';   // メイン 
    11     } 
    12 } 
     7// {{{ requires 
     8require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_News_Ex.php"); 
    139 
    14 $objSubPage = new LC_NewsPage(); 
    15 $objSubView = new SC_SiteView(); 
     10// }}} 
     11// {{{ generate page 
    1612 
    17 //新着情報取得 
    18 $objSubPage->arrNews = lfGetNews(); 
    19  
    20 $objSubView->assignobj($objSubPage); 
    21 $objSubView->display($objSubPage->tpl_mainpage); 
    22 //----------------------------------------------------------------------------------------------------------------------------------- 
    23 function lfGetNews(){ 
    24     $conn = new SC_DBConn(); 
    25     $sql = "SELECT *, cast(substring(news_date,1,10) as date) as news_date_disp FROM dtb_news WHERE del_flg = '0' ORDER BY rank DESC"; 
    26     $list_data = $conn->getAll($sql); 
    27     return $list_data;   
    28 } 
     13$objPage = new LC_Page_FrontParts_BLoc_News_Ex(); 
     14$objPage->init(); 
     15$objPage->process(); 
     16register_shutdown_function(array($objPage, "destroy")); 
    2917?> 
  • branches/feature-module-update/html/frontparts/bloc/search_products.php

    r15152 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
    7 class LC_SearchProductsPage { 
    8     function LC_SearchProductsPage() { 
    9         /** 必ず変更する **/ 
    10         $this->tpl_mainpage = BLOC_PATH . 'search_products.tpl';    // メイン 
    11     } 
    12 } 
     7// {{{ requires 
     8require_once(CLASS_PATH . "page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts_Ex.php"); 
    139 
    14 $objSubPage = new LC_SearchProductsPage(); 
    15 $arrSearch = array();   // 検索項目表示用 
     10// }}} 
     11// {{{ generate page 
    1612 
    17 // 選択中のカテゴリIDを判定する 
    18 $objSubPage->category_id = SC_Utils_Ex::sfGetCategoryId($_GET['product_id'], $_GET['category_id']); 
    19 // カテゴリ検索用選択リスト 
    20 $arrRet = SC_Utils_Ex::sfGetCategoryList('', true, ' '); 
    21  
    22 if(is_array($arrRet)) { 
    23     // 文字サイズを制限する 
    24     foreach($arrRet as $key => $val) { 
    25         $arrRet[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN); 
    26     } 
    27 } 
    28 $objSubPage->arrCatList = $arrRet; 
    29  
    30 $objSubView = new SC_SiteView(); 
    31 $objSubView->assignobj($objSubPage); 
    32 $objSubView->display($objSubPage->tpl_mainpage); 
    33 //----------------------------------------------------------------------------------------------------------------------------------- 
     13$objPage = new LC_Page_FrontParts_BLoc_SearchProducts_Ex(); 
     14$objPage->init(); 
     15$objPage->process(); 
     16register_shutdown_function(array($objPage, "destroy")); 
    3417?> 
  • branches/feature-module-update/html/frontparts/login_check.php

    r15153 r15367  
    55 * http://www.lockon.co.jp/ 
    66 */ 
     7 
     8// {{{ requires 
    79require_once("../require.php"); 
     10require_once(CLASS_PATH . "page_extends/frontparts/LC_Page_FrontParts_LoginCheck_Ex.php"); 
    811 
    9 // 不正なURLがPOSTされた場合はエラー表示 
    10 if (isset($_POST['url']) && lfIsValidURL() !== true) { 
    11     gfPrintLog('invalid access :login_check.php $POST["url"]=' . $_POST['url']); 
    12     sfDispSiteError(PAGE_ERROR); 
    13 } 
     12// }}} 
     13// {{{ generate page 
    1414 
    15 $objCustomer = new SC_Customer(); 
    16 // クッキー管理クラス 
    17 $objCookie = new SC_Cookie(COOKIE_EXPIRE); 
    18 // パラメータ管理クラス 
    19 $objFormParam = new SC_FormParam(); 
    20 // パラメータ情報の初期化 
    21 lfInitParam(); 
    22 // POST値の取得 
    23 $objFormParam->setParam($_POST); 
    24  
    25 switch($_POST['mode']) { 
    26 case 'login': 
    27     $objFormParam->toLower('login_email'); 
    28     $arrErr = $objFormParam->checkError(); 
    29     $arrForm =  $objFormParam->getHashArray(); 
    30     // クッキー保存判定 
    31     if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { 
    32         $objCookie->setCookie('login_email', $_POST['login_email']); 
    33     } else { 
    34         $objCookie->setCookie('login_email', ''); 
    35     } 
    36      
    37     if(count($arrErr) == 0) { 
    38         if($objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) { 
    39             header("Location: " . $_POST['url']); 
    40             exit; 
    41         } else { 
    42             $objQuery = new SC_Query; 
    43             $where = "email ILIKE ? AND status = 1 AND del_flg = 0"; 
    44             $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'])); 
    45              
    46             if($ret > 0) { 
    47                 sfDispSiteError(TEMP_LOGIN_ERROR); 
    48             } else { 
    49                 sfDispSiteError(SITE_LOGIN_ERROR); 
    50             } 
    51         } 
    52     } else { 
    53         // 入力エラーの場合、元のアドレスに戻す。 
    54         header("Location: " . $_POST['url']); 
    55         exit; 
    56     } 
    57     break; 
    58 case 'logout': 
    59     // ログイン情報の解放 
    60     $objCustomer->EndSession(); 
    61     $mypage_url_search = strpos('.'.$_POST['url'], "mypage"); 
    62     //マイページログイン中はログイン画面へ移行 
    63     if ($mypage_url_search == 2){ 
    64         header("Location: /mypage/login.php"); 
    65     }else{ 
    66         header("Location: " . $_POST['url']);    
    67     } 
    68     exit; 
    69     break; 
    70 } 
    71  
    72 //----------------------------------------------------------------------------------------------------------------------------------- 
    73 /* パラメータ情報の初期化 */ 
    74 function lfInitParam() { 
    75     global $objFormParam; 
    76     $objFormParam->addParam("記憶する", "login_memory", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); 
    77     $objFormParam->addParam("メールアドレス", "login_email", STEXT_LEN, "a", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    78     $objFormParam->addParam("パスワード", "login_pass", STEXT_LEN, "", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    79 } 
    80  
    81 /* POSTされるURLのチェック*/ 
    82 function lfIsValidURL() { 
    83     $site_url  = sfIsHTTPS() ? SSL_URL : SITE_URL; 
    84     $check_url = trim($_POST['url']); 
    85  
    86     // ローカルドメインチェック 
    87     if (!preg_match("|^$site_url|", $check_url) && !preg_match("|^/|", $check_url)) { 
    88         return false; 
    89     } 
    90      
    91     // 改行コード(CR・LF)・NULLバイトチェック 
    92     $pattern = '/\r|\n|\0|%0D|%0A|%00/'; 
    93     if (preg_match_all($pattern, $check_url, $matches) > 0) { 
    94         return false; 
    95     } 
    96      
    97     return true; 
    98 } 
    99  
     15$objPage = new LC_Page_FrontParts_LoginCheck_Ex(); 
     16$objPage->init(); 
     17$objPage->process(); 
     18register_shutdown_function(array($objPage, "destroy")); 
    10019?> 
Note: See TracChangeset for help on using the changeset viewer.