OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / user_content / include / container / admin_user_contentBaseWidgetContainer.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    ユーザ作成コンテンツ
10  * @author     株式会社 毎日メディアサービス
11  * @copyright  Copyright 2010 株式会社 毎日メディアサービス.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: admin_user_contentBaseWidgetContainer.php 3655 2010-10-01 07:16:39Z fishbone $
14  * @link       http://www.m-media.co.jp
15  */
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/user_contentDb.php');
18
19 class admin_user_contentBaseWidgetContainer extends BaseAdminWidgetContainer
20 {
21         protected $_localDb;                    // DB接続オブジェクト
22         protected $_itemTypeArray;              // コンテンツ項目のデータタイプ
23         const DEFAULT_TOP_PAGE = 'content';             // デフォルトのトップページ
24         const WIDGET_TITLE_NAME = 'ユーザコンテンツ';                           // ウィジェットタイトル名
25         
26         /**
27          * コンストラクタ
28          */
29         function __construct()
30         {
31                 // 親クラスを呼び出す
32                 parent::__construct();
33                 
34                 // DBオブジェクト作成
35                 $this->_localDb = new user_contentDb();
36                 
37                 // コンテンツ項目タイプ
38                 $this->_itemTypeArray = array(  array(  'name' => 'HTML',               'value' => '0'),
39                                                                                 array(  'name' => 'テキスト',       'value' => '1'),
40                                                                                 array(  'name' => '数値',             'value' => '2'));
41         }
42         /**
43          * テンプレートにデータ埋め込む
44          *
45          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
46          *
47          * @param RequestManager $request               HTTPリクエスト処理クラス
48          * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
49          * @return                                                              なし
50          */
51         function _postAssign($request, &$param)
52         {
53                 // ウィンドウオープンタイプ取得
54                 $openBy = $request->trimValueOf(M3_REQUEST_PARAM_OPEN_BY);              // ウィンドウオープンタイプ
55                 if (!empty($openBy)) $this->addOptionUrlParam(M3_REQUEST_PARAM_OPEN_BY, $openBy);
56                 if ($openBy == 'simple') return;                        // シンプルウィンドウのときはメニューを表示しない
57                 
58                 // 表示画面を決定
59                 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
60                 if (empty($task)) $task = self::DEFAULT_TOP_PAGE;
61                 
62                 // パンくずリストを作成
63                 switch ($task){
64                         case 'content':         // コンテンツ管理
65                         case 'content_detail':          // コンテンツ管理(詳細)
66                                 $linkList = ' &gt;&gt; コンテンツ管理 &gt;&gt; コンテンツ部品一覧';// パンくずリスト
67                                 break;
68                         case 'room':            // ルーム管理
69                         case 'room_detail':             // ルーム管理(詳細)
70                                 $linkList = ' &gt;&gt; ルーム管理 &gt;&gt; ルーム一覧';// パンくずリスト
71                                 break;
72                         case 'tab':             // タブ定義
73                         case 'tab_detail':              // タブ定義(詳細)
74                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; タブ定義';// パンくずリスト
75                                 break;
76                         case 'item':            // コンテンツ項目
77                         case 'item_detail':             // コンテンツ項目(詳細)
78                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; コンテンツ部品定義';// パンくずリスト
79                                 break;
80                         case 'category':                // カテゴリ定義
81                         case 'category_detail':         // カテゴリ定義(詳細)
82                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; カテゴリ定義';// パンくずリスト
83                                 break;
84                                 break;
85                         case 'other':           // その他設定
86                                 $linkList = ' &gt;&gt; 基本設定 &gt;&gt; その他';// パンくずリスト
87                                 break;
88                 }
89                 // ####### 上段メニューの作成 #######
90                 $menuText = '<div id="configmenu-upper">' . M3_NL;
91                 $menuText .= '<ul>' . M3_NL;
92                 $baseUrl = $this->getAdminUrlWithOptionParam(true);// 画面定義ID付き
93                 
94                 // コンテンツ管理
95                 $current = '';
96                 $link = $baseUrl . '&task=content';
97                 if ($task == 'content' ||
98                         $task == 'content_detail'){
99                         $current = 'id="current"';
100                 }
101                 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>コンテンツ管理</span></a></li>' . M3_NL;
102                 
103                 // ルーム管理
104                 $current = '';
105                 $link = $baseUrl . '&task=room';
106                 if ($task == 'room' ||
107                         $task == 'room_detail'){
108                         $current = 'id="current"';
109                 }
110                 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>ルーム管理</span></a></li>' . M3_NL;
111                 
112                 // その他設定
113                 $current = '';
114                 $link = $baseUrl . '&task=other';
115                 if ($task == 'tab' ||           // タブ定義
116                         $task == 'tab_detail' ||                // タブ定義(詳細)
117                         $task == 'item' ||              // コンテンツ項目
118                         $task == 'item_detail' ||               // コンテンツ項目(詳細)
119                         $task == 'category' ||          // カテゴリ定義
120                         $task == 'category_detail' ||           // カテゴリ定義(詳細)
121                         $task == 'other'){              // その他
122                         $current = 'id="current"';
123                 }
124                 $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>基本設定</span></a></li>' . M3_NL;
125                 
126                 // 上段メニュー終了
127                 $menuText .= '</ul>' . M3_NL;
128                 $menuText .= '</div>' . M3_NL;
129                 
130                 // ####### 下段メニューの作成 #######          
131                 $menuText .= '<div id="configmenu-lower">' . M3_NL;
132                 $menuText .= '<ul>' . M3_NL;
133
134                 if ($task == 'content' ||
135                         $task == 'content_detail'){     // コンテンツ管理
136                         // コンテンツ管理
137                         $current = '';
138                         $link = $baseUrl . '&task=content';
139                         if ($task == 'content' || $task == 'content_detail') $current = 'id="current"';
140                         $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>コンテンツ部品一覧</span></a></li>' . M3_NL;
141                 } else if ($task == 'room' ||
142                         $task == 'room_detail'){        // ルーム管理
143                         // ルーム管理
144                         $current = '';
145                         $link = $baseUrl . '&task=room';
146                         if ($task == 'room' || $task == 'room_detail') $current = 'id="current"';
147                         $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>ルーム一覧</span></a></li>' . M3_NL;
148                 } else if ($task == 'tab' ||            // タブ定義
149                         $task == 'tab_detail' ||                // タブ定義(詳細)
150                         $task == 'item' ||              // コンテンツ項目
151                         $task == 'item_detail' ||               // コンテンツ項目(詳細)
152                         $task == 'category' ||          // カテゴリ定義
153                         $task == 'category_detail' ||           // カテゴリ定義(詳細)
154                         $task == 'other'){              // その他
155                         
156                         // コンテンツ項目
157                         $current = '';
158                         $link = $baseUrl . '&task=item';
159                         if ($task == 'item' || $task == 'item_detail') $current = 'id="current"';
160                         $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>コンテンツ部品定義</span></a></li>' . M3_NL;
161                         
162                         // タブ定義
163                         $current = '';
164                         $link = $baseUrl . '&task=tab';
165                         if ($task == 'tab' || $task == 'tab_detail') $current = 'id="current"';
166                         $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>タブ定義</span></a></li>' . M3_NL;
167                         
168                         // カテゴリ定義
169                         $current = '';
170                         $link = $baseUrl . '&task=category';
171                         if ($task == 'category' || $task == 'category_detail') $current = 'id="current"';
172                         $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>カテゴリ定義</span></a></li>' . M3_NL;
173                         
174                         // その他設定
175                         $current = '';
176                         $link = $baseUrl . '&task=other';
177                         if ($task == 'other') $current = 'id="current"';
178                         $menuText .= '<li ' . $current . '><a href="'. $this->getUrl($link, true) .'"><span>その他</span></a></li>' . M3_NL;
179                 }
180                 
181                 // 下段メニュー終了
182                 $menuText .= '</ul>' . M3_NL;
183                 $menuText .= '</div>' . M3_NL;
184                 
185                 // 作成データの埋め込み
186                 $linkList = '<div id="configmenu-top"><label>' . self::WIDGET_TITLE_NAME . $linkList . '</div>';
187                 $outputText .= '<table width="90%"><tr><td>' . $linkList . $menuText . '</td></tr></table>' . M3_NL;
188                 $this->tmpl->addVar("_widget", "menu_items", $outputText);
189         }
190 }
191 ?>