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-2012 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: admin_blog_mainBaseWidgetContainer.php 5145 2012-08-29 13:21:42Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetContainerPath() . '/blog_mainCommonDef.php');
18 require_once($gEnvManager->getCurrentWidgetDbPath() . '/blog_mainDb.php');
20 class admin_blog_mainBaseWidgetContainer extends BaseAdminWidgetContainer
22 protected static $_mainDb; // DB接続オブジェクト
23 protected static $_configArray; // ブログ定義値
24 const DEFAULT_COMMENT_LENGTH = 300; // デフォルトのコメント最大文字数
25 const DEFAULT_CATEGORY_COUNT = 2; // デフォルトのカテゴリ数
28 const CALENDAR_SCRIPT_FILE = '/jscalendar-1.0/calendar.js'; // カレンダースクリプトファイル
29 const CALENDAR_LANG_FILE = '/jscalendar-1.0/lang/calendar-ja.js'; // カレンダー言語ファイル
30 const CALENDAR_SETUP_FILE = '/jscalendar-1.0/calendar-setup.js'; // カレンダーセットアップファイル
31 const CALENDAR_CSS_FILE = '/jscalendar-1.0/calendar-win2k-1.css'; // カレンダー用CSSファイル
33 const TASK_CONFIG = 'config'; // その他設定
34 const TASK_HISTORY = 'history'; // ブログ記事履歴
39 function __construct()
42 parent::__construct();
45 if (!isset(self::$_mainDb)) self::$_mainDb = new blog_mainDb();
48 if (!isset(self::$_configArray)) self::$_configArray = blog_mainCommonDef::loadConfig(self::$_mainDb);
53 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
55 * @param RequestManager $request HTTPリクエスト処理クラス
56 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
59 function _postAssign($request, &$param)
61 $openBy = $request->trimValueOf(M3_REQUEST_PARAM_OPEN_BY); // ウィンドウオープンタイプ
62 if (!empty($openBy)) $this->addOptionUrlParam(M3_REQUEST_PARAM_OPEN_BY, $openBy);
63 if ($openBy == 'simple') return; // シンプルウィンドウのときはメニューを表示しない
66 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
67 if (empty($task)) $task = 'entry';
71 case 'entry': // ブログ記事
72 case 'entry_detail': // ブログ記事詳細
73 case self::TASK_HISTORY: // ブログ記事履歴
74 $linkList = ' >> ブログ記事 >> 記事一覧';// パンくずリスト
76 case 'comment': // ブログ記事コメント
77 case 'comment_detail': // ブログ記事コメント
78 $linkList = ' >> ブログ記事 >> コメント一覧';// パンくずリスト
81 case 'user_detail': // ユーザ管理(詳細)
82 $linkList = ' >> ユーザ管理 >> ユーザ一覧';// パンくずリスト
84 case self::TASK_CONFIG: // ブログ設定
85 $linkList = ' >> 基本設定 >> ブログ設定';// パンくずリスト
87 case 'category': // カテゴリ設定
88 case 'category_detail': // カテゴリ設定
89 $linkList = ' >> 基本設定 >> カテゴリ';// パンくずリスト
91 case 'blogid': // マルチブログ設定
92 case 'blogid_detail': // マルチブログ設定
93 $linkList = ' >> 基本設定 >> マルチブログ';// パンくずリスト
97 // ####### 上段メニューの作成 #######
98 $menuText = '<div id="configmenu-upper">' . M3_NL;
99 $menuText .= '<ul>' . M3_NL;
102 $baseUrl = $this->getAdminUrlWithOptionParam();
106 $link = $baseUrl . '&task=entry';
107 if ($task == 'entry' ||
108 $task == 'entry_detail' ||
109 $task == self::TASK_HISTORY || // ブログ記事履歴
110 $task == 'comment' || // ブログ記事コメント管理
111 $task == 'comment_detail'){
112 $current = 'id="current"';
114 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>ブログ記事</span></a></li>' . M3_NL;
118 $link = $baseUrl . '&task=category';
119 if ($task == 'category' || // カテゴリ設定
120 $task == 'category_detail' || // カテゴリ設定
121 $task == 'blogid' || // マルチブログ
122 $task == 'blogid_detail' || // マルチブログ詳細
123 $task == self::TASK_CONFIG){ // ブログ設定
124 $current = 'id="current"';
126 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>基本設定</span></a></li>' . M3_NL;
129 $menuText .= '</ul>' . M3_NL;
130 $menuText .= '</div>' . M3_NL;
132 // ####### 下段メニューの作成 #######
133 $menuText .= '<div id="configmenu-lower">' . M3_NL;
134 $menuText .= '<ul>' . M3_NL;
136 if ($task == 'entry' || // ブログ記事管理
137 $task == 'entry_detail' ||
138 $task == self::TASK_HISTORY || // ブログ記事履歴
139 $task == 'comment' || // ブログ記事コメント管理
140 $task == 'comment_detail'){
144 $link = $baseUrl . '&task=entry';
145 if ($task == 'entry' || $task == 'entry_detail' || $task == self::TASK_HISTORY) $current = 'id="current"';
146 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>記事一覧</span></a></li>' . M3_NL;
150 $link = $baseUrl . '&task=comment';
151 if ($task == 'comment' || $task == 'comment_detail') $current = 'id="current"';
152 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>コメント一覧</span></a></li>' . M3_NL;
153 } else if ($task == 'category' || // カテゴリ設定
154 $task == 'category_detail' || // カテゴリ設定
155 $task == 'blogid' || // マルチブログ
156 $task == 'blogid_detail' || // マルチブログ詳細
157 $task == self::TASK_CONFIG){ // ブログ設定
161 $link = $baseUrl . '&task=category';
162 if ($task == 'category' || $task == 'category_detail') $current = 'id="current"';
163 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>カテゴリ</span></a></li>' . M3_NL;
167 $link = $baseUrl . '&task=blogid';
168 if ($task == 'blogid' || $task == 'blogid_detail') $current = 'id="current"';
169 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>マルチブログ</span></a></li>' . M3_NL;
173 $link = $baseUrl . '&task=config';
174 if ($task == self::TASK_CONFIG) $current = 'id="current"';
175 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>ブログ設定</span></a></li>' . M3_NL;
179 $menuText .= '</ul>' . M3_NL;
180 $menuText .= '</div>' . M3_NL;
183 $linkList = '<div id="configmenu-top"><label>' . 'ブログ' . $linkList . '</div>';
184 $outputText .= '<table width="90%"><tr><td>' . $linkList . $menuText . '</td></tr></table>' . M3_NL;
185 $this->tmpl->addVar("_widget", "menu_items", $outputText);