Changeset 20231


Ignore:
Timestamp:
2011/02/20 04:25:43 (13 years ago)
Author:
tao
Message:

refs #982 リファクタリング 商品詳細画面に関連してSC_Helperをスタティックに修正

File:
1 edited

Legend:

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

    r20199 r20231  
    322322        $arrRet = $objQuery->select($col, $from, $where); 
    323323 
    324         $arrCategory_id = $this->sfGetCategoryId($product_id); 
     324        $arrCategory_id = SC_Helper_DB_Ex::sfGetCategoryId($product_id); 
    325325 
    326326        $arrCatTree = array(); 
    327327        foreach ($arrCategory_id as $pkey => $parent_category_id) { 
    328             $arrParentID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 
     328            $arrParentID = SC_Helper_DB_Ex::sfGetParents('dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 
    329329 
    330330            foreach($arrParentID as $pid) { 
     
    504504            $status = "status = 1"; 
    505505        } 
    506  
    507         if(!$this->g_category_on) { 
    508             $this->g_category_on = true; 
    509             $category_id = (int) $category_id; 
    510             $product_id = (int) $product_id; 
    511             if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && SC_Helper_DB_Ex::sfIsRecord("dtb_category","category_id", $category_id)) { 
    512                 $this->g_category_id = array($category_id); 
    513             } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord("dtb_products","product_id", $product_id, $status)) { 
    514                 $objQuery =& SC_Query::getSingletonInstance(); 
    515                 $where = "product_id = ?"; 
    516                 $category_id = $objQuery->getCol("category_id", "dtb_product_categories", "product_id = ?", array($product_id)); 
    517                 $this->g_category_id = $category_id; 
    518             } else { 
    519                 // 不正な場合は、空の配列を返す。 
    520                 $this->g_category_id = array(); 
    521             } 
    522         } 
    523         return $this->g_category_id; 
     506        $category_id = (int) $category_id; 
     507        $product_id = (int) $product_id; 
     508        if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && SC_Helper_DB_Ex::sfIsRecord("dtb_category","category_id", $category_id)) { 
     509            $category_id = array($category_id); 
     510        } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord("dtb_products","product_id", $product_id, $status)) { 
     511            $objQuery =& SC_Query::getSingletonInstance(); 
     512            $where = "product_id = ?"; 
     513            $category_id = $objQuery->getCol("category_id", "dtb_product_categories", "product_id = ?", array($product_id)); 
     514        } else { 
     515            // 不正な場合は、空の配列を返す。 
     516            $category_id = array(); 
     517        } 
     518        return $category_id; 
    524519    } 
    525520 
     
    873868     */ 
    874869    function sfGetParents($table, $pid_name, $id_name, $id) { 
    875         $arrRet = $this->sfGetParentsArray($table, $pid_name, $id_name, $id); 
     870        $arrRet = SC_Helper_DB_Ex::sfGetParentsArray($table, $pid_name, $id_name, $id); 
    876871        // 配列の先頭1つを削除する。 
    877872        array_shift($arrRet); 
Note: See TracChangeset for help on using the changeset viewer.