Changeset 20284


Ignore:
Timestamp:
2011/02/21 02:51:58 (13 years ago)
Author:
tao
Message:

refs #982 リファクタリング:モバイルカテゴリ一覧

Location:
branches/version-2_5-dev/data/class
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php

    r20231 r20284  
    254254        $arrRet = $objQuery->select($col, $from, $where); 
    255255 
    256         $arrParentID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 
     256        $arrParentID = SC_Helper_DB_Ex::sfGetParents('dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 
    257257 
    258258        foreach($arrRet as $key => $array) { 
  • branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_CategoryList.php

    r20116 r20284  
    6666 
    6767        // カテゴリー情報を取得する。 
    68         $this->lfGetCategories(@$_GET['category_id'], true, $this); 
     68        $objFormParam = $this->lfInitParam($_REQUEST); 
     69        $arrCategoryData = $this->lfGetCategories($objFormParam->getValue('category_id'), true, $this); 
     70        $this->arrCategory = $arrCategoryData["arrCategory"]; 
     71        $this->arrChildren = $arrCategoryData["arrChildren"]; 
    6972        $this->tpl_subtitle = $this->arrCategory['category_name']; 
    7073    } 
     
    8083 
    8184    /* カテゴリIDの正当性チェック */ 
    82     function lfCheckCategoryId() { 
    83         $objDb = new SC_Helper_DB_Ex(); 
    84         $category_id = $_POST['category_id'] ? $_POST['category_id'] : $_GET['category_id']; 
    85         if (!defined('MOBILE_SITE') && !isset($_REQUEST['category_id'])) 
    86             SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND); 
    87         if ($category_id 
    88                 && (!SC_Utils_Ex::sfIsInt($category_id) 
    89                 || SC_Utils_Ex::sfIsZeroFilling($category_id) 
    90                 || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0'))) 
    91             SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND); 
     85    function lfCheckCategoryId($category_id) { 
     86        if ($category_id && !SC_Helper_DB_Ex::sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')){ 
     87            return 0; 
     88        } 
     89        return $category_id; 
    9290    } 
    9391 
     
    102100     */ 
    103101    function lfGetCategories($category_id, $count_check = false, &$objPage) { 
    104         $objDb = new SC_Helper_DB_Ex(); 
    105102        // カテゴリーの正しいIDを取得する。 
    106         $arrCategory_id = $objDb->sfGetCategoryId('', $category_id); 
    107         $category_id = $arrCategory_id[0]; 
     103        $category_id = $this->lfCheckCategoryId($category_id); 
    108104        if ($category_id == 0) { 
    109105            SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND); 
     
    113109        $arrChildren = array(); // 子カテゴリー 
    114110 
    115         $arrAll = $objDb->sfGetCatTree($category_id, $count_check); 
     111        $arrAll = SC_Helper_DB_Ex::sfGetCatTree($category_id, $count_check); 
    116112        foreach ($arrAll as $category) { 
    117113            // 選択されたカテゴリーの場合 
     
    149145        } 
    150146 
    151         // 結果を格納する。 
    152         $objPage->arrCategory = $arrCategory; 
    153         $objPage->arrChildren = $arrChildren; 
     147        return array("arrChildren"=>$arrChildren, "arrCategory"=>$arrCategory); 
    154148    } 
     149 
     150    /** 
     151     * ユーザ入力値の処理 
     152     * 
     153     * @return object 
     154     */ 
     155    function lfInitParam($arrRequest) { 
     156        $objFormParam = new SC_FormParam(); 
     157        $objFormParam->addParam("カテゴリID", "category_id", INT_LEN, "n", array('NUM_CHECK',"MAX_LENGTH_CHECK")); 
     158        // 値の取得 
     159        $objFormParam->setParam($arrRequest); 
     160        // 入力値の変換 
     161        $objFormParam->convParam(); 
     162        return $objFormParam;         
     163    } 
     164 
     165 
    155166} 
    156167?> 
Note: See TracChangeset for help on using the changeset viewer.