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

Source for file LC_Page_Admin_OwnersStore_Settings.php

Documentation is available at LC_Page_Admin_OwnersStore_Settings.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2011 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_EX_REALDIR 'page_extends/admin/LC_Page_Admin_Ex.php';
  26.  
  27. /**
  28.  * EC-CUBEアプリケーション管理:アプリケーション設定 のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id: LC_Page_Admin_OwnersStore_Settings.php 20970 2011-06-10 10:27:24Z Seasoft $
  33.  */
  34. class LC_Page_Admin_OwnersStore_Settings extends LC_Page_Admin_Ex {
  35.  
  36.     /** SC_FormParamのインスタンス */
  37.     var $objForm;
  38.  
  39.     /** リクエストパラメーターを格納する連想配列 */
  40.     var $arrForm;
  41.  
  42.     /** バリデーションエラー情報を格納する連想配列 */
  43.     var $arrErr;
  44.  
  45.     // }}}
  46.     // {{{ functions
  47.  
  48.     /**
  49.      * Page を初期化する.
  50.      *
  51.      * @return void 
  52.      */
  53.     function init({
  54.         parent::init();
  55.  
  56.         $this->tpl_mainpage 'ownersstore/settings.tpl';
  57.         $this->tpl_mainno   'ownersstore';
  58.         $this->tpl_subno    'settings';
  59.         $this->tpl_maintitle 'オーナーズストア';
  60.         $this->tpl_subtitle '認証キー設定';
  61.         $this->httpCacheControl('nocache');
  62.     }
  63.  
  64.     /**
  65.      * Page のプロセス.
  66.      *
  67.      * @return void 
  68.      */
  69.     function process({
  70.         $this->action();
  71.         $this->sendResponse();
  72.     }
  73.  
  74.     /**
  75.      * Page のアクション.
  76.      *
  77.      * @return void 
  78.      */
  79.     function action({
  80.         switch($this->getMode()) {
  81.         // 入力内容をDBへ登録する
  82.         case 'register':
  83.             $this->execRegisterMode();
  84.             break;
  85.         // 初回表示
  86.         default:
  87.             $this->execDefaultMode();
  88.         }
  89.     }
  90.  
  91.     /**
  92.      * デストラクタ.
  93.      *
  94.      * @return void 
  95.      */
  96.     function destroy({
  97.         parent::destroy();
  98.     }
  99.  
  100.     /**
  101.      * registerアクションの実行.
  102.      * 入力内容をDBへ登録する.
  103.      *
  104.      * @param void 
  105.      * @return void 
  106.      */
  107.     function execRegisterMode({
  108.         // パラメーターオブジェクトの初期化
  109.         $this->initRegisterMode();
  110.         // POSTされたパラメーターの検証
  111.         $arrErr $this->validateRegistermode();
  112.  
  113.         // エラー時の処理
  114.         if (!empty($arrErr)) {
  115.             $this->arrErr  = $arrErr;
  116.             $this->arrForm = $this->objForm->getHashArray();
  117.             return;
  118.         }
  119.  
  120.         // エラーがなければDBへ登録
  121.         $arrForm $this->objForm->getHashArray();
  122.         $this->registerOwnersStoreSettings($arrForm);
  123.  
  124.         $this->arrForm = $arrForm;
  125.  
  126.         $this->tpl_onload "alert('登録しました。')";
  127.     }
  128.  
  129.     /**
  130.      * registerアクションの初期化.
  131.      * SC_FormParamを初期化しメンバ変数にセットする.
  132.      *
  133.      * @param void 
  134.      * @return void 
  135.      */
  136.     function initRegisterMode({
  137.         // 前後の空白を削除
  138.         if (isset($_POST['public_key'])) {
  139.             $_POST['public_key'trim($_POST['public_key']);
  140.         }
  141.  
  142.         $objForm new SC_FormParam_Ex();
  143.         $objForm->addParam('認証キー''public_key'LTEXT_LEN''array('EXIST_CHECK''ALNUM_CHECK''MAX_LENGTH_CHECK'));
  144.         $objForm->setParam($_POST);
  145.  
  146.         $this->objForm = $objForm;
  147.     }
  148.  
  149.     /**
  150.      * registerアクションのパラメーターを検証する.
  151.      *
  152.      * @param void 
  153.      * @return array エラー情報を格納した連想配列
  154.      */
  155.     function validateRegistermode({
  156.         return $this->objForm->checkError();
  157.     }
  158.  
  159.     /**
  160.      * defaultアクションの実行.
  161.      * DBから登録内容を取得し表示する.
  162.      *
  163.      * @param void 
  164.      * @return void 
  165.      */
  166.     function execDefaultMode({
  167.         $this->arrForm = $this->getOwnersStoreSettings();
  168.     }
  169.  
  170.     /**
  171.      * DBへ入力内容を登録する.
  172.      *
  173.      * @param array $arrSettingsData オーナーズストア設定の連想配列
  174.      * @return void 
  175.      */
  176.     function registerOwnersStoreSettings($arrSettingsData{
  177.         $table 'dtb_ownersstore_settings';
  178.         $objQuery new SC_Query_Ex();
  179.         $count $objQuery->count($table);
  180.  
  181.         if ($count{
  182.             $objQuery->update($table$arrSettingsData);
  183.         else {
  184.             $objQuery->insert($table$arrSettingsData);
  185.         }
  186.     }
  187.  
  188.     /**
  189.      * DBから登録内容を取得する.
  190.      *
  191.      * @param void 
  192.      * @return array 
  193.      */
  194.     function getOwnersStoreSettings(){
  195.         $table   'dtb_ownersstore_settings';
  196.         $colmuns '*';
  197.  
  198.         $objQuery new SC_Query_Ex();
  199.         $arrRet $objQuery->select($colmuns$table);
  200.  
  201.         if (isset($arrRet[0])) return $arrRet[0];
  202.  
  203.         return array();
  204.     }
  205. }
  206. ?>

Documentation generated on Fri, 24 Feb 2012 14:01:31 +0900 by Seasoft