7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
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_m_blogBaseWidgetContainer.php 3836 2010-11-17 06:05:07Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/blogDb.php');
19 class admin_m_blogBaseWidgetContainer extends BaseAdminWidgetContainer
21 protected $_db; // DB接続オブジェクト
22 protected $_blogId; // ブログID
23 const DEFAULT_TOP_PAGE = 'config'; // デフォルトのトップページ
24 const WIDGET_TITLE_NAME = 'ブログ(携帯)'; // ウィジェットタイトル名
25 const CF_ENTRY_VIEW_COUNT = 'm:entry_view_count'; // 記事表示数
26 const CF_ENTRY_VIEW_ORDER = 'm:entry_view_order'; // 記事表示方向
27 const CF_TITLE_COLOR = 'm:title_color'; // タイトルの背景色
32 function __construct()
35 parent::__construct();
37 // サブウィジェット起動のときだけ初期処理実行
38 if ($this->gEnv->getIsSubWidget()){
40 $this->_db = new blogDb();
45 $this->_loadConfig($this->_blogId);
51 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
53 * @param RequestManager $request HTTPリクエスト処理クラス
54 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
57 function _postAssign($request, &$param)
60 $openBy = $request->trimValueOf(M3_REQUEST_PARAM_OPEN_BY); // ウィンドウオープンタイプ
61 if (!empty($openBy)) $this->addOptionUrlParam(M3_REQUEST_PARAM_OPEN_BY, $openBy);
64 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
65 if (empty($task)) $task = self::DEFAULT_TOP_PAGE;
69 case 'config': // 基本設定
70 $linkList = ' >> 基本設定';// パンくずリスト
73 // ####### 上段メニューの作成 #######
74 $menuText = '<div id="configmenu-upper">' . M3_NL;
75 $menuText .= '<ul>' . M3_NL;
76 $baseUrl = $this->getAdminUrlWithOptionParam(true);// 画面定義ID付き
80 $link = $baseUrl . '&task=config';
81 if ($task == 'config'){
82 $current = 'id="current"';
84 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>基本設定</span></a></li>' . M3_NL;
87 $menuText .= '</ul>' . M3_NL;
88 $menuText .= '</div>' . M3_NL;
91 $linkList = '<div id="configmenu-top"><label>' . self::WIDGET_TITLE_NAME . $linkList . '</div>';
92 $outputText .= '<table width="90%"><tr><td>' . $linkList . $menuText . '</td></tr></table>' . M3_NL;
93 $this->tmpl->addVar("_widget", "menu_items", $outputText);
98 * @param string $blogId ブログID
99 * @return bool true=取得成功、false=取得失敗
101 function _loadConfig($blogId)
103 $this->_configArray = array();
106 $ret = $this->_db->getAllConfig($rows, $blogId);
109 $configCount = count($rows);
110 for ($i = 0; $i < $configCount; $i++){
111 $key = $rows[$i]['bg_id'];
112 $value = $rows[$i]['bg_value'];
113 $this->_configArray[$key] = $value;