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-2013 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: admin_photo_mainBaseWidgetContainer.php 5599 2013-02-06 11:47:30Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getCurrentWidgetContainerPath() . '/photo_mainCommonDef.php');
17 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
18 require_once($gEnvManager->getCurrentWidgetDbPath() . '/photo_mainDb.php');
20 class admin_photo_mainBaseWidgetContainer extends BaseAdminWidgetContainer
22 protected static $_mainDb; // DB接続オブジェクト
23 protected static $_configArray; // BBS定義値
24 protected static $_isLimitedUser; // 使用制限ユーザ(画像投稿者)かどうか
25 protected $_openBy; // ウィンドウオープンタイプ
26 protected $_baseUrl; // 管理画面のベースURL
27 protected $_langId; // 現在の言語
28 protected $_userId; // 現在のユーザ
29 protected $_errMessage; // エラーメッセージ
30 /* const CF_RECEIVE_COMMENT = 'receive_comment'; // コメントを受け付けるかどうか
31 const CF_RECEIVE_TRACKBACK = 'receive_trackback'; // トラックバックを受け付けるかどうか
32 const CF_ENTRY_VIEW_COUNT = 'entry_view_count'; // 記事表示数
33 const CF_ENTRY_VIEW_ORDER = 'entry_view_order'; // 記事表示方向
34 const CF_MAX_COMMENT_LENGTH = 'comment_max_length'; // コメント最大文字数
35 const CF_USE_MULTI_BLOG = 'use_multi_blog'; // マルチブログ機能を使用するかどうか
36 const CF_MULTI_BLOG_TOP_CONTENT = 'multi_blog_top_content'; // マルチブログ時のトップコンテンツ
37 const CF_CATEGORY_COUNT = 'category_count'; // カテゴリ数
38 const DEFAULT_COMMENT_LENGTH = 300; // デフォルトのコメント最大文字数
39 const DEFAULT_CATEGORY_COUNT = 2; // デフォルトのカテゴリ数
41 const DEFAULT_TASK = 'imagebrowse'; // デフォルトの画面
44 const CALENDAR_SCRIPT_FILE = '/jscalendar-1.0/calendar.js'; // カレンダースクリプトファイル
45 const CALENDAR_LANG_FILE = '/jscalendar-1.0/lang/calendar-ja.js'; // カレンダー言語ファイル
46 const CALENDAR_SETUP_FILE = '/jscalendar-1.0/calendar-setup.js'; // カレンダーセットアップファイル
47 const CALENDAR_CSS_FILE = '/jscalendar-1.0/calendar-win2k-1.css'; // カレンダー用CSSファイル
52 function __construct()
55 parent::__construct();
58 if (!isset(self::$_mainDb)) self::$_mainDb = new photo_mainDb();
61 if (!isset(self::$_configArray)) self::$_configArray = photo_mainCommonDef::loadConfig(self::$_mainDb);
63 // システム運用者の場合は、ユーザオプションがあればユーザ専用ディレクトリに制限
64 if (!isset(self::$_isLimitedUser)){
65 $ret = $this->gEnv->hasUserTypeOption(photo_mainCommonDef::USER_OPTION);
67 self::$_isLimitedUser = true; // 使用制限ユーザ(画像投稿者)かどうか
69 self::$_isLimitedUser = false;
74 $this->_langId = $this->gEnv->getCurrentLanguage(); // 表示言語を取得
75 $this->_userId = $this->gEnv->getCurrentUserId();
80 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
82 * @param RequestManager $request HTTPリクエスト処理クラス
83 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
86 function _preAssign($request, &$param)
88 $this->openBy = $request->trimValueOf(M3_REQUEST_PARAM_OPEN_BY); // ウィンドウオープンタイプ
89 if (!empty($this->openBy)) $this->addOptionUrlParam(M3_REQUEST_PARAM_OPEN_BY, $this->openBy);
92 $this->_baseUrl = $this->getAdminUrlWithOptionParam();
97 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
99 * @param RequestManager $request HTTPリクエスト処理クラス
100 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
103 function _postAssign($request, &$param)
105 if ($this->openBy == 'simple') return; // シンプルウィンドウのときはメニューを表示しない
107 // 使用限定ユーザの場合はメニュー表示しない
108 if (self::$_isLimitedUser) return;
111 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
112 if (empty($task)) $task = self::DEFAULT_TASK;
115 if ($task == 'imagebrowse_direct') return;
119 case 'imagebrowse': // 画像管理
120 case 'imagebrowse_detail': // 画像管理詳細
121 $linkList = ' >> 画像管理 >> 画像一覧';// パンくずリスト
123 case 'comment': // 画像コメント
124 case 'comment_detail': // 画像コメント
125 $linkList = ' >> 画像管理 >> コメント一覧';// パンくずリスト
127 case 'author': // 画像管理者一覧
128 case 'author_detail': // 画像管理者詳細
129 $linkList = ' >> 基本設定 >> 画像管理者一覧';// パンくずリスト
131 case 'category': // 画像カテゴリー一覧
132 case 'category_detail': // 画像カテゴリー詳細
133 $linkList = ' >> 基本設定 >> 画像カテゴリー一覧';// パンくずリスト
135 case 'search': // 検索条件
136 $linkList = ' >> 基本設定 >> 検索条件';// パンくずリスト
138 case 'config': // フォトギャラリー設定
139 $linkList = ' >> 基本設定 >> フォトギャラリー設定';// パンくずリスト
143 // ####### 上段メニューの作成 #######
144 $menuText = '<div id="configmenu-upper">' . M3_NL;
145 $menuText .= '<ul>' . M3_NL;
151 $link = $this->_baseUrl . '&task=imagebrowse';
152 if ($task == 'imagebrowse' ||
153 $task == 'imagebrowse_detail' ||
154 $task == 'comment' || // 画像コメント一覧
155 $task == 'comment_detail'){ // 画像コメント詳細
156 $current = 'id="current"';
158 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>画像管理</span></a></li>' . M3_NL;
162 $link = $this->_baseUrl . '&task=author';
163 if ($task == 'author' || // 画像管理者一覧
164 $task == 'author_detail' || // 画像管理者詳細
165 $task == 'category' || // 画像カテゴリー一覧
166 $task == 'category_detail' || // 画像カテゴリー詳細
167 $task == 'search' || // 検索条件
168 $task == 'config'){ // ブログ設定
169 $current = 'id="current"';
171 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>基本設定</span></a></li>' . M3_NL;
174 $menuText .= '</ul>' . M3_NL;
175 $menuText .= '</div>' . M3_NL;
177 // ####### 下段メニューの作成 #######
178 $menuText .= '<div id="configmenu-lower">' . M3_NL;
179 $menuText .= '<ul>' . M3_NL;
181 if ($task == 'imagebrowse' ||
182 $task == 'imagebrowse_detail' ||
183 $task == 'comment' || // 画像コメント一覧
184 $task == 'comment_detail'){ // 画像コメント詳細
188 $link = $this->_baseUrl . '&task=imagebrowse';
189 if ($task == 'imagebrowse' || $task == 'imagebrowse_detail') $current = 'id="current"';
190 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>画像一覧</span></a></li>' . M3_NL;
194 $link = $this->_baseUrl . '&task=comment';
195 if ($task == 'comment' || $task == 'comment_detail') $current = 'id="current"';
196 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>コメント一覧</span></a></li>' . M3_NL;
197 } else if ($task == 'author' || // 画像管理者一覧
198 $task == 'author_detail' || // 画像管理者詳細
199 $task == 'category' || // 画像カテゴリー一覧
200 $task == 'category_detail' || // 画像カテゴリー詳細
201 $task == 'search' || // 検索条件
202 $task == 'config'){ // ブログ設定
206 $link = $this->_baseUrl . '&task=author';
207 if ($task == 'author' || $task == 'author_detail') $current = 'id="current"';
208 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>画像管理者</span></a></li>' . M3_NL;
212 $link = $this->_baseUrl . '&task=category';
213 if ($task == 'category' || $task == 'category_detail') $current = 'id="current"';
214 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>画像カテゴリー</span></a></li>' . M3_NL;
218 $link = $this->_baseUrl . '&task=search';
219 if ($task == 'search') $current = 'id="current"';
220 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>検索条件</span></a></li>' . M3_NL;
224 $link = $this->_baseUrl . '&task=config';
225 if ($task == 'config') $current = 'id="current"';
226 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>フォトギャラリー設定</span></a></li>' . M3_NL;
230 $menuText .= '</ul>' . M3_NL;
231 $menuText .= '</div>' . M3_NL;
234 $linkList = '<div id="configmenu-top"><label>' . 'フォトギャラリー' . $linkList . '</div>';
235 $outputText .= '<table width="90%"><tr><td>' . $linkList . $menuText . '</td></tr></table>' . M3_NL;
236 $this->tmpl->addVar("_widget", "menu_items", $outputText);
241 * @param array $values キーと値の連想配列
242 * @return bool true=成功、false=失敗
244 function _updateConfig($values)
246 if (empty($values)) return false;
248 foreach ($values as $key => $value){
249 $ret = self::$_mainDb->updateConfig($key, $value);
251 $this->_errMessage = $key;
260 * @return string メッセージ
262 function _getErrMessage()
264 return $this->_errMessage; // エラーメッセージ