OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / blog_main / include / container / admin_blog_mainBaseWidgetContainer.php
1 <?php
2 /**
3  * index.php用コンテナクラス
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    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
15  */
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetContainerPath() . '/blog_mainCommonDef.php');
18 require_once($gEnvManager->getCurrentWidgetDbPath() . '/blog_mainDb.php');
19
20 class admin_blog_mainBaseWidgetContainer extends BaseAdminWidgetContainer
21 {
22         protected static $_mainDb;                      // DB接続オブジェクト
23         protected static $_configArray;         // ブログ定義値
24         const DEFAULT_COMMENT_LENGTH    = 300;                          // デフォルトのコメント最大文字数
25         const DEFAULT_CATEGORY_COUNT    = 2;                            // デフォルトのカテゴリ数
26         
27         // カレンダー用スクリプト
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ファイル
32         // 画面
33         const TASK_CONFIG = 'config';                                                           // その他設定
34         const TASK_HISTORY = 'history';                                                 // ブログ記事履歴
35         
36         /**
37          * コンストラクタ
38          */
39         function __construct()
40         {
41                 // 親クラスを呼び出す
42                 parent::__construct();
43                 
44                 // DBオブジェクト作成
45                 if (!isset(self::$_mainDb)) self::$_mainDb = new blog_mainDb();
46                 
47                 // ブログ定義を読み込む
48                 if (!isset(self::$_configArray)) self::$_configArray = blog_mainCommonDef::loadConfig(self::$_mainDb);
49         }
50         /**
51          * テンプレートにデータ埋め込む
52          *
53          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
54          *
55          * @param RequestManager $request               HTTPリクエスト処理クラス
56          * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
57          * @return                                                              なし
58          */
59         function _postAssign($request, &$param)
60         {
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;                        // シンプルウィンドウのときはメニューを表示しない
64                 
65                 // 表示画面を決定
66                 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
67                 if (empty($task)) $task = 'entry';
68                 
69                 // パンくずリストを作成
70                 switch ($task){
71                         case 'entry':           // ブログ記事
72                         case 'entry_detail':    // ブログ記事詳細
73                         case self::TASK_HISTORY:                                                        // ブログ記事履歴
74                                 $linkList = ' &gt;&gt; ブログ記事 &gt;&gt; 記事一覧';// パンくずリスト
75                                 break;
76                         case 'comment':         // ブログ記事コメント
77                         case 'comment_detail':  // ブログ記事コメント
78                                 $linkList = ' &gt;&gt; ブログ記事 &gt;&gt; コメント一覧';// パンくずリスト
79                                 break;
80                         case 'user':            // ユーザ管理
81                         case 'user_detail':             // ユーザ管理(詳細)
82                                 $linkList = ' &gt;&gt; ユーザ管理 &gt;&gt; ユーザ一覧';// パンくずリスト
83                                 break;
84                         case self::TASK_CONFIG:         // ブログ設定
85                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; ブログ設定';// パンくずリスト
86                                 break;
87                         case 'category':                // カテゴリ設定
88                         case 'category_detail':         // カテゴリ設定
89                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; カテゴリ';// パンくずリスト
90                                 break;
91                         case 'blogid':          // マルチブログ設定
92                         case 'blogid_detail':           // マルチブログ設定
93                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; マルチブログ';// パンくずリスト
94                                 break;
95                 }
96
97                 // ####### 上段メニューの作成 #######
98                 $menuText = '<div id="configmenu-upper">' . M3_NL;
99                 $menuText .= '<ul>' . M3_NL;
100                 
101                 $current = '';
102                 $baseUrl = $this->getAdminUrlWithOptionParam();
103                 
104                 // ブログ記事管理
105                 $current = '';
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"';
113                 }
114                 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>ブログ記事</span></a></li>' . M3_NL;
115                 
116                 // 基本設定
117                 $current = '';
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"';
125                 }
126                 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link) .'"><span>基本設定</span></a></li>' . M3_NL;
127                 
128                 // 上段メニュー終了
129                 $menuText .= '</ul>' . M3_NL;
130                 $menuText .= '</div>' . M3_NL;
131                 
132                 // ####### 下段メニューの作成 #######          
133                 $menuText .= '<div id="configmenu-lower">' . M3_NL;
134                 $menuText .= '<ul>' . M3_NL;
135
136                 if ($task == 'entry' ||         // ブログ記事管理
137                         $task == 'entry_detail' ||
138                         $task == self::TASK_HISTORY ||  // ブログ記事履歴
139                         $task == 'comment' ||           // ブログ記事コメント管理
140                         $task == 'comment_detail'){
141                         
142                         // ブログ記事一覧
143                         $current = '';
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;
147                         
148                         // ブログ記事コメント一覧
149                         $current = '';
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){            // ブログ設定
158                         
159                         // カテゴリ設定
160                         $current = '';
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;
164                         
165                         // マルチブログ
166                         $current = '';
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;
170                         
171                         // その他設定
172                         $current = '';
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;
176                 }
177                 
178                 // 下段メニュー終了
179                 $menuText .= '</ul>' . M3_NL;
180                 $menuText .= '</div>' . M3_NL;
181
182                 // 作成データの埋め込み
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);
186         }
187 }
188 ?>