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-2008 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: admin_m_contactusWidgetContainer.php 867 2008-07-28 09:04:54Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getContainerPath() . '/baseWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/contactus_mainDb.php');
19 class admin_m_contactusWidgetContainer extends BaseWidgetContainer
21 private $db; // DB接続オブジェクト
22 const DEFAULT_SEND_MESSAGE = 1; // メール送信機能を使用するかどうか(デフォルト使用)
27 function __construct()
30 parent::__construct();
33 $this->db = new contactus_mainDb();
38 * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
39 * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
41 * @param RequestManager $request HTTPリクエスト処理クラス
42 * @param object $param 任意使用パラメータ。そのまま_assign()に渡る
43 * @return string テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
45 function _setTemplate($request, &$param)
47 return 'admin.tmpl.html';
52 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
54 * @param RequestManager $request HTTPリクエスト処理クラス
55 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
58 function _assign($request, &$param)
63 $defaultLang = $gEnvManager->getDefaultLanguage();
64 $act = $request->trimValueOf('act');
65 if ($act == 'update'){ // 設定更新のとき
66 $sendMessage = ($request->trimValueOf('send_message') == 'on') ? 1 : 0; // メール送信機能を使用するかどうか
67 //$emailReceiver = $request->trimValueOf('email_receiver'); // メール受信者
68 $emailReceiver = trim($request->valueOf('email_receiver')); // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
69 $companyVisible = ($request->trimValueOf('company_visible') == 'on') ? 1 : 0; // 会社名入力フィールドの表示
70 $addressVisible = ($request->trimValueOf('address_visible') == 'on') ? 1 : 0; // 住所入力フィールドの表示
71 $telVisible = ($request->trimValueOf('tel_visible') == 'on') ? 1 : 0; // 電話番号入力フィールドの表示
73 if ($this->getMsgCount() == 0){ // エラーのないとき
74 $paramObj->sendMessage = $sendMessage; // メール送信機能を使用するかどうか
75 $paramObj->emailReceiver = $emailReceiver; // メール受信者
76 $paramObj->companyVisible = $companyVisible; // 会社名入力フィールドの表示
77 $paramObj->addressVisible = $addressVisible; // 住所入力フィールドの表示
78 $paramObj->telVisible = $telVisible; // 電話番号入力フィールドの表示
79 $ret = $this->updateWidgetParamObj($paramObj);
81 $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
83 $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
85 $gPageManager->updateParentWindow();// 親ウィンドウを更新
89 $sendMessage = self::DEFAULT_SEND_MESSAGE; // メール送信機能を使用するかどうか
90 $emailReceiver = ''; // メール受信者
91 $companyVisible = 0; // 会社名入力フィールドの表示
92 $addressVisible = 0; // 住所入力フィールドの表示
93 $telVisible = 0; // 電話番号入力フィールドの表示
94 $paramObj = $this->getWidgetParamObj();
95 if (!empty($paramObj)){
96 $sendMessage = $paramObj->sendMessage; // メール送信機能を使用するかどうか
97 $emailReceiver = $paramObj->emailReceiver; // メール受信者
98 $companyVisible = $paramObj->companyVisible; // 会社名入力フィールドの表示
99 $addressVisible = $paramObj->addressVisible; // 住所入力フィールドの表示
100 $telVisible = $paramObj->telVisible; // 電話番号入力フィールドの表示
105 if ($sendMessage) $checked = 'checked';
106 $this->tmpl->addVar("_widget", "send_message", $checked);
107 $this->tmpl->addVar("_widget", "email_receiver", $emailReceiver); // メール受信者
109 if ($companyVisible) $checked = 'checked';
110 $this->tmpl->addVar("_widget", "company_visible", $checked);// 会社名入力フィールドの表示
112 if ($addressVisible) $checked = 'checked';
113 $this->tmpl->addVar("_widget", "address_visible", $checked);// 住所入力フィールドの表示
115 if ($telVisible) $checked = 'checked';
116 $this->tmpl->addVar("_widget", "tel_visible", $checked);// 電話番号入力フィールドの表示