7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
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
16 require_once($gEnvManager->getContainerPath() . '/baseIWidgetContainer.php');
18 class admin_classrateWidgetContainer extends BaseIWidgetContainer
23 function __construct()
26 parent::__construct();
31 * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
32 * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
34 * @param RequestManager $request HTTPリクエスト処理クラス
35 * @param string $act 実行処理
36 * @param object $configObj 定義情報オブジェクト
37 * @param object $optionObj 可変パラメータオブジェクト
38 * @return string テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
40 function _setTemplate($request, $act, $configObj, $optionObj)
42 return 'admin.tmpl.html';
47 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
49 * @param RequestManager $request HTTPリクエスト処理クラス
50 * @param string $act 実行処理
51 * @param object $configObj 定義情報オブジェクト
52 * @param object $optionObj 可変パラメータオブジェクト
55 function _assign($request, $act, $configObj, $optionObj)
58 $id = $optionObj->id; // ユニークなID(配送方法ID)
59 $init = $optionObj->init; // データ初期化を行うかどうか
62 $priceTable = $request->trimValueOf('iw_table'); // 料金表
63 $inputDate = ($request->trimValueOf('iw_input_date') == 'on') ? 1 : 0; // 配達希望日時の入力を許可するかどうか
65 if ($act == 'update'){ // 設定更新のとき
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 // ***** 正常に終了した場合はメッセージを残さない *****
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; // 希望日時の入力許可
81 $priceTable = $configObj->table; // 定額料金
82 $inputDate = $configObj->inputDate; // 希望日時の入力許可
86 $this->tmpl->addVar("_widget", "price_table", $priceTable);
87 if ($inputDate) $this->tmpl->addVar('_widget', 'input_date', 'checked'); // 配達希望日時が入力可能かどうか