OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / s / custom_footer / include / container / admin_s_custom_footerWidgetContainer.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-2010 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: admin_s_custom_footerWidgetContainer.php 3440 2010-07-30 03:47:05Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
17
18 class admin_s_custom_footerWidgetContainer extends BaseAdminWidgetContainer
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 'admin.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                 if ($act == 'update'){          // 設定更新のとき
55                         // 入力値を取得
56                         $footContent    = $request->valueOf('item_content');                    // フッタコンテンツ
57                         
58                         if ($this->getMsgCount() == 0){                 // エラーのないとき
59                                 $paramObj->footContent  = $footContent;         // フッタコンテンツ
60                                 $ret = $this->updateWidgetParamObj($paramObj);
61                                 if ($ret){
62                                         $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
63                                 } else {
64                                         $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
65                                 }                               
66                         }
67                         $this->gPage->updateParentWindow();// 親ウィンドウを更新
68                 } else {                // 初期表示の場合
69                         // デフォルト値設定
70                         $footContent = '';      // フッタコンテンツ
71                         $footContent .= '<div align="center">(C) ' . date("Y") . ' Magic3.org</div>' . M3_NL;
72                         $footContent .= '<div align="center"><a href="http://www.magic3.org">Magic3 ' . M3_SYSTEM_VERSION . '</a> is licensed under the terms of the GNU General Public License.</div>' . M3_NL;
73                         $paramObj = $this->getWidgetParamObj();
74                         if (!empty($paramObj)){
75                                 $footContent    = $paramObj->footContent;                       // フッタコンテンツ
76                         }
77                 }
78                 
79                 // 画面にデータを埋め込む
80                 $this->tmpl->addVar("_widget", "content",       $footContent);
81         }
82 }
83 ?>