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-2007 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: reserve_mainChangepwdWidgetContainer.php 2363 2009-09-26 14:45:44Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getContainerPath() . '/baseWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/ec_mainDb.php');
19 class reserve_mainChangepwdWidgetContainer extends BaseWidgetContainer
21 private $mainDb; // DB接続オブジェクト
22 private $sysDb; // システムDBオブジェクト
23 const USE_EMAIL = 'use_email'; // EMAIL機能が使用可能かどうか
24 const SEND_PASSWORD_FORM = 'send_password'; // パスワード送信用フォーム
25 const AUTO_EMAIL_SENDER = 'auto_email_sender'; // 自動送信メール用送信者アドレス
30 function __construct()
32 global $gInstanceManager;
35 parent::__construct();
38 $this->mainDb = new ec_mainDb();
39 $this->sysDb = $gInstanceManager->getSytemDbObject();
44 * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
45 * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
47 * @param RequestManager $request HTTPリクエスト処理クラス
48 * @param object $param 任意使用パラメータ。そのまま_assign()に渡る
49 * @return string テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
51 function _setTemplate($request, &$param)
53 return 'changepwd.tmpl.html';
58 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
60 * @param RequestManager $request HTTPリクエスト処理クラス
61 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
64 function _assign($request, &$param)
68 $act = $request->trimValueOf('act');
69 $password = $request->trimValueOf('password');
70 $length = $request->trimValueOf('length'); // パスワード長
71 if ($act == 'update'){ // パスワード更新のとき
73 $ret = $this->sysDb->updateLoginUserPassword($gEnvManager->getCurrentUserId(), $password, true/*MD5化されているパスワード*/);
75 $this->tmpl->addVar("_widget", "message", 'パスワード変更が完了しました');
76 $this->tmpl->addVar("_widget", "button_disabled", 'disabled'); // ボタン使用不可
77 $this->tmpl->addVar("_widget", "pwd1_disabled", 'disabled'); // 入力フィールド不可
78 $this->tmpl->addVar("_widget", "pwd2_disabled", 'disabled'); // 入力フィールド不可
80 $this->tmpl->addVar("_widget", "pwd_value", str_repeat('*', $length)); // ダミー値を設定
82 $this->tmpl->addVar("_widget", "message", 'パスワード変更に失敗しました');
85 $this->tmpl->addVar("_widget", "button_label", 'パスワード変更'); // ボタンのラベル
88 $this->tmpl->addVar("_widget", "script_url", $gEnvManager->getScriptsUrl());