Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Mypage_Delivery.php

Documentation is available at LC_Page_Mypage_Delivery.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once(CLASS_PATH "pages/LC_Page.php");
  26.  
  27. /**
  28.  * お届け先編集 のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id: LC_Page_Mypage_Delivery.php 18735 2010-06-22 08:53:31Z nanasess $
  33.  */
  34. class LC_Page_Mypage_Delivery extends LC_Page {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * Page を初期化する.
  41.      *
  42.      * @return void 
  43.      */
  44.     function init({
  45.         parent::init();
  46.         $this->tpl_mainpage = TEMPLATE_DIR .'mypage/delivery.tpl';
  47.         $this->tpl_title = "MYページ/お届け先追加・変更";
  48.         $this->tpl_navi TEMPLATE_DIR 'mypage/navi.tpl';
  49.         $this->tpl_mainno = 'mypage';
  50.         $this->tpl_mypageno 'delivery';
  51.         $masterData new SC_DB_MasterData_Ex();
  52.         $this->arrPref$masterData->getMasterData("mtb_pref",
  53.                             array("pref_id""pref_name""rank"));
  54.         $this->tpl_column_num = 1;
  55.         $this->allowClientCache();
  56.     }
  57.  
  58.     /**
  59.      * Page のプロセス.
  60.      *
  61.      * @return void 
  62.      */
  63.     function process({
  64.         $objView new SC_SiteView();
  65.         $objCustomer new SC_Customer();
  66.  
  67.         //ログイン判定
  68.         if(!$objCustomer->isLoginSuccess()) {
  69.             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
  70.         }else {
  71.             //マイページトップ顧客情報表示用
  72.             $this->CustomerName1 $objCustomer->getvalue('name01');
  73.             $this->CustomerName2 $objCustomer->getvalue('name02');
  74.             $this->CustomerPoint $objCustomer->getvalue('point');
  75.         }
  76.  
  77.         // レイアウトデザインを取得
  78.         $objLayout new SC_Helper_PageLayout_Ex();
  79.         $objLayout->sfGetPageLayout($thisfalse"mypage/index.php");
  80.  
  81.         $mode = isset($_POST['mode']$_POST['mode''';
  82.         $customerId $objCustomer->getValue('customer_id');
  83.  
  84.         switch($mode{
  85.  
  86.         // お届け先の削除
  87.         case 'delete':
  88.             $objForm $this->initParam();
  89.             if ($objForm->checkError()) {
  90.                 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
  91.                 exit;
  92.             }
  93.  
  94.             $this->deleteOtherDeliv($customerId$objForm->getValue('other_deliv_id'));
  95.             break;
  96.  
  97.         // お届け先の表示
  98.         default:
  99.             break;
  100.         }
  101.  
  102.         //別のお届け先情報
  103.         $this->arrOtherDeliv $this->getOtherDeliv($customerId);
  104.  
  105.         //お届け先登録数
  106.         $this->tpl_linemax count($this->arrOtherDeliv);;
  107.  
  108.         $objView->assignobj($this);
  109.         $objView->display(SITE_FRAME);
  110.     }
  111.  
  112.     /**
  113.      * デストラクタ.
  114.      *
  115.      * @return void 
  116.      */
  117.     function destroy({
  118.         parent::destroy();
  119.     }
  120.  
  121.     /**
  122.      * フォームパラメータの初期化
  123.      *
  124.      * @return SC_FormParam 
  125.      */
  126.     function initParam({
  127.         $objForm new SC_FormParam();
  128.         $objForm->addParam('お届け先ID''other_deliv_id'INT_LEN''array('EXIST_CHECK''NUM_CHECK''MAX_LENGTH_CHECK'));
  129.         $objForm->setParam($_POST);
  130.         $objForm->convParam();
  131.         return $objForm;
  132.     }
  133.  
  134.     /**
  135.      * お届け先の取得
  136.      *
  137.      * @param integer $customerId 
  138.      * @return array 
  139.      */
  140.     function getOtherDeliv($customerId{
  141.         $objQuery new SC_Query;
  142.         $objQuery->setOrder('other_deliv_id DESC');
  143.         $arrRet $objQuery->select('*''dtb_other_deliv''customer_id = ?'array($customerId));
  144.         return empty($arrRetarray($arrRet;
  145.     }
  146.  
  147.     /**
  148.      * お届け先の削除
  149.      *
  150.      * @param integer $customerId 
  151.      * @param integer $delivId 
  152.      */
  153.     function deleteOtherDeliv($customerId$delivId{
  154.         $where 'customer_id = ? AND other_deliv_id = ?';
  155.         $objQuery new SC_Query;
  156.         $objQuery->delete("dtb_other_deliv"$wherearray($customerId$delivId));
  157.     }
  158. }
  159. ?>

Documentation generated on Fri, 24 Feb 2012 13:59:34 +0900 by Seasoft