OSDN Git Service

DB更新スクリプト更新。
[magic3/magic3.git] / widgets / m / chacha / include / container / admin_m_chachaOtherWidgetContainer.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_m_chachaOtherWidgetContainer.php 3282 2010-06-23 05:58:43Z fishbone $
14  * @link       http://www.m-media.co.jp
15  */
16 require_once($gEnvManager->getCurrentWidgetContainerPath() . '/admin_m_chachaBaseWidgetContainer.php');
17
18 class admin_m_chachaOtherWidgetContainer extends admin_m_chachaBaseWidgetContainer
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                 */
63                 $topContents = $request->valueOf('top_contents');       // トップコンテンツ
64                 
65                 $reloadData = false;            // データの再読み込み
66                 if ($act == 'update'){          // 設定更新のとき
67                         // 入力値のエラーチェック
68                         
69                         if ($this->getMsgCount() == 0){                 // エラーのないとき
70                                 $ret = true;
71                         /*      if ($ret) $this->_db->updateConfig(self::CF_TEXT_COLOR, $textColor, $this->_boardId);   // 文字色
72                                 if ($ret) $this->_db->updateConfig(self::CF_BG_COLOR, $bgColor, $this->_boardId);       // 背景色
73                                 if ($ret) $this->_db->updateConfig(self::CF_INNER_BG_COLOR, $innerBgColor, $this->_boardId);    // 内枠背景色
74                                 if ($ret) $this->_db->updateConfig(self::CF_PROFILE_COLOR, $profileColor, $this->_boardId);     // プロフィール背景色
75                                 if ($ret) $this->_db->updateConfig(self::CF_ERR_MESSAGE_COLOR, $errMessageColor, $this->_boardId);      // エラーメッセージ文字色
76                                 if ($ret) $this->_db->updateConfig(self::CF_MESSAGE_LENGTH, $messageLength, $this->_boardId);   // 投稿文最大長
77                                 */
78                                 if ($ret){
79                                         // 絵文字画像タグをMagic3内部タグに変換
80                                         $this->gInstance->getTextConvManager()->convToEmojiTag($topContents, $html);
81                                         
82                                         $this->_db->updateConfig(self::CF_TOP_CONTENTS, $html, $this->_boardId);        // トップコンテンツ
83                                 }
84                                 
85                                 if ($ret){
86                                         $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
87                                 } else {
88                                         $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
89                                 }
90                                 $this->gPage->updateParentWindow();// 親ウィンドウを更新
91                         }
92                 } else {                // 初期表示の場合
93                         $reloadData = true;             // データの再読み込み
94                 }
95                 if ($reloadData){
96 /*                      $textColor = $this->_configArray[self::CF_TEXT_COLOR];  // 文字色
97                         $bgColor = $this->_configArray[self::CF_BG_COLOR];      // 背景色
98                         $innerBgColor = $this->_configArray[self::CF_INNER_BG_COLOR];   // 内枠背景色
99                         $profileColor = $this->_configArray[self::CF_PROFILE_COLOR];    // プロフィール背景色
100                         $errMessageColor = $this->_configArray[self::CF_ERR_MESSAGE_COLOR];     // エラーメッセージ文字色
101                         $messageLength = $this->_configArray[self::CF_MESSAGE_LENGTH];  // 投稿文最大長*/
102                         $topContents = $this->_configArray[self::CF_TOP_CONTENTS];      // トップコンテンツ
103                         
104                         // コンテンツの変換
105                         $topContents = str_replace(M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $this->getUrl($this->gEnv->getRootUrl()), $topContents);  // Magic3ルートURLの変換
106                         $this->gInstance->getTextConvManager()->convFromEmojiTag($topContents, $topContents);// Magic3内部タグから絵文字画像タグに変換
107                 }
108                 // 画面に書き戻す
109 /*              $this->tmpl->addVar("_widget", "text_color", $textColor);               // 文字色
110                 $this->tmpl->addVar("_widget", "bg_color", $bgColor);           // 背景色
111                 $this->tmpl->addVar("_widget", "inner_bg_color", $innerBgColor);                // 内枠背景色
112                 $this->tmpl->addVar("_widget", "profile_color", $profileColor);         // プロフィール背景色
113                 $this->tmpl->addVar("_widget", "err_message_color", $errMessageColor);  // エラーメッセージ文字色
114                 $this->tmpl->addVar("_widget", "message_length", $messageLength);       // 投稿文最大長
115                 */
116                 $this->tmpl->addVar("_widget", "top_contents", $topContents);   // トップコンテンツ
117         }
118 }
119 ?>