OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / ec_main / include / iwidgets / exchange_classrate / include / container / admin_exchange_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_exchange_classrateWidgetContainer.php 5437 2012-12-07 13:14:59Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getContainerPath() . '/baseIWidgetContainer.php');
17
18 class admin_exchange_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                 
64                 if ($act == 'update'){          // 設定更新のとき
65                         // 入力エラーチェック
66                         
67                         if ($this->getMsgCount() == 0){                 // エラーのないとき
68                                 $configObj->table       = $priceTable;          // 料金表
69                                 $ret = $this->updateConfigObj($configObj);
70                                 if (!$ret) $this->setMsg(self::MSG_APP_ERR, 'インナーウィジェットデータの更新に失敗しました');
71                                 // ***** 正常に終了した場合はメッセージを残さない *****
72                         }
73                 } else if ($act == 'content'){          // 画面表示のとき
74                         if (!empty($init)){                     // 初期表示のとき
75                                 if (empty($configObj)){         // 定義値がないとき(管理画面なので最初は定義値が存在しない)
76                                         $priceTable = '5000:400;10000:300;20000:100;:0';
77                                 } else {
78                                         $priceTable     = $configObj->table;                    // 定額料金
79                                 }
80                         }
81                         // 画面にデータを埋め込む
82                         $this->tmpl->addVar("_widget", "price_table",   $priceTable);
83                 }
84         }
85 }
86 ?>