OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / ec_main / include / iwidgets / classrate / include / container / admin_classrateWidgetContainer.php
1 <?php
2 /**
3  * コンテナクラス
4  *
5  * PHP versions 5
6  *
7  * LICENSE: This source file is licensed under the terms of the GNU General Public License.
8  *
9  * @package    Magic3 Framework
10  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11  * @copyright  Copyright 2006-2012 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: admin_classrateWidgetContainer.php 5436 2012-12-07 09:55:12Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getContainerPath() . '/baseIWidgetContainer.php');
17
18 class admin_classrateWidgetContainer extends BaseIWidgetContainer
19 {
20         /**
21          * コンストラクタ
22          */
23         function __construct()
24         {
25                 // 親クラスを呼び出す
26                 parent::__construct();
27         }
28         /**
29          * テンプレートファイルを設定
30          *
31          * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
32          * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
33          *
34          * @param RequestManager $request               HTTPリクエスト処理クラス
35          * @param string         $act                   実行処理
36          * @param object         $configObj             定義情報オブジェクト
37          * @param object         $optionObj             可変パラメータオブジェクト
38          * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
39          */
40         function _setTemplate($request, $act, $configObj, $optionObj)
41         {       
42                 return 'admin.tmpl.html';
43         }
44         /**
45          * テンプレートにデータ埋め込む
46          *
47          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
48          *
49          * @param RequestManager $request               HTTPリクエスト処理クラス
50          * @param string         $act                   実行処理
51          * @param object         $configObj             定義情報オブジェクト
52          * @param object         $optionObj             可変パラメータオブジェクト
53          * @param                                                               なし
54          */
55         function _assign($request, $act, $configObj, $optionObj)
56         {
57                 // 基本情報を取得
58                 $id             = $optionObj->id;               // ユニークなID(配送方法ID)
59                 $init   = $optionObj->init;             // データ初期化を行うかどうか
60                 
61                 // 入力値を取得
62                 $priceTable     = $request->trimValueOf('iw_table');                    // 料金表
63                 $inputDate = ($request->trimValueOf('iw_input_date') == 'on') ? 1 : 0;                  // 配達希望日時の入力を許可するかどうか
64                 
65                 if ($act == 'update'){          // 設定更新のとき
66                         // 入力エラーチェック
67                         
68                         if ($this->getMsgCount() == 0){                 // エラーのないとき
69                                 $configObj->table       = $priceTable;          // 料金表
70                                 $configObj->inputDate = $inputDate;             // 希望日時の入力許可
71                                 $ret = $this->updateConfigObj($configObj);
72                                 if (!$ret) $this->setMsg(self::MSG_APP_ERR, 'インナーウィジェットデータの更新に失敗しました');
73                                 // ***** 正常に終了した場合はメッセージを残さない *****
74                         }
75                 } else if ($act == 'content'){          // 画面表示のとき
76                         if (!empty($init)){                     // 初期表示のとき
77                                 if (empty($configObj)){         // 定義値がないとき(管理画面なので最初は定義値が存在しない)
78                                         $priceTable = '5000:400;10000:300;20000:100;:0';
79                                         $inputDate      = 0;            // 希望日時の入力許可
80                                 } else {
81                                         $priceTable     = $configObj->table;                    // 定額料金
82                                         $inputDate      = $configObj->inputDate;                // 希望日時の入力許可
83                                 }
84                         }
85                         // 画面にデータを埋め込む
86                         $this->tmpl->addVar("_widget", "price_table",   $priceTable);
87                         if ($inputDate) $this->tmpl->addVar('_widget', 'input_date', 'checked');                // 配達希望日時が入力可能かどうか
88                 }
89         }
90 }
91 ?>