7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
10 * @author 株式会社 毎日メディアサービス
11 * @copyright Copyright 2010 株式会社 毎日メディアサービス.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: admin_m_chachaBaseWidgetContainer.php 3282 2010-06-23 05:58:43Z fishbone $
14 * @link http://www.m-media.co.jp
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/chachaDb.php');
19 class admin_m_chachaBaseWidgetContainer extends BaseAdminWidgetContainer
21 protected $_db; // DB接続オブジェクト
22 protected $_boardId; // 掲示板ID
23 const DEFAULT_BBS_ID_HEAD = 'board'; // デフォルトの掲示板ID
24 const DEFAULT_TOP_PAGE = 'other'; // デフォルトのトップページ
25 const WIDGET_TITLE_NAME = 'マイクロブログ(携帯)'; // ウィジェットタイトル名
26 const CF_TEXT_COLOR = 'text_color'; // 文字色
27 const CF_BG_COLOR = 'bg_color'; // 背景色
28 const CF_INNER_BG_COLOR = 'inner_bg_color'; // 内枠背景色
29 const CF_PROFILE_COLOR = 'profile_color'; // プロフィール背景色
30 const CF_ERR_MESSAGE_COLOR = 'err_message_color'; // エラーメッセージ文字色
31 const CF_MESSAGE_LENGTH = 'message_length'; // 最大メッセージ長
32 const CF_TOP_CONTENTS = 'm:top_contents'; // トップコンテンツ(携帯)
37 function __construct()
40 parent::__construct();
42 // サブウィジェット起動のときだけ初期処理実行
43 if ($this->gEnv->getIsSubWidget()){
45 $this->_db = new chachaDb();
47 $this->_boardId = self::DEFAULT_BBS_ID_HEAD . '0';
50 $this->_loadConfig($this->_boardId);
56 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
58 * @param RequestManager $request HTTPリクエスト処理クラス
59 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
62 function _postAssign($request, &$param)
65 $openBy = $request->trimValueOf(M3_REQUEST_PARAM_OPEN_BY); // ウィンドウオープンタイプ
66 if (!empty($openBy)) $this->addOptionUrlParam(M3_REQUEST_PARAM_OPEN_BY, $openBy);
69 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
70 if (empty($task)) $task = self::DEFAULT_TOP_PAGE;
74 case 'other': // その他設定
75 $linkList = ' >> 基本設定';// パンくずリスト
78 // ####### 上段メニューの作成 #######
79 $menuText = '<div id="configmenu-upper">' . M3_NL;
80 $menuText .= '<ul>' . M3_NL;
81 $baseUrl = $this->getAdminUrlWithOptionParam(true);// 画面定義ID付き
85 $link = $baseUrl . '&task=other';
86 if ($task == 'other'){
87 $current = 'id="current"';
89 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>基本設定</span></a></li>' . M3_NL;
92 $menuText .= '</ul>' . M3_NL;
93 $menuText .= '</div>' . M3_NL;
96 $linkList = '<div id="configmenu-top"><label>' . self::WIDGET_TITLE_NAME . $linkList . '</div>';
97 $outputText .= '<table width="90%"><tr><td>' . $linkList . $menuText . '</td></tr></table>' . M3_NL;
98 $this->tmpl->addVar("_widget", "menu_items", $outputText);
103 * @param string $boardId 掲示板ID
104 * @return bool true=取得成功、false=取得失敗
106 function _loadConfig($boardId)
108 $this->_configArray = array();
111 $ret = $this->_db->getAllConfig($rows, $boardId);
114 $configCount = count($rows);
115 for ($i = 0; $i < $configCount; $i++){
116 $key = $rows[$i]['mc_id'];
117 $value = $rows[$i]['mc_value'];
118 $this->_configArray[$key] = $value;