OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / chacha_main / include / container / admin_chacha_mainOtherWidgetContainer.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    マイクロブログ
10  * @author     株式会社 毎日メディアサービス
11  * @copyright  Copyright 2010 株式会社 毎日メディアサービス.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: admin_chacha_mainOtherWidgetContainer.php 3238 2010-06-14 05:05:09Z fishbone $
14  * @link       http://www.m-media.co.jp
15  */
16 require_once($gEnvManager->getCurrentWidgetContainerPath() . '/admin_chacha_mainBaseWidgetContainer.php');
17
18 class admin_chacha_mainOtherWidgetContainer extends admin_chacha_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 'admin_other.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                 $defaultLang    = $this->gEnv->getDefaultLanguage();
54                 $act = $request->trimValueOf('act');
55                 
56                 $textColor = $request->trimValueOf('text_color');                               // 文字色
57                 $bgColor = $request->trimValueOf('bg_color');                           // 背景色
58                 $innerBgColor = $request->trimValueOf('inner_bg_color');                // 内枠背景色
59                 $profileColor = $request->trimValueOf('profile_color');         // プロフィール背景色
60                 $errMessageColor = $request->trimValueOf('err_message_color');  // エラーメッセージ文字色
61                 $messageLength = $request->trimValueOf('message_length');       // 投稿文最大長
62                 $topContents = $request->valueOf('top_contents');       // トップコンテンツ
63                 
64                 $reloadData = false;            // データの再読み込み
65                 if ($act == 'update'){          // 設定更新のとき
66                         // 入力値のエラーチェック
67                         
68                         if ($this->getMsgCount() == 0){                 // エラーのないとき
69                                 $ret = true;
70                                 if ($ret) $this->_db->updateConfig(self::CF_TEXT_COLOR, $textColor, $this->_boardId);   // 文字色
71                                 if ($ret) $this->_db->updateConfig(self::CF_BG_COLOR, $bgColor, $this->_boardId);       // 背景色
72                                 if ($ret) $this->_db->updateConfig(self::CF_INNER_BG_COLOR, $innerBgColor, $this->_boardId);    // 内枠背景色
73                                 if ($ret) $this->_db->updateConfig(self::CF_PROFILE_COLOR, $profileColor, $this->_boardId);     // プロフィール背景色
74                                 if ($ret) $this->_db->updateConfig(self::CF_ERR_MESSAGE_COLOR, $errMessageColor, $this->_boardId);      // エラーメッセージ文字色
75                                 if ($ret) $this->_db->updateConfig(self::CF_MESSAGE_LENGTH, $messageLength, $this->_boardId);   // 投稿文最大長
76                                 if ($ret) $this->_db->updateConfig(self::CF_TOP_CONTENTS, $topContents, $this->_boardId);       // トップコンテンツ
77                                 
78                                 if ($ret){
79                                         $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
80                                 } else {
81                                         $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
82                                 }
83                                 $this->gPage->updateParentWindow();// 親ウィンドウを更新
84                         }
85                 } else {                // 初期表示の場合
86                         $reloadData = true;             // データの再読み込み
87                 }
88                 if ($reloadData){
89                         $textColor = $this->_configArray[self::CF_TEXT_COLOR];  // 文字色
90                         $bgColor = $this->_configArray[self::CF_BG_COLOR];      // 背景色
91                         $innerBgColor = $this->_configArray[self::CF_INNER_BG_COLOR];   // 内枠背景色
92                         $profileColor = $this->_configArray[self::CF_PROFILE_COLOR];    // プロフィール背景色
93                         $errMessageColor = $this->_configArray[self::CF_ERR_MESSAGE_COLOR];     // エラーメッセージ文字色
94                         $messageLength = $this->_configArray[self::CF_MESSAGE_LENGTH];  // 投稿文最大長
95                         $topContents = $this->_configArray[self::CF_TOP_CONTENTS];      // トップコンテンツ
96                 }
97                 // 画面に書き戻す
98                 $this->tmpl->addVar("_widget", "text_color", $textColor);               // 文字色
99                 $this->tmpl->addVar("_widget", "bg_color", $bgColor);           // 背景色
100                 $this->tmpl->addVar("_widget", "inner_bg_color", $innerBgColor);                // 内枠背景色
101                 $this->tmpl->addVar("_widget", "profile_color", $profileColor);         // プロフィール背景色
102                 $this->tmpl->addVar("_widget", "err_message_color", $errMessageColor);  // エラーメッセージ文字色
103                 $this->tmpl->addVar("_widget", "message_length", $messageLength);       // 投稿文最大長
104                 $this->tmpl->addVar("_widget", "top_contents", $topContents);   // トップコンテンツ
105         }
106 }
107 ?>