OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / ec_main / include / container / ec_mainChangepwdWidgetContainer.php
1 <?php
2 /**
3  * index.php用コンテナクラス
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: ec_mainChangepwdWidgetContainer.php 5440 2012-12-08 09:37:39Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getCurrentWidgetContainerPath() .    '/ec_mainBaseWidgetContainer.php');
17
18 class ec_mainChangepwdWidgetContainer extends ec_mainBaseWidgetContainer
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 object         $param                 任意使用パラメータ。そのまま_assign()に渡る
36          * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
37          */
38         function _setTemplate($request, &$param)
39         {       
40                 return 'changepwd.tmpl.html';
41         }
42         /**
43          * テンプレートにデータ埋め込む
44          *
45          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
46          *
47          * @param RequestManager $request               HTTPリクエスト処理クラス
48          * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
49          * @param                                                               なし
50          */
51         function _assign($request, &$param)
52         {
53                 $act = $request->trimValueOf('act');
54                 $password = $request->trimValueOf('password');
55                 $length = $request->trimValueOf('length');              // パスワード長
56                 if ($act == 'update'){                  // パスワード更新のとき
57                         // パスワード変更
58                         $ret = $this->_db->updateLoginUserPassword($this->gEnv->getCurrentUserId(), $password, true/*MD5化されているパスワード*/);
59                         if ($ret){
60                                 //$this->tmpl->addVar("_widget", "message", 'パスワード変更が完了しました');
61                                 $this->setGuidanceMsg('パスワード変更が完了しました');
62                                 $this->tmpl->addVar("_widget", "button_disabled", 'disabled');          // ボタン使用不可
63                                 $this->tmpl->addVar("_widget", "pwd1_disabled", 'disabled');            // 入力フィールド不可
64                                 $this->tmpl->addVar("_widget", "pwd2_disabled", 'disabled');            // 入力フィールド不可
65                                 
66                                 $this->tmpl->addVar("_widget", "pwd_value", str_repeat('*', $length));          // ダミー値を設定
67                                 
68                                 // 会員メニューへのリンクを表示
69                                 $this->tmpl->setAttribute('show_complete', 'visibility', 'visible');
70                                 $this->tmpl->addVar("show_complete", "menu_url", $this->getUrl($this->gEnv->createCurrentPageUrl() . '&task=membermenu', true));
71                         } else {
72                                 //$this->tmpl->addVar("_widget", "message", 'パスワード変更に失敗しました');
73                                 $this->setUserErrorMsg('パスワード変更に失敗しました');
74                         }
75                 }
76                 $this->tmpl->addVar("_widget", "button_label", 'パスワード変更');                // ボタンのラベル
77         }
78 }
79 ?>