Ignore:
Timestamp:
2007/07/20 15:58:59 (17 years ago)
Author:
nanasess
Message:

r15064 から svn cp
とりあえず暫定コミット.

  • UTF-8 に変更
  • slib.php, glib.php のクラス化
  • LC_Page の抽象化(一部)
Location:
branches/feature-module-update
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update

    • Property svn:ignore set to
      .cache

      .settings

      .projectOptions
  • branches/feature-module-update/html/install/user_data/include/campaign/default/src/index.php

    r14117 r15078  
    77require_once("../../require.php"); 
    88 
    9 //---- ¥Ú¡¼¥¸É½¼¨¥¯¥é¥¹ 
     9//---- ページ表示クラス 
    1010class LC_Page { 
    1111     
     
    2020$objCampaignSess = new SC_CampaignSession(); 
    2121 
    22 // ¥Ç¥£¥ì¥¯¥È¥ê̾¤ò¼èÆÀ 
     22// ディレクトリ名を取得 
    2323$dir_name = dirname($_SERVER['PHP_SELF']); 
    2424$arrDir = split('/', $dir_name); 
    2525$dir_name = $arrDir[count($arrDir) -1]; 
    2626 
    27 /* ¥»¥Ã¥·¥ç¥ó¤Ë¥­¥ã¥ó¥Ú¡¼¥ó¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤à */ 
    28 // ¥­¥ã¥ó¥Ú¡¼¥ó¤«¤é¤ÎÁ«°Ü¤È¤¤¤¦¾ðÊó¤òÊÝ»ý 
     27/* セッションにキャンペーンデータを書き込む */ 
     28// キャンペーンからの遷移という情報を保持 
    2929$objCampaignSess->setIsCampaign(); 
    30 // ¥­¥ã¥ó¥Ú¡¼¥óID¤òÊÝ»ý 
     30// キャンペーンIDを保持 
    3131$campaign_id = $objQuery->get("dtb_campaign", "campaign_id", "directory_name = ? AND del_flg = 0", array($dir_name)); 
    3232$objCampaignSess->setCampaignId($campaign_id); 
    33 // ¥­¥ã¥ó¥Ú¡¼¥ó¥Ç¥£¥ì¥¯¥È¥ê̾¤òÊÝ»ý 
     33// キャンペーンディレクトリ名を保持 
    3434$objCampaignSess->setCampaignDir($dir_name); 
    3535 
    36 // ¥«¡¼¥È¤ËÆþ¤ì¤Ê¤¤¥Ú¡¼¥¸¤Î¾ì¹ç¤Î¥Ú¡¼¥¸(¿½¹þ¤Î¤ß¥Ú¡¼¥¸)¤Ø¥ê¥À¥¤¥ì¥¯¥È 
     36// カートに入れないページの場合のページ(申込のみページ)へリダイレクト 
    3737$cart_flg = $objQuery->get("dtb_campaign", "cart_flg", "campaign_id = ?", array($campaign_id)); 
    3838if(!$cart_flg) { 
     
    4040} 
    4141 
    42 // ¥­¥ã¥ó¥Ú¡¼¥ó¤¬³«ºÅÃ椫¤ò¥Á¥§¥Ã¥¯ 
     42// キャンペーンが開催中かをチェック 
    4343if(lfCheckActive($dir_name)) { 
    4444    $status = CAMPAIGN_TEMPLATE_ACTIVE; 
     
    6464        $classcategory_id2 = $_POST[$classcategory_id. '_2']; 
    6565        $quantity = "quantity". $_POST['product_id']; 
    66         // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 
     66        // 規格1が設定されていない場合 
    6767        if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 
    6868            $classcategory_id1 = '0'; 
    6969        } 
    70         // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 
     70        // 規格2が設定されていない場合 
    7171        if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 
    7272            $classcategory_id2 = '0'; 
     
    8181    break; 
    8282} 
    83 // ÆþÎϾðÊó¤òÅϤ¹ 
     83// 入力情報を渡す 
    8484$objPage->arrForm = $_POST; 
    8585$objPage->tpl_dir_name = CAMPAIGN_TEMPLATE_PATH . $dir_name  . "/" . $status; 
    8686 
    87 //----¡¡¥Ú¡¼¥¸É½¼¨ 
     87//---- ページ表示 
    8888$objView->assignobj($objPage); 
    8989$objView->display($objPage->tpl_mainpage); 
     
    9292//--------------------------------------------------------------------------------------------------------------------------------------------------------- 
    9393/*  
    94  * ´Ø¿ô̾¡§lfCheckActive() 
    95  * °ú¿ô1 ¡§¥Ç¥£¥ì¥¯¥È¥ê̾ 
    96  * ÀâÌÀ¡¡¡§¥­¥ã¥ó¥Ú¡¼¥óÃ椫¥Á¥§¥Ã¥¯ 
    97  * Ìá¤êÃÍ¡§¥­¥ã¥ó¥Ú¡¼¥óÃæ¤Ê¤é true ½ªÎ»¤Ê¤é false 
     94 * 関数名:lfCheckActive() 
     95 * 引数1 :ディレクトリ名 
     96 * 説明 :キャンペーン中かチェック 
     97 * 戻り値:キャンペーン中なら true 終了なら false 
    9898 */ 
    9999function lfCheckActive($directory_name) { 
     
    105105    $arrRet = $objQuery->select($col, "dtb_campaign", "directory_name = ? AND del_flg = 0", array($directory_name)); 
    106106 
    107     // ³«»ÏÆü»þ¡¦Ää»ßÆü»þ¤òÀ®·¿ 
     107    // 開始日時・停止日時を成型 
    108108    $start_date = (date("YmdHis", strtotime($arrRet[0]['start_date']))); 
    109109    $end_date = (date("YmdHis", strtotime($arrRet[0]['end_date']))); 
    110110    $now_date = (date("YmdHis")); 
    111111 
    112     // ¥­¥ã¥ó¥Ú¡¼¥ó¤¬³«ºÅ´ü´Ö¤Ç¡¢¤«¤Ä¿½¹þÀ©¸ÂÆâ¤Ç¤¢¤ë 
     112    // キャンペーンが開催期間で、かつ申込制限内である 
    113113    if($now_date > $start_date && $now_date < $end_date 
    114114            && ($arrRet[0]['limit_count'] > $arrRet[0]['total_count'] || $arrRet[0]['limit_count'] < 1)) { 
     
    119119} 
    120120 
    121 /* ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨ */ 
     121/* 商品一覧の表示 */ 
    122122function lfDispProductsList($ids) { 
    123123     
     
    125125    global $objPage; 
    126126 
    127     // µ¬³Ê̾°ìÍ÷ 
     127    // 規格名一覧 
    128128    $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
    129     // µ¬³ÊʬÎà̾°ìÍ÷ 
     129    // 規格分類名一覧 
    130130    $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
    131131     
     
    135135    } 
    136136     
    137     // where¶çÀ¸À® 
     137    // where句生成 
    138138    $count = 0; 
    139139    $where = "product_id IN ("; 
     
    146146    $where .= ")"; 
    147147 
    148     // ¾¦ÉÊ°ìÍ÷ 
     148    // 商品一覧 
    149149    $arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 
    150150 
    151151    for($i = 0; $i < count($arrProducts); $i++) { 
    152152        $objPage = lfMakeSelect($arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 
    153         // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ 
     153        // 購入制限数を取得 
    154154        $objPage = lfGetSaleLimit($arrProducts); 
    155155    } 
     
    164164} 
    165165 
    166 /* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */ 
     166/* 規格セレクトボックスの作成 */ 
    167167function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 
    168168    global $objPage; 
     
    170170    $classcat_find1 = false; 
    171171    $classcat_find2 = false; 
    172     // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎ̵ͭ 
     172    // 在庫ありの商品の有無 
    173173    $stock_find = false; 
    174174     
    175     // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ    
     175    // 商品規格情報の取得     
    176176    $arrProductsClass = lfGetProductsClass($product_id); 
    177177     
    178     // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
     178    // 規格1クラス名の取得 
    179179    $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 
    180     // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
     180    // 規格2クラス名の取得 
    181181    $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 
    182182     
    183     // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô  
     183    // すべての組み合わせ数    
    184184    $count = count($arrProductsClass); 
    185185     
     
    190190     
    191191    $list_id = 0; 
    192     $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; 
     192    $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'"; 
    193193    $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 
    194194     
    195195    for ($i = 0; $i < $count; $i++) { 
    196         // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ 
     196        // 在庫のチェック 
    197197        if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
    198198            continue; 
     
    201201        $stock_find = true; 
    202202         
    203         // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
     203        // 規格1のセレクトボックス用 
    204204        if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
    205205            $arrList[$list_id].=");\n"; 
     
    210210        } 
    211211         
    212         // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
     212        // 規格2のセレクトボックス用 
    213213        $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
    214214         
    215         // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ 
     215        // セレクトボックス表示値 
    216216        if($arrList[$list_id] == "") { 
    217             $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'"; 
     217            $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 
    218218        } else { 
    219219            $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 
    220220        } 
    221221         
    222         // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ 
     222        // セレクトボックスPOST値 
    223223        if($arrVal[$list_id] == "") { 
    224224            $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 
     
    231231    $arrVal[$list_id].=");\n"; 
    232232         
    233     // µ¬³Ê1 
     233    // 規格1 
    234234    $objPage->arrClassCat1[$product_id] = $arrSele; 
    235235     
     
    260260    $objPage->tpl_javascript.= $vals.");\n"; 
    261261     
    262     // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID 
     262    // 選択されている規格2ID 
    263263    $classcategory_id = "classcategory_id". $product_id; 
    264264    $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 
    265265 
    266     // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
     266    // 規格1が設定されている 
    267267    if($arrProductsClass[0]['classcategory_id1'] != '0') { 
    268268        $classcat_find1 = true; 
    269269    } 
    270270     
    271     // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
     271    // 規格2が設定されている 
    272272    if($arrProductsClass[0]['classcategory_id2'] != '0') { 
    273273        $classcat_find2 = true; 
     
    281281} 
    282282 
    283 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ 
     283/* 商品規格情報の取得 */ 
    284284function lfGetProductsClass($product_id) { 
    285285    $arrRet = array(); 
    286286    if(sfIsInt($product_id)) { 
    287         // ¾¦Éʵ¬³Ê¼èÆÀ 
     287        // 商品規格取得 
    288288        $objQuery = new SC_Query(); 
    289289        $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
     
    296296} 
    297297 
    298 /* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */ 
     298/* 入力内容のチェック */ 
    299299function lfCheckError($id) { 
    300300    global $objPage; 
    301301     
    302     // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ 
     302    // 入力データを渡す。 
    303303    $objErr = new SC_CheckError(); 
    304304     
     
    306306    $classcategory_id2 = "classcategory_id". $id. "_2"; 
    307307    $quantity = "quantity". $id; 
    308     // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯ 
     308    // 複数項目チェック 
    309309    if ($objPage->tpl_classcat_find1[$id]) { 
    310         $objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     310        $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    311311    } 
    312312    if ($objPage->tpl_classcat_find2[$id]) { 
    313         $objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    314     } 
    315     $objErr->doFunc(array("¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     313        $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     314    } 
     315    $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    316316             
    317317    return $objErr->arrErr; 
    318318} 
    319319 
    320 // ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê 
     320// 購入制限数の設定 
    321321function lfGetSaleLimit($product) { 
    322322    global $objPage; 
    323     //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礭¤¤¾ì¹ç 
     323    //在庫が無限または購入制限値が設定値より大きい場合 
    324324    if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
    325325        $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 
     
    331331} 
    332332 
    333 //»ÙʧÊýË¡¤Î¼èÆÀ 
    334 //payment_id    1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα 
     333//支払方法の取得 
     334//payment_id    1:代金引換 2:銀行振り込み 3:現金書留 
    335335function lfGetPayment() { 
    336336    $objQuery = new SC_Query; 
Note: See TracChangeset for help on using the changeset viewer.