9 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
11 * @package Magic3 Framework
12 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
13 * @copyright Copyright 2006-2014 Magic3 Project.
14 * @license http://www.gnu.org/copyleft/gpl.html GPL License
16 * @link http://www.magic3.org
18 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/core.php');
19 require_once(M3_SYSTEM_INCLUDE_PATH . '/common/scriptLibInfo.php');
21 class PageManager extends Core
23 private $popupMsg; // ポップアップダイアログメッセージ
24 private $showPositionMode; // ポジション表示モード
25 private $showWidget; // ウィジェットの単体表示
26 private $systemHandleMode; // システム制御遷移モード(1=サイト非公開時)
27 private $isPageEditable; // 一般画面ページ編集可能モード
28 private $isTransparentMode; // 画面透過モード
29 private $isEditMode; // 一般画面編集モード
30 private $tmpData; // データ作成用
31 private $db; // DBオブジェクト
32 private $defaultScriptFiles; // デフォルトで読み込むスクリプトファイル
33 private $defaultCssFiles; // デフォルトで読み込むCSSファイル
34 private $defaultAdminScriptFiles; // デフォルトで読み込むスクリプトファイル(管理用)
35 private $defaultAdminCssFiles; // デフォルトで読み込むCSSファイル(管理用)
36 private $defaultAdminDirScriptFiles; // デフォルトで読み込むスクリプトファイル(管理ディレクトリ用)
37 private $defaultAdminDirCssFiles; // デフォルトで読み込むCSSファイル(管理ディレクトリ用)
38 private $headScriptFiles = array(); // ウィジェットからの追加で読み込むスクリプトファイル
39 private $headPreMobileScriptFiles = array();// ウィジェットからの追加で読み込むスクリプトファイル(jQueryMobile用挿入ファイル)
40 private $headCssFiles = array(); // ウィジェットからの追加で読み込むCSSファイル
41 private $headRssFiles = array(); // HTMLヘッダに出力するRSS配信情報
42 private $pageDefPosition; // 現在取得しているページ定義のポジション
43 private $pageDefRows; // ページ定義レコード
44 private $nonSharedWidgetCount = -1; // 非共通ウィジェットの数(-1=ページ作成でないとき)
45 private $replaceHeadDone; // ヘッダマクロ変換処理が完了したかどうか
46 private $useHelp = false; // 標準ヘルプ機能を使用するかどうか
47 private $hasScriptCache = false; // JavaScriptファイルをブラウザにキャッシュさせるかどうか
48 private $isAccessPointWithAdminMenu; // 管理メニューを使用するアクセスポイントかどうか
49 private $lateLaunchWidgetList; // 遅延実行ウィジェットのリスト
50 private $latelaunchWidgetParam; // 遅延実行ウィジェットのパラメータ
51 private $viewPositions = array(); // テンプレート上のポジション
52 private $viewPosId = array(); // テンプレート上のポジションのタグID
53 private $updateParentWindow; // 親ウィンドウを再描画するかどうか
54 private $updateDefSerial; // 更新する項目のページ定義シリアル番号
55 private $headDescription; // HTMLヘッダ「description」に出力する文字列
56 private $headKeywords; // HTMLヘッダ「keywords」に出力する文字列
57 private $headOthers; // HTMLヘッダに出力するタグ文字列
58 private $lastHeadTitle; // 最後にヘッダ部titleにセットした文字列
59 private $lastHeadDescription; // 最後にヘッダ部descriptionにセットした文字列
60 private $lastHeadKeywords; // 最後にヘッダ部keywordsにセットした文字列
61 private $headCss = array(); // HTMLヘッダにCSS出力する文字列
62 private $headScript = array(); // HTMLヘッダにJavascript出力する文字列
63 private $headPreMobileScript = array(); // HTMLヘッダにJavascript出力する文字列(jQueryMobile用挿入スクリプト)
64 private $headString = array(); // HTMLヘッダに出力する任意文字列
65 private $lastHeadCss; // 最後に設定したHTMLヘッダにCSS出力する文字列
66 private $lastHeadScript; // 最後に設定したHTMLヘッダにJavascript出力する文字列
67 private $lastHeadString; // 最後に設定したHTMLヘッダに出力する任意文字列
68 private $initScript = ''; // ウィンドウ初期化時に実行されるスクリプト
69 private $outputByHtml = true; // HTMLフォーマットで出力するかどうか
70 private $outputHead; // HTMLヘッダ出力を行ったかどうか
71 private $outputTheme; // jQueryUIテーマ出力を行ったかどうか
72 private $isAbort; // ページ作成処理を中断するかどうか
73 private $isRedirect; // リダイレクトするかどうか
74 private $libFiles; // javascript追加用ライブラリ
75 private $pageDefRev = 234; // 画面定義のリビジョン番号
76 private $headSubTitle = array(); // ヘッダタグサブタイトル
77 private $headSubTitleUrl = array(); // ヘッダサブタイトルのリンク先
78 private $pageInfo; // すべてのページ情報
79 private $currentPageInfo; // 現在のページのページ情報
80 private $contentType = ''; // ページのコンテンツタイプ
81 private $mainContentType; // 一般画面で使用する主要コンテンツタイプ
82 private $mainFeatureType; // 一般画面で使用する主要機能タイプ
83 private $rssVersion; // RSSバージョン
84 private $rssChannel; // RSSチャンネルデータ
85 private $selectedJQueryFilename; // 使用対象のjQueryファイル
86 private $selectedJQueryUiFilename; // 使用対象のjQuery UIファイル
87 private $selectedJQueryMobileFilename; // 使用対象のjQueryMobileファイル
88 private $urlParamOrder; // URLパラメータの並び順
89 private $wysiwygEditor; // 管理画面用WYSIWYGエディター
90 private $optionTemplateId; // 追加設定するテンプレートID
91 private $isContentGooglemaps; // コンテンツにGoogleマップが含むかどうか
92 private $useGooglemaps; // Googleマップを使用するかどうか
93 private $useBootstrap; // Bootstrapを使用するかどうか
94 private $isHtml5; // HTML5で出力するかどうか
95 const CONFIG_KEY_HEAD_TITLE_FORMAT = 'head_title_format'; // ヘッダ作成用フォーマット
96 const ADMIN_WIDGET_ID = 'admin_main'; // 管理用ウィジェットのウィジェットID
97 //const CONTENT_TYPE_WIKI = 'wiki'; // ページのコンテンツタイプ(Wiki)
98 const WIDGET_ID_TAG_START = '{{WIDGETID:'; // 遅延実行用タグ
99 const WIDGET_ID_TAG_END = '}}'; // 遅延実行用タグ
100 const WIDGET_ID_TITLE_TAG_START = '{{WIDGETID_TITLE:'; // 遅延実行用タグ(タイトル埋め込み用)
101 const WIDGET_ID_TITLE_TAG_END = '}}'; // 遅延実行用タグ(タイトル埋め込み用)
102 const WIDGET_ID_SEPARATOR = ',';
103 const HEAD_TAGS = '{{HEAD_TAGS}}'; // HTMLヘッダ出力用タグ
104 const WIDGET_ICON_IMG_SIZE = 32; // ウィジェットアイコンサイズ
105 const WIDGET_OUTER_CLASS_HEAD_POSITION = 'm3_p_'; // ウィジェットの外枠クラス用ヘッダ(ポジション表示)
106 const POSITION_TAG_HEAD = 'm3pos_'; // ポジションの識別用タグIDヘッダ
107 const WIDGET_TAG_HEAD = 'm3widget_'; // ウィジェットの識別用タグIDヘッダ
108 const WIDGET_TAG_HEAD_SHORT = 'm3_'; // ウィジェットの識別用タグIDヘッダ
109 const WIDGET_TYPE_TAG_HEAD = 'm3widgettype_'; // ウィジェット種別の識別用タグIDヘッダ
110 const WIDTET_CLASS_NAME = 'm3widget'; // ウィジェットオブジェクトのタグクラス名
111 const WIDTET_CLASS_TYPE_0 = 'm3widget_type0'; // ウィジェットオブジェクトのタグクラス(ページ共通でない)
112 const WIDTET_CLASS_TYPE_1 = 'm3widget_type1'; // ウィジェットオブジェクトのタグクラス(ページ共通)
113 const POSITION_CLASS_NAME = 'm3position'; // ポジションオブジェクトのタグクラス名
114 const JOOMLA10_DEFAULT_WIDGET_MENU_PARAM = 'class="moduletable"'; // Joomla!1.0用デフォルトメニューパラメータ値
115 const ADMIN_TEMPLATE = '_admin'; // PC管理用テンプレートID
116 const M_ADMIN_TEMPLATE = 'm/_admin'; // 携帯用管理画面テンプレートID
117 const SCRIPT_LIB_SEPARATOR = ';'; // JavaScriptライブラリ読み込み設定のライブラリの区切り
118 const PAGE_ID_SEPARATOR = ','; // ページIDとページサブID連結用
119 const DEFAULT_ADMIN_FAVICON_FILE = '/images/system/favicon.ico'; // デフォルトの管理画面用faviconファイル
120 const DEFAULT_FAVICON_FILE = '/favicon.ico'; // デフォルトのfaviconファイル
121 // const DEFAULT_SITE_NAME = 'サイト名未設定'; // 管理画面用のデフォルトサイト名
122 const DEFAULT_ADMIN_TITLE = '管理画面'; // デフォルトの管理画面名
123 const WIDGET_TITLE_START = '['; // ウィジェットのタイトルの括弧
124 const WIDGET_TITLE_END = ']'; // ウィジェットのタイトルの括弧
125 const DEFAULT_RSS_VERSION = '1.0'; // デフォルトのRSSのバージョン
126 const CF_ACCESS_IN_INTRANET = 'access_in_intranet'; // イントラネット運用かどうか
127 const CF_USE_LATEST_SCRIPT_LIB = 'dev_use_latest_script_lib'; // 最新のJavaScriptライブラリを使用するかどうか
128 const CF_GOOGLE_MAPS_KEY = 'google_maps_key'; // Googleマップ利用キー
129 const CF_CONFIG_WINDOW_OPEN_TYPE = 'config_window_open_type'; // ウィジェット設定画面のウィンドウ表示タイプ(0=別ウィンドウ、1=タブ)
130 const CF_JQUERY_VERSION = 'jquery_version'; // jQueryバージョン
131 const CF_WYSIWYG_EDITOR = 'wysiwyg_editor'; // 管理画面用WYSIWYGエディター
132 const CF_ADMIN_JQUERY_VERSION = 'admin_jquery_version'; // 管理画面用jQueryバージョン
133 const CF_USE_JQUERY = 'use_jquery'; // jQueryを常に使用するかどうか
134 const CF_SMARTPHONE_USE_JQUERY_MOBILE = 'smartphone_use_jquery_mobile'; // スマートフォン画面でjQuery Mobileを使用
135 const SD_HEAD_OTHERS = 'head_others'; // ヘッダその他タグ
136 const DEFAULT_THEME_DIR = '/ui/themes/'; // jQueryUIテーマ格納ディレクトリ
137 const THEME_CSS_FILE = 'jquery-ui.custom.css'; // テーマファイル
138 const CONFIG_ICON_FILE = '/images/system/config.png'; // ウィジェット定義画面アイコン
139 const ADJUST_ICON_FILE = '/images/system/adjust_widget.png'; // 位置調整アイコン
140 const CONFIG_ICON32_FILE = '/images/system/config32.png'; // ウィジェット定義画面アイコン(ツールチップ用)
141 const ADJUST_ICON32_FILE = '/images/system/adjust_widget32.png'; // 位置調整アイコン(ツールチップ用)
142 const CLOSE_BOX_ICON32_FILE = '/images/system/close_box.png'; // ウィンドウ閉じるアイコン(ツールチップ用)
143 const NOTICE_ICON_FILE = '/images/system/notice16.png'; // ウィジェット配置注意アイコン
144 const ADMIN_ICON_FILE = '/images/system/admin64.png'; // パネルメニュー管理画面遷移用アイコン
145 const LOGOUT_ICON_FILE = '/images/system/logout64.png'; // パネルメニューログアウト用アイコン
146 const EDIT_PAGE_ICON_FILE = '/images/system/create_page64.png'; // パネルメニュー編集用アイコン
147 const EDIT_END_ICON_FILE = '/images/system/close64.png'; // パネルメニュー編集終了用アイコン
148 const CLOSE_ICON_FILE = '/images/system/close32.png'; // ウィンドウ閉じるアイコン
149 const PREV_ICON_FILE = '/images/system/prev48.png'; // ウィンドウ「前へ」アイコン
150 const NEXT_ICON_FILE = '/images/system/next48.png'; // ウィンドウ「次へ」アイコン
151 const DEFAULT_READMORE_TITLE = 'もっと読む'; // もっと読むボタンのデフォルトタイトル
154 const CONTENT_OBJ_ID = 'contentlib'; // 汎用コンテンツオブジェクトID
155 const BLOG_OBJ_ID = 'bloglib'; // ブログオブジェクトID
158 const IWIDTET_CMD_CONTENT = 'content'; // コンテンツ取得
159 const IWIDTET_CMD_INIT = 'init'; // 初期化
160 const IWIDTET_CMD_UPDATE = 'update'; // 更新
161 const IWIDTET_CMD_CALC = 'calc'; // 計算
164 const M3_ADMIN_SCRIPT_FILENAME = 'm3admin1.6.8.js'; // 管理機能用スクリプト(FCKEditor2.6.6、CKEditor4.0.1対応)
165 const M3_ADMIN_WIDGET_SCRIPT_FILENAME = 'm3admin_widget1.5.3.js'; // 管理機能(ウィジェット操作)用スクリプト(Magic3 v1.15.0以降)
166 const M3_ADMIN_WIDGET_CSS_FILE = '/m3/widget.css'; // 管理機能(ウィジェット操作)用CSSファイル
167 const M3_STD_SCRIPT_FILENAME = 'm3std1.4.3.js'; // 一般、管理機能共通スクリプト
168 const M3_PLUS_SCRIPT_FILENAME = 'm3plus1.6.1.js'; // 一般画面追加用スクリプト(FCKEditor2.6.6対応、CKEditor4.0.1対応)
169 const M3_OPTION_SCRIPT_FILENAME = 'm3opt1.1.0.js'; // AJAXを含んだオプションライブラリファイル(jQuery必須)
170 const M3_ADMIN_CSS_FILE = 'm3/admin.css'; // 管理機能用のCSS
171 const M3_EDIT_CSS_FILE = 'm3/edit.css'; // 一般画面編集用のCSS
172 const M3_NO_BOOTSTRAP_CSS_FILE = 'm3/nobootstrap.css'; // 管理画面でBootstrapの読み込みなしの場合のCSS
175 const USE_BOOTSTRAP_ADMIN = false; // 管理画面でBootstrapを使用するかどうか(デフォルト値)
176 const BOOTSTRAP_BUTTON_CLASS = 'btn btn-default';
181 function __construct()
183 global $gInstanceManager;
185 global $gSystemManager;
186 global $gRequestManager;
189 parent::__construct();
191 $cmd = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
192 $widgetId = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_WIDGET_ID);
195 $this->db = $gInstanceManager->getSytemDbObject();
198 $value = $gSystemManager->getSystemConfig(self::CF_ACCESS_IN_INTRANET); // イントラネット運用かどうか
199 if (empty($value)){ // インターネット運用
200 $this->useGooglemaps = true; // Googleマップを使用するかどうか
204 // 「ルート/scripts」ディレクトリからの相対パスで指定する
205 $this->defaultScriptFiles = array(self::M3_STD_SCRIPT_FILENAME);
206 $this->defaultCssFiles = array();
208 $this->wysiwygEditor = $gSystemManager->getSystemConfig(self::CF_WYSIWYG_EDITOR); // 管理画面用WYSIWYGエディター
210 // アクセスする画面に応じてjQueryのバージョンを設定
211 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
212 $value = $gSystemManager->getSystemConfig(self::CF_ADMIN_JQUERY_VERSION);// 管理画面用jQueryバージョン
214 if ($cmd == M3_REQUEST_CMD_CONFIG_WIDGET && strStartsWith($widgetId, 'm/')){// 携帯用アクセスポイント用の管理画面の場合はWYSIWYGエディターはFCKEditorに固定
215 $this->wysiwygEditor = ScriptLibInfo::LIB_FCKEDITOR; // FCKEditorに固定
218 // 管理画面にBOOTSTRAPを使用するかどうか(初期値)
219 $this->useBootstrap = self::USE_BOOTSTRAP_ADMIN;
221 $value = $gSystemManager->getSystemConfig(self::CF_JQUERY_VERSION);// jQueryバージョン
223 ScriptLibInfo::setJQueryVer($value);
225 // WYSISIGエディターのタイプを設定。ScriptLibInfo::getLib()を実行する前に設定。
226 ScriptLibInfo::setWysiwygEditorType($this->wysiwygEditor);
229 $this->libFiles = ScriptLibInfo::getLib(); // ライブラリ取得
232 $this->selectedJQueryFilename = ScriptLibInfo::getJQueryFilename(0); // 使用対象のjQueryファイル
233 $this->selectedJQueryUiFilename = ScriptLibInfo::getJQueryFilename(1); // 使用対象のjQuery UIファイル
236 if (defined('M3_STATE_IN_INSTALL')){ // インストーラの場合のスクリプト
237 $this->defaultAdminScriptFiles = array($this->selectedJQueryFilename); // jQuery
238 // self::M3_STD_SCRIPT_FILENAME,
239 // self::M3_ADMIN_SCRIPT_FILENAME,
240 // self::M3_OPTION_SCRIPT_FILENAME);
242 $this->defaultAdminCssFiles = array(); // 管理機能用のCSS
244 $this->defaultAdminScriptFiles = array($this->selectedJQueryFilename, // jQuery
245 $this->selectedJQueryUiFilename, // jQuery UI Core
246 ScriptLibInfo::JQUERY_CONTEXTMENU_FILENAME, // jQuery Contextmenu Lib
247 self::M3_STD_SCRIPT_FILENAME,
248 self::M3_ADMIN_SCRIPT_FILENAME,
249 self::M3_OPTION_SCRIPT_FILENAME);
251 $this->defaultAdminCssFiles = array(self::M3_ADMIN_CSS_FILE); // 管理機能用のCSS
252 if (!$this->useBootstrap) $this->defaultAdminCssFiles[] = self::M3_NO_BOOTSTRAP_CSS_FILE; // Bootstrapを読み込まない場合は代替CSSを読み込む
255 // 管理権限なしで管理ディレクトリアクセスで読み込むスクリプトファイル
256 $this->defaultAdminDirScriptFiles = array($this->selectedJQueryFilename); // jQuery
259 $this->lateLaunchWidgetList = array();
260 $this->latelaunchWidgetParam = array();
263 if ($gEnvManager->canUseDb()){
264 $value = $this->gSystem->getSystemConfig('script_cache_in_browser'); // ブラウザにJavaScriptファイルのキャッシュを保持するかどうか
265 if ($value != '') $this->hasScriptCache = $value;
268 $this->rssVersion = self::DEFAULT_RSS_VERSION; // RSSバージョン
270 // 一般画面で使用する主要コンテンツタイプ
271 $this->mainContentType = array( array( 'name' => '汎用コンテンツ', 'value' => M3_VIEW_TYPE_CONTENT),
272 array( 'name' => '製品', 'value' => M3_VIEW_TYPE_PRODUCT),
273 array( 'name' => 'BBS', 'value' => M3_VIEW_TYPE_BBS),
274 array( 'name' => 'ブログ', 'value' => M3_VIEW_TYPE_BLOG),
275 array( 'name' => 'Wiki', 'value' => M3_VIEW_TYPE_WIKI),
276 array( 'name' => 'ユーザ作成コンテンツ', 'value' => M3_VIEW_TYPE_USER),
277 array( 'name' => 'イベント', 'value' => M3_VIEW_TYPE_EVENT),
278 array( 'name' => 'フォトギャラリー', 'value' => M3_VIEW_TYPE_PHOTO));
280 $this->mainFeatureType = array( array( 'name' => '検索', 'value' => M3_VIEW_TYPE_SEARCH),
281 array( 'name' => 'Eコマース', 'value' => M3_VIEW_TYPE_COMMERCE));
284 $this->urlParamOrder = array(
286 M3_REQUEST_PARAM_CONTENT_ID => -20, // 汎用コンテンツID
287 M3_REQUEST_PARAM_CONTENT_ID_SHORT => -19, // 汎用コンテンツID(略式)
288 M3_REQUEST_PARAM_PRODUCT_ID => -18, // 製品ID
289 M3_REQUEST_PARAM_PRODUCT_ID_SHORT => -17, // 製品ID(略式)
290 M3_REQUEST_PARAM_BLOG_ID => -16, // ブログID
291 M3_REQUEST_PARAM_BLOG_ID_SHORT => -15, // ブログID(略式)
292 M3_REQUEST_PARAM_BLOG_ENTRY_ID => -14, // ブログ記事ID
293 M3_REQUEST_PARAM_BLOG_ENTRY_ID_SHORT => -13, // ブログ記事ID(略式)
294 M3_REQUEST_PARAM_BBS_ID => -12, // 掲示板投稿記事ID
295 M3_REQUEST_PARAM_BBS_ID_SHORT => -11, // 掲示板投稿記事ID(略式)
296 M3_REQUEST_PARAM_BBS_THREAD_ID => -10, // 掲示板投稿スレッドID
297 M3_REQUEST_PARAM_BBS_THREAD_ID_SHORT => -9, // 掲示板投稿スレッドID(略式)
298 M3_REQUEST_PARAM_USER_ID => -8, // ユーザ作成コンテンツID
299 M3_REQUEST_PARAM_USER_ID_SHORT => -7, // ユーザ作成コンテンツID(略式)
300 M3_REQUEST_PARAM_ROOM_ID => -6, // ユーザ作成コンテンツ区画ID
301 M3_REQUEST_PARAM_ROOM_ID_SHORT => -5, // ユーザ作成コンテンツ区画ID(略式)
302 M3_REQUEST_PARAM_EVENT_ID => -4, // イベントID
303 M3_REQUEST_PARAM_EVENT_ID_SHORT => -3, // イベントID(略式)
304 M3_REQUEST_PARAM_PHOTO_ID => -2, // 画像ID
305 M3_REQUEST_PARAM_PHOTO_ID_SHORT => -1, // 画像ID(略式)
307 M3_REQUEST_PARAM_PAGE_SUB_ID => 1, // ページサブID
308 M3_REQUEST_PARAM_PAGE_CONTENT_ID => 2, // ページコンテンツID
309 M3_REQUEST_PARAM_WIDGET_ID => 3, // ウィジェットID
310 M3_REQUEST_PARAM_TEMPLATE_ID => 4, // テンプレートID
311 M3_REQUEST_PARAM_URL => 5, // リンク先等のURL
312 M3_REQUEST_PARAM_STAMP => 6, // 公開発行ID
313 M3_REQUEST_PARAM_OPTION => 7, // 通信オプション
314 M3_REQUEST_PARAM_OPERATION_COMMAND => 8, // 実行処理
315 M3_REQUEST_PARAM_OPERATION_WIKI_COMMAND => 9, // Wikiコマンド実行
316 M3_REQUEST_PARAM_OPERATION_TASK => 10, // ウィジェット間共通処理
317 M3_REQUEST_PARAM_OPERATION_ACT => 11, // クライアントからの実行処理
318 M3_REQUEST_PARAM_OPERATION_LANG => 12, // 言語指定表示
319 M3_REQUEST_PARAM_SERIAL_NO => 13, // シリアル番号
320 M3_REQUEST_PARAM_PAGE_NO => 14, // ページ番号
321 M3_REQUEST_PARAM_LIST_NO => 15, // 一覧番号
322 M3_REQUEST_PARAM_ITEM_NO => 16, // 項目番号
323 M3_REQUEST_PARAM_OPERATION_TODO => 17, // 指定ウィジェットに実行させる処理
324 M3_REQUEST_PARAM_FROM => 18, // メッセージの送信元ウィジェットID
325 M3_REQUEST_PARAM_VIEW_STYLE => 19, // 表示スタイル
326 M3_REQUEST_PARAM_FORWARD => 20, // 画面遷移用パラメータ
327 M3_REQUEST_PARAM_ADMIN_KEY => 21, // 管理者一時キー
328 M3_REQUEST_PARAM_OPEN_BY => 22, // ウィンドウの開き方
329 M3_REQUEST_PARAM_SHOW_HEADER => 23, // ヘッダ部表示制御
330 M3_REQUEST_PARAM_SHOW_FOOTER => 24, // フッタ部表示制御
331 M3_REQUEST_PARAM_SHOW_MENU => 25, // メニュー部表示制御
332 M3_REQUEST_PARAM_KEYWORD => 26, // 検索キーワード
333 M3_REQUEST_PARAM_HISTORY => 27, // 履歴インデックスNo
334 M3_REQUEST_PARAM_DEF_PAGE_ID => 28, // ページID(画面編集用)
335 M3_REQUEST_PARAM_DEF_PAGE_SUB_ID => 29, // ページサブID(画面編集用)
336 M3_REQUEST_PARAM_PAGE_DEF_SERIAL => 30, // ページ定義のレコードシリアル番号(設定画面起動時)
337 M3_REQUEST_PARAM_PAGE_DEF_CONFIG_ID => 31, // ページ定義のウィジェット定義ID(設定画面起動時)
338 M3_REQUEST_PARAM_BACK_URL => 32, // 戻り先URL
339 M3_REQUEST_PARAM_BACKUP_URL => 33, // URL退避用(画面編集時)
340 M3_REQUEST_PARAM_SERVER => 34, // サーバ指定
341 M3_REQUEST_PARAM_CATEGORY_ID => 35); // カテゴリID(共通)
346 * @return array コンテンツタイプ
348 public function _getAllContentType()
350 $contentType = array( M3_VIEW_TYPE_CONTENT, // 汎用コンテンツ
351 M3_VIEW_TYPE_PRODUCT, // 製品
352 M3_VIEW_TYPE_BBS, // BBS
353 M3_VIEW_TYPE_BLOG, // ブログ
354 M3_VIEW_TYPE_WIKI, // wiki
355 M3_VIEW_TYPE_USER, // ユーザ作成コンテンツ
356 M3_VIEW_TYPE_EVENT, // イベント
357 M3_VIEW_TYPE_PHOTO); // フォトギャラリー
363 * @return array 機能タイプ
365 public function _getAllFeatureType()
367 $featureType = array( M3_VIEW_TYPE_DASHBOARD, // ダッシュボード
368 M3_VIEW_TYPE_SEARCH, // 検索結果
369 M3_VIEW_TYPE_COMMERCE); // Eコマース
377 function setNoTimeout()
379 if (ini_get('safe_mode') == '0') set_time_limit(0);
384 * @param string $msg メッセージ
386 function setPopupMsg($msg)
388 $this->popupMsg = $msg;
391 * HTMLヘッダ「description」に出力する文字列を設定
393 * @param string $str 出力文字列
395 function setHeadDescription($str)
397 if (is_string($str) && !empty($str)){
398 $this->headDescription = $str;
399 $this->lastHeadDescription = $str; // 最後に設定した値を退避
403 * HTMLヘッダ「description」に出力する文字列を取得
405 * @return string $str 出力文字列
407 function getHeadDescription()
409 return $this->headDescription;
412 * HTMLヘッダ「keywords」に出力する文字列を設定
414 * @param string $str 出力文字列
416 function setHeadKeywords($str)
418 if (is_string($str) && !empty($str)){
419 $this->headKeywords = $str;
420 $this->lastHeadKeywords = $str; // 最後に設定した値を退避
424 * HTMLヘッダ「keywords」に出力する文字列を取得
426 * @return string $str 出力文字列
428 function getHeadKeywords()
430 return $this->headKeywords;
433 * HTMLヘッダに出力するタグ文字列を設定
435 * @param string $str 出力文字列
438 function setHeadOthers($str)
440 if (is_string($str) && !empty($str)){
441 $this->headOthers = $str;
445 * HTMLヘッダに出力するタグ文字列を取得
447 * @return string $str 出力文字列
449 /* function getHeadOthers()
451 return $this->headOthers;
454 * HTMLヘッダ「title」のサブタイトル出力する文字列を設定
456 * @param string $str 出力文字列
457 * @param string $url リンク先
459 function setHeadSubTitle($str, $url='')
461 if (is_string($str) && !empty($str)){
462 $this->headSubTitle[] = $str;
463 $this->headSubTitleUrl[] = $url;
464 $this->lastHeadTitle = $str; // 最後に設定した値を退避
468 * HTMLヘッダ「title」のサブタイトル出力する文字列を取得
470 * @return $array サブタイトルに設定されている文字列を連想配列(title=タイトル、url=リンク先URL)の配列で返す
472 function getHeadSubTitle()
474 $titleArray = array();
475 $titleCount = count($this->headSubTitle);
476 for ($i = 0; $i < $titleCount; $i++){
477 $line = array('title' => $this->headSubTitle[$i], 'url' => $this->headSubTitleUrl[$i]);
478 $titleArray[] = $line;
483 * HTMLヘッダに出力するCSSの文字列を設定
485 * @param string $css 追加するCSS内容
488 function addHeadCss($css)
490 $destCss = trim($css);
491 if (!empty($destCss)){
492 if (!in_array($css, $this->headCss)) $this->headCss[] = $css;
494 $this->lastHeadCss = $css; // 最後に設定したHTMLヘッダにCSS出力する文字列
498 * HTMLヘッダに出力するJavascriptの文字列を設定
500 * @param string $script 追加するJavascript内容
503 function addHeadScript($script)
505 $destScript = trim($script);
506 if (!empty($destScript)){
507 if (!in_array($script, $this->headScript)) $this->headScript[] = $script;
509 $this->lastHeadScript = $script; // 最後に設定したHTMLヘッダにJavascript出力する文字列
513 * HTMLヘッダに出力するJavascriptの文字列(jQueryMobile用挿入スクリプト)を設定
515 * @param string $script 追加するJavascript内容
518 function addHeadPreMobileScript($script)
520 $destScript = trim($script);
521 if (!empty($destScript)){
522 if (!in_array($script, $this->headPreMobileScript)) $this->headPreMobileScript[] = $script;
526 * HTMLヘッダに出力する任意文字列を設定
528 * @param string $str 追加する任意文字列
531 function addHeadString($str)
533 $destScript = trim($str);
534 if (!empty($destScript)){
535 if (!in_array($str, $this->headString)) $this->headString[] = $str;
537 $this->lastHeadString = $str; // 最後に設定したHTMLヘッダに出力する任意文字列
541 * HTMLヘッダに出力するCSSファイルを追加
543 * @param string,array $cssFile CSSファイルURLパス
546 function addHeadCssFile($cssFile)
548 if (is_array($cssFile)){ // 配列の場合
549 for ($i = 0; $i < count($cssFile); $i++){
550 $destCss = trim($cssFile[$i]);
551 if (!empty($destCss) && !in_array($destCss, $this->headCssFiles)) $this->headCssFiles[] = $destCss;
554 $destCss = trim($cssFile);
555 if (!empty($destCss) && !in_array($destCss, $this->headCssFiles)) $this->headCssFiles[] = $destCss;
559 * HTMLヘッダに出力するJavascriptライブラリを追加
561 * @param string,array $scriptLib JavascriptライブラリID
564 function addHeadAdminScriptLib($scriptLib)
566 if (is_array($scriptLib)){ // 配列の場合
567 for ($i = 0; $i < count($scriptLib); $i++){
568 $destScript = trim($scriptLib[$i]);
569 if (!empty($destScript)) $this->addAdminScript('', $destScript);// スクリプト追加
572 $destScript = trim($scriptLib);
573 if (!empty($destScript)) $this->addAdminScript('', $destScript);// スクリプト追加
577 * HTMLヘッダに出力するJavascriptライブラリを追加
579 * @param string,array $scriptLib JavascriptライブラリID
582 function addHeadScriptLib($scriptLib)
584 if (is_array($scriptLib)){ // 配列の場合
585 for ($i = 0; $i < count($scriptLib); $i++){
586 $destScript = trim($scriptLib[$i]);
587 if (!empty($destScript)) $this->addScript('', $destScript);// スクリプト追加
590 $destScript = trim($scriptLib);
591 if (!empty($destScript)) $this->addScript('', $destScript);// スクリプト追加
595 * HTMLヘッダに出力するJavascriptファイルを追加
597 * @param string,array $scriptFile JavascriptファイルURLパス
600 function addHeadScriptFile($scriptFile)
602 if (is_array($scriptFile)){ // 配列の場合
603 for ($i = 0; $i < count($scriptFile); $i++){
604 $destScript = trim($scriptFile[$i]);
605 if (!empty($destScript) && !in_array($destScript, $this->headScriptFiles)) $this->headScriptFiles[] = $destScript;
608 $destScript = trim($scriptFile);
609 if (!empty($destScript) && !in_array($destScript, $this->headScriptFiles)) $this->headScriptFiles[] = $destScript;
613 * HTMLヘッダに出力するJavascriptファイル(jQueryMobile用挿入ファイル)を追加
615 * @param string,array $scriptFile JavascriptファイルURLパス
618 function addHeadPreMobileScriptFile($scriptFile)
620 if (is_array($scriptFile)){ // 配列の場合
621 for ($i = 0; $i < count($scriptFile); $i++){
622 $destScript = trim($scriptFile[$i]);
623 if (!empty($destScript) && !in_array($destScript, $this->headPreMobileScriptFiles)) $this->headPreMobileScriptFiles[] = $destScript;
626 $destScript = trim($scriptFile);
627 if (!empty($destScript) && !in_array($destScript, $this->headPreMobileScriptFiles)) $this->headPreMobileScriptFiles[] = $destScript;
631 * HTMLヘッダに出力するRSSファイルを追加
633 * @param array $rssFile タイトル(title)、配信用URL(href)の連想配列。複数の場合は連想配列の配列。
636 function addHeadRssFile($rssFile)
639 if (!is_array($rssFile)) return;
642 if (is_array($line)){ // 複数追加の場合
643 for ($i = 0; $i < count($line); $i++){
645 $url = trim($line[$i]['href']);
647 for ($j = 0; $j < count($this->headRssFiles); $j++){
648 $storedUrl = $this->headRssFiles[$j]['href'];
649 if ($url == $storedUrl) break;
651 if ($j == count($this->headRssFiles)){ // 見つからないときは追加
652 $this->headRssFiles[] = array( 'href' => $url, // リンク先URL
653 'title' => $line[$i]['title']); // タイトル
659 $url = trim($rssFile['href']);
661 for ($i = 0; $i < count($this->headRssFiles); $i++){
662 $storedUrl = $this->headRssFiles[$i]['href'];
663 if ($url == $storedUrl) break;
665 if ($i == count($this->headRssFiles)){ // 見つからないときは追加
666 $this->headRssFiles[] = array( 'href' => $url, // リンク先URL
667 'title' => $rssFile['title']); // タイトル
673 * RSSチャンネル部に出力するデータを設定
675 * @param array $rssData RSSチャンネル部データ
678 function setRssChannel($rssData)
680 if (!empty($rssData)) $this->rssChannel = $rssData; // RSSチャンネルデータ
686 * @param int $mode 0=ポジション表示しない(通常画面)、1=ポジション表示、2=ウィジェット込みポジション表示
688 function showPosition($mode)
690 $this->showPositionMode = $mode;
695 function showWidget()
697 $this->showWidget = true;
702 * @param bool true=単体表示、false=単体表示でない
704 function getShowWidget()
706 return $this->showWidget;
711 * @param int $mode 0=設定なし、1=ログイン画面、10=サイト非公開、11=アクセス不可、12=存在しないページ
713 function setSystemHandleMode($mode)
715 $this->systemHandleMode = $mode;
720 function getSystemHandleMode()
722 return $this->systemHandleMode;
729 function setEditMode()
731 $this->isEditMode = true;
734 * 出力フォーマットがHTMLであるかを設定
736 * @param bool $isHtml HTMLフォーマットかどうか
739 function setOutputByHtml($isHtml)
741 $this->outputByHtml = $isHtml;
746 * @param bool $status ヘルプ機能を使用するかどうか
749 function setUseHelp($status)
751 $this->useHelp = $status;
756 * @return bool ヘルプ機能を使用するかどうか
758 function getUseHelp()
760 return $this->useHelp;
763 * 表示するコンテンツにGoogleマップが含まれているかを設定
765 * @param bool $status Googleマップを含むかどうか
768 function setIsContentGooglemaps($status)
770 $this->isContentGooglemaps = $status; // コンテンツにGoogleマップが含むかどうか
773 * 表示するコンテンツにGoogleマップが含まれているかを取得
775 * @return bool ヘルプ機能を使用するかどうか
777 function isContentGooglemaps()
779 return $this->isContentGooglemaps;
782 * JavaScriptのブラウザキャッシュの使用可否を設定
784 * @param bool $status ブラウザキャッシュを使用するかどうか
787 function setHasScriptCache($status)
789 $this->hasScriptCache = $status;
796 function useBootstrap()
798 $this->useBootstrap = true; // Bootstrapを使用するかどうか
801 * Bootstrapを強制的に未使用に設定
805 function cancelBootstrap()
807 $this->useBootstrap = false; // Bootstrapを使用するかどうか
812 * @return bool true=使用、false=使用しない
814 function getUseBootstrap()
816 return $this->useBootstrap; // Bootstrapを使用するかどうか
825 $this->isHtml5 = true; // HTML5で出力するかどうか
828 * ページ作成処理を中断するかどうかを取得
830 * @return bool true=中断、false=継続
832 function isPageAbort()
834 return $this->isAbort;
839 * @param int $defSerial ページ定義シリアル番号
842 function updateParentWindow($defSerial = 0)
844 $this->updateParentWindow = true;
845 $this->updateDefSerial = $defSerial; // 更新する項目のページ定義シリアル番号
850 * @param string $path 追加するファイルのパス(「ルート/scripts」ディレクトリからの相対パスで指定する)
853 function addCssFile($path)
855 $destPath = trim($path, '/');
856 if (!in_array($destPath, $this->defaultCssFiles)) $this->defaultCssFiles[] = $destPath;
861 * @param string $path 追加するファイルのパス(「ルート/scripts」ディレクトリからの相対パスまたは絶対パス(scriptディレクトリ以外の場合)で指定する)
864 function addAdminCssFile($path)
866 $destPath = trim($path, '/');
867 if (!in_array($destPath, $this->defaultAdminCssFiles)) $this->defaultAdminCssFiles[] = $destPath;
872 * @param string $path 追加するファイルのパス(「ルート/scripts」ディレクトリからの相対パスで指定する)
875 function addScriptFile($path)
877 $destPath = trim($path, '/');
878 if (!empty($destPath) && !in_array($destPath, $this->defaultScriptFiles)) $this->defaultScriptFiles[] = $destPath;
883 * @param string $path 追加するファイルのパス(「ルート/scripts」ディレクトリからの相対パスで指定する)
886 function addAdminScriptFile($path)
888 $destPath = trim($path, '/');
889 if (!in_array($destPath, $this->defaultAdminScriptFiles)) $this->defaultAdminScriptFiles[] = $destPath;
894 * @return string テンプレートID
896 function getOptionTemplateId()
901 $pageId = $gEnvManager->getCurrentPageId();
903 switch ($this->contentType){
904 case M3_VIEW_TYPE_CONTENT: // ページのコンテンツタイプ
906 $contentLibObj = $this->gInstance->getObject(self::CONTENT_OBJ_ID);
907 if (isset($contentLibObj)) $this->optionTemplateId = $contentLibObj->getTemplate();
909 case M3_VIEW_TYPE_BLOG: // ページがブログタイプのとき
910 if ($pageId == $this->gEnv->getDefaultPageId()){ // PCサイトのとき
911 // ブログライブラリオブジェクトからテンプレートを取得
912 $blogLibObj = $this->gInstance->getObject(self::BLOG_OBJ_ID);
913 if (isset($blogLibObj)) $this->optionTemplateId = $blogLibObj->getOptionTemplate();
917 return $this->optionTemplateId;
922 * @return int ウィジェット数
924 function getNonSharedWidgetCount()
926 return $this->nonSharedWidgetCount;
931 * @return string コンテンツタイプ
933 function getContentType()
935 return $this->contentType;
938 * 一般画面で使用する主要コンテンツタイプを取得
940 * @return array コンテンツタイプの配列
942 function getMainContentType()
944 return $this->mainContentType; // 主要コンテンツタイプ
947 * 一般画面で使用する主要機能タイプを取得
949 * @return array 機能タイプの配列
951 function getMainFeatureType()
953 return $this->mainFeatureType; // 主要機能タイプ
958 * HTTPヘッダを設定する。セッションを取得する。サブページIDを設定する。
960 * @param RequestManager $request HTTPリクエスト処理クラス
963 function startPage($request)
966 global $gRequestManager;
967 global $gInstanceManager;
968 global $gAccessManager;
969 global $gSystemManager;
970 global $gDispManager;
973 $cmd = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
974 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
975 $pageId = $gEnvManager->getCurrentPageId();
976 $openBy = $request->trimValueOf(M3_REQUEST_PARAM_OPEN_BY); // ウィンドウオープンタイプ
979 $clientId = $request->getCookieValue(M3_COOKIE_CLIENT_ID);
980 if (empty($clientId)){ // クライアントIDが設定されていないとき
982 $clientId = $this->gAccess->createClientId();
984 $this->gAccess->setClientId($clientId); // クライアントIDを設定
987 $this->gEnv->setCanUseCookie(true);
989 $request->setCookieValue(M3_COOKIE_CLIENT_ID, $clientId, M3_COOKIE_EXPIRE_CLIENT_ID);
991 // 管理者キーがあればGETまたはPOST値のセッションIDを使用する
992 if ($gEnvManager->isAdminDirAccess()){
993 if ($gAccessManager->isValidAdminKey()) session_id($gRequestManager->trimValueOf(session_name()));
996 // インストール時の管理画面用ライブラリを追加(フレームコンテナでの設定を反映)
997 if (defined('M3_STATE_IN_INSTALL')){
999 if ($this->useBootstrap){
1000 $this->addAdminScript('', ScriptLibInfo::LIB_BOOTSTRAP); // 管理画面でBootstrapを使用するかどうか
1001 $this->addAdminScript('', ScriptLibInfo::LIB_BOOTSTRAP_ADMIN); // Bootstrap管理画面オプション
1008 // ##### インストール時はここで終了 #####
1009 if (defined('M3_STATE_IN_INSTALL')) return; // インストール時は実行しない
1011 // セッションを再生成する(セキュリティ対策)
1012 if ($gSystemManager->regenerateSessionId()){
1013 $gAccessManager->setOldSessionId(session_id()); // 古いセッションIDを保存
1014 session_regenerate_id(true);
1018 $userInfo = $gRequestManager->getSessionValueWithSerialize(M3_SESSION_USER_INFO);
1019 $gInstanceManager->setUserInfo($userInfo);
1021 // ##### 自動ログイン #####
1022 // ログイン中でない場合は自動ログインでユーザ情報を取得
1023 $gAccessManager->startAutoLogin();
1026 if (M3_SYSTEM_DEBUG) echo 'Debug mode<br />';
1028 // ##### サブページIDの設定 #####
1029 if ($gEnvManager->isAdminDirAccess() && // 管理画面へのアクセスのとき
1030 ($cmd == M3_REQUEST_CMD_LOGIN || $cmd == M3_REQUEST_CMD_LOGOUT)){ // ログイン、ログアウト場合は管理画面のページサブIDを指定
1031 $subId = $gEnvManager->getAdminDefaultPageSubId(); // 管理画面用のデフォルトページサブID
1033 $subId = $request->trimValueOf(M3_REQUEST_PARAM_PAGE_SUB_ID);// ページサブIDを取得
1034 if (empty($subId)){ // サブページIDが設定されていないとき
1035 // URLパラメータからコンテンツ形式を取得し、ページを選択
1036 $params = $gRequestManager->getQueryArray();
1037 $paramCount = count($params);
1039 // コマンド以外のパラメータ数が1つだけのときはパラメータからページ属性を判断する
1040 // 値が空でもキーがあれば属性を持つとする
1041 if ($paramCount == 0 && $gEnvManager->isAdminDirAccess() && $gEnvManager->isSystemAdmin() && empty($task)){
1042 // ダッシュボード機能は、パラメータなし、管理者ディレクトリ、システム管理者の条件で使用可能
1043 // POST値にタスクがある場合はダッシュボードとしない
1044 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_DASHBOARD, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1046 // ##### ダッシュボードはページの位置を示すので、ページのコンテンツ属性としない #####
1047 //$this->contentType = M3_VIEW_TYPE_DASHBOARD; // ページのコンテンツタイプ
1048 //if ($paramCount == 1 || !empty($params[M3_REQUEST_PARAM_OPERATION_COMMAND])){
1049 //} else if ($paramCount > 0 || !empty($params[M3_REQUEST_PARAM_OPERATION_COMMAND])){ // コマンド(プレビュー等)のとき、または複数パラメータでも可(2011/9/20)
1050 } else if ($paramCount > 0 && !$gEnvManager->isAdminDirAccess()){ // パラメータ付きの場合(2013/3/23)
1051 // ##### ページ属性から画面を選択(管理画面は対応しない) ###
1052 // 最初のURLパラメータでコンテンツを判断
1053 // プレビュー(cmd=preview)等のパターンで複数パラメータがある
1055 $firstKey = key($params);
1056 $firstValue = $params[$firstKey];
1058 if (!empty($firstValue)){ // 「key=value」の形式であること
1060 case M3_REQUEST_PARAM_CONTENT_ID: // コンテンツIDのとき
1061 case M3_REQUEST_PARAM_CONTENT_ID_SHORT:
1062 // ローカルメニューのURLからページを特定。ページが特定できないときはページ属性で取得。
1063 $url = $gEnvManager->getMacroPath($gEnvManager->getCurrentRequestUri());
1064 $ret = $this->db->getSubPageIdByMenuItemUrl($url, $gEnvManager->getCurrentPageId(), M3_VIEW_TYPE_CONTENT, $rows);
1066 $rowCount = count($rows);
1067 for ($i = 0; $i < $rowCount; $i++){
1068 // コンテンツを表示するウィジェットがあるときはページサブIDを確定
1069 //$widgetId = $this->db->getWidgetIdByType($gEnvManager->getCurrentPageId(), $rows[$i]['pd_sub_id'], M3_VIEW_TYPE_CONTENT);
1070 $widgetId = $this->db->getWidgetIdByContentType($gEnvManager->getCurrentPageId(), $rows[$i]['pd_sub_id'], M3_VIEW_TYPE_CONTENT);// コンテンツタイプでの取得に変更(2012/6/20)
1071 if (!empty($widgetId)){
1072 $subId = $rows[$i]['pd_sub_id'];
1077 if (empty($subId)) $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_CONTENT, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1078 $this->contentType = M3_VIEW_TYPE_CONTENT; // ページのコンテンツタイプ
1080 case M3_REQUEST_PARAM_PRODUCT_ID: // 製品IDのとき
1081 case M3_REQUEST_PARAM_PRODUCT_ID_SHORT:
1082 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_PRODUCT, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1083 $this->contentType = M3_VIEW_TYPE_PRODUCT; // ページのコンテンツタイプ
1085 case M3_REQUEST_PARAM_BBS_ID: // 掲示板投稿記事のとき
1086 case M3_REQUEST_PARAM_BBS_ID_SHORT:
1087 case M3_REQUEST_PARAM_BBS_THREAD_ID:
1088 case M3_REQUEST_PARAM_BBS_THREAD_ID_SHORT:
1089 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BBS, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1090 $this->contentType = M3_VIEW_TYPE_BBS; // ページのコンテンツタイプ
1092 case M3_REQUEST_PARAM_EVENT_ID: // イベント記事のとき
1093 case M3_REQUEST_PARAM_EVENT_ID_SHORT:
1094 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_EVENT, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1095 $this->contentType = M3_VIEW_TYPE_EVENT; // ページのコンテンツタイプ
1097 case M3_REQUEST_PARAM_PHOTO_ID: // フォトギャラリー写真のとき
1098 case M3_REQUEST_PARAM_PHOTO_ID_SHORT:
1099 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_PHOTO, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1100 $this->contentType = M3_VIEW_TYPE_PHOTO; // ページのコンテンツタイプ
1102 case M3_REQUEST_PARAM_BLOG_ID: // ブログIDのとき
1103 case M3_REQUEST_PARAM_BLOG_ID_SHORT:
1104 case M3_REQUEST_PARAM_BLOG_ENTRY_ID:
1105 case M3_REQUEST_PARAM_BLOG_ENTRY_ID_SHORT:
1106 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BLOG, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1107 $this->contentType = M3_VIEW_TYPE_BLOG; // ページのコンテンツタイプ
1109 case M3_REQUEST_PARAM_ROOM_ID: // ユーザ作成コンテンツのとき
1110 case M3_REQUEST_PARAM_ROOM_ID_SHORT:
1111 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_USER, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1112 $this->contentType = M3_VIEW_TYPE_USER; // ページのコンテンツタイプ
1114 // コンテンツを表示するウィジェットを取得
1115 //$widgetId = $this->db->getWidgetIdByType($gEnvManager->getCurrentPageId(), $subId, M3_VIEW_TYPE_USER);
1116 $widgetId = $this->db->getWidgetIdByContentType($gEnvManager->getCurrentPageId(), $subId, M3_VIEW_TYPE_USER);// コンテンツタイプでの取得に変更(2012/6/20)
1117 if (!empty($widgetId)){
1118 // ルーム用の定義ID(所属グループID)を取得
1119 $roomId = isset($params[M3_REQUEST_PARAM_ROOM_ID]) ? $params[M3_REQUEST_PARAM_ROOM_ID] : $params[M3_REQUEST_PARAM_ROOM_ID_SHORT];
1120 $configId = $this->db->getWidgetConfigIdForRoom($roomId);
1122 // グループIDを定義IDとするページのページサブIDを取得
1123 $subPageId = $this->getPageSubIdByWidget($gEnvManager->getCurrentPageId(), $widgetId, $configId);
1124 if (!empty($subPageId)) $subId = $subPageId;
1127 default: // オプションのURLコンテンツパラメータからサブページIDを取得
1128 $ret = $this->db->getSubPageIdByUrlContentParam($gEnvManager->getCurrentPageId(), $firstKey, $row);
1129 if ($ret) $subId = $row['pd_sub_id'];
1134 if (isset($params[M3_REQUEST_PARAM_CONTENT_ID]) || isset($params[M3_REQUEST_PARAM_CONTENT_ID_SHORT])){ // コンテンツIDのとき
1135 // ローカルメニューのURLからページを特定。ページが特定できないときはページ属性で取得。
1136 $url = $gEnvManager->getMacroPath($gEnvManager->getCurrentRequestUri());
1137 $ret = $this->db->getSubPageIdByMenuItemUrl($url, $gEnvManager->getCurrentPageId(), $rows);
1139 $rowCount = count($rows);
1140 for ($i = 0; $i < $rowCount; $i++){
1141 // コンテンツを表示するウィジェットがあるときはページサブIDを確定
1142 //$widgetId = $this->db->getWidgetIdByType($gEnvManager->getCurrentPageId(), $rows[$i]['pd_sub_id'], M3_VIEW_TYPE_CONTENT);
1143 $widgetId = $this->db->getWidgetIdByContentType($gEnvManager->getCurrentPageId(), $rows[$i]['pd_sub_id'], M3_VIEW_TYPE_CONTENT);// コンテンツタイプでの取得に変更(2012/6/20)
1144 if (!empty($widgetId)){
1145 $subId = $rows[$i]['pd_sub_id'];
1150 if (empty($subId)) $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_CONTENT, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1151 $this->contentType = M3_VIEW_TYPE_CONTENT; // ページのコンテンツタイプ
1152 } else if (isset($params[M3_REQUEST_PARAM_PRODUCT_ID]) || isset($params[M3_REQUEST_PARAM_PRODUCT_ID_SHORT])){ // 製品IDのとき
1153 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_PRODUCT, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1154 $this->contentType = M3_VIEW_TYPE_PRODUCT; // ページのコンテンツタイプ
1155 } else if ((isset($params[M3_REQUEST_PARAM_BBS_ID]) || isset($params[M3_REQUEST_PARAM_BBS_ID_SHORT])) ||
1156 (isset($params[M3_REQUEST_PARAM_BBS_THREAD_ID]) || isset($params[M3_REQUEST_PARAM_BBS_THREAD_ID_SHORT]))){ // 掲示板投稿記事のとき
1157 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BBS, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1158 $this->contentType = M3_VIEW_TYPE_BBS; // ページのコンテンツタイプ
1159 } else if (isset($params[M3_REQUEST_PARAM_EVENT_ID]) || isset($params[M3_REQUEST_PARAM_EVENT_ID_SHORT])){ // イベント記事のとき
1160 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_EVENT, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1161 $this->contentType = M3_VIEW_TYPE_EVENT; // ページのコンテンツタイプ
1162 } else if (isset($params[M3_REQUEST_PARAM_PHOTO_ID]) || isset($params[M3_REQUEST_PARAM_PHOTO_ID_SHORT])){ // フォトギャラリー写真のとき
1163 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_PHOTO, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1164 $this->contentType = M3_VIEW_TYPE_PHOTO; // ページのコンテンツタイプ
1165 } else if ((isset($params[M3_REQUEST_PARAM_BLOG_ID]) || isset($params[M3_REQUEST_PARAM_BLOG_ID_SHORT])) || // ブログIDのとき
1166 (isset($params[M3_REQUEST_PARAM_BLOG_ENTRY_ID]) || isset($params[M3_REQUEST_PARAM_BLOG_ENTRY_ID_SHORT]))){ // ブログ記事のとき
1167 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_BLOG, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1168 $this->contentType = M3_VIEW_TYPE_BLOG; // ページのコンテンツタイプ
1169 } else if (isset($params[M3_REQUEST_PARAM_ROOM_ID]) || isset($params[M3_REQUEST_PARAM_ROOM_ID_SHORT])){ // ユーザ作成コンテンツのとき
1170 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_USER, $gEnvManager->getCurrentPageId());// ページサブIDを取得
1171 $this->contentType = M3_VIEW_TYPE_USER; // ページのコンテンツタイプ
1173 // コンテンツを表示するウィジェットを取得
1174 //$widgetId = $this->db->getWidgetIdByType($gEnvManager->getCurrentPageId(), $subId, M3_VIEW_TYPE_USER);
1175 $widgetId = $this->db->getWidgetIdByContentType($gEnvManager->getCurrentPageId(), $subId, M3_VIEW_TYPE_USER);// コンテンツタイプでの取得に変更(2012/6/20)
1176 if (!empty($widgetId)){
1177 // ルーム用の定義ID(所属グループID)を取得
1178 $roomId = isset($params[M3_REQUEST_PARAM_ROOM_ID]) ? $params[M3_REQUEST_PARAM_ROOM_ID] : $params[M3_REQUEST_PARAM_ROOM_ID_SHORT];
1179 $configId = $this->db->getWidgetConfigIdForRoom($roomId);
1181 // グループIDを定義IDとするページのページサブIDを取得
1182 $subPageId = $this->getPageSubIdByWidget($gEnvManager->getCurrentPageId(), $widgetId, $configId);
1183 if (!empty($subPageId)) $subId = $subPageId;
1190 // 「http://www.example.com?ページ名」「wcmd」の場合はwikiコンテンツページを選択
1191 $wikiCmd = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_WIKI_COMMAND);
1192 $pageName = $gRequestManager->getWikiPageFromQuery(); // 「=」なしのパラメータはwikiパラメータとする
1194 if (!empty($wikiCmd) || !empty($pageName)){ // Wikiコンテンツページを指定のとき
1196 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_WIKI, $gEnvManager->getCurrentPageId());
1197 $this->contentType = M3_VIEW_TYPE_WIKI; // ページのコンテンツタイプ
1200 // その他のGET,POSTパラメータからページサブID取得
1201 if (empty($subId)) $subId = $this->getPageSubIdByParam($request, $gEnvManager->getCurrentPageId());
1203 // ページサブIDが取得できない場合はデフォルトを使用
1204 if (empty($subId)) $subId = $gEnvManager->getDefaultPageSubId();
1207 $gEnvManager->setCurrentPageSubId($subId);// サブページIDを設定
1209 // SSL通信機能がオンの場合は、アクセスされたURLのSSLをチェックし不正の場合は正しいURLにリダイレクト
1210 // 設定に間違いがある場合、管理画面にアクセスできなくなるので、一般画面のみ制御
1211 if ($gEnvManager->getUseSsl() || $gEnvManager->getUseSslAdmin()){
1212 if (!$gEnvManager->isAdminDirAccess()){ // 管理画面以外へのアクセスのとき
1213 $isSsl = $gEnvManager->isSslByCurrentPage();
1214 $currentUrl = $gEnvManager->getCurrentRequestUri();
1216 $correctUrl = str_replace('http://', 'https://', $currentUrl);
1218 $correctUrl = str_replace('https://', 'http://', $currentUrl);
1220 if ($currentUrl != $correctUrl) $this->redirect($correctUrl);
1224 $gEnvManager->initMultiDomain();
1227 $gDispManager->load();
1229 // ##### 画面に必要なスクリプトを追加 #####
1230 // スマートフォン用URLのときはスマートフォン用のjQueryを使用
1231 if ($gEnvManager->getIsSmartphoneSite()){
1232 $this->selectedJQueryFilename = ScriptLibInfo::getJQueryFilename(10); // スマートフォン用jQueryファイル
1234 if (isset($this->libFiles[ScriptLibInfo::LIB_JQUERYS_MOBILE]['script'])){
1235 $scriptFiles = $this->libFiles[ScriptLibInfo::LIB_JQUERYS_MOBILE]['script'];
1236 if (count($scriptFiles) > 0) $this->selectedJQueryMobileFilename = $scriptFiles[0]; // 使用対象のjQueryMobileファイル
1240 // Magic3管理用のスクリプトを追加
1241 if (!$gEnvManager->getIsMobileSite()){ // 携帯用URL以外のとき
1242 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
1243 if ($gEnvManager->isSystemManageUser()){ // システム運用権限がある場合のみ有効
1244 $this->isEditMode = true; // 一般画面編集モード
1245 $this->isPageEditable = true; // 一般画面ページ編集可能モードに設定(コンテキストメニュー表示)
1248 if ($cmd == M3_REQUEST_CMD_CONFIG_WIDGET){ // ウィジェット詳細設定画面のとき
1249 $this->addAdminScript('', ScriptLibInfo::getWysiwygEditorLibId()); // WYSIWYGエディターを追加
1251 // Googleマップライブラリの読み込み
1252 if ($this->useGooglemaps && $this->wysiwygEditor == ScriptLibInfo::LIB_CKEDITOR){ // CKEditorの場合はGoogleマップライブラリを読み込む
1253 $this->defaultAdminScriptFiles[] = ScriptLibInfo::getScript(ScriptLibInfo::LIB_GOOGLEMAPS);
1255 } else if ($cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // 管理画面(ウィジェット付きポジション表示)のとき
1256 //$this->addAdminScript('', ScriptLibInfo::LIB_JQUERY_JQEASYPANEL); // パネルメニュー(一般画面と管理画面の切り替え等)用
1258 $this->addAdminScript('', ScriptLibInfo::LIB_JQUERY_CLUETIP);// HELP用スクリプト追加
1260 // スクリプトが必要なウィジェットをすべて取得
1261 $this->db->getWidgetsIdWithLib($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId(), $rows);
1262 for ($i = 0; $i < count($rows); $i++){
1263 $this->addAdminScript($task, trim($rows[$i]['wd_add_script_lib']));
1265 if ($cmd == M3_REQUEST_CMD_CONFIG_WIDGET){ // ウィジェット詳細設定画面のとき
1267 $widgetId = $request->trimValueOf(M3_REQUEST_PARAM_WIDGET_ID);
1268 $ret = $this->db->getWidgetInfo($widgetId, $row);
1269 if ($ret) $this->addAdminScript($task, trim($row['wd_add_script_lib_a'])); // 管理機能用スクリプト
1272 } else { // 一般画面へのアクセスのとき
1274 $value = $gSystemManager->getSystemConfig(self::CF_USE_JQUERY);// 常にjQueryを使用するかどうか
1275 if ($value) $this->addScriptFile($this->selectedJQueryFilename);
1277 if ($cmd != M3_REQUEST_CMD_DO_WIDGET && // ウィジェット単体実行でない
1278 $cmd != M3_REQUEST_CMD_RSS){ // RSS配信でない
1279 if ($gEnvManager->isSystemManageUser()){
1280 $this->isEditMode = true; // 一般画面編集モード
1281 $this->isPageEditable = true; // 一般画面ページ編集可能モードに設定
1283 // システム運用権限がある場合は管理用スクリプトを追加
1284 // 一般画面と管理画面の切り替え用のスライドメニューバーには管理用スクリプト,CSSが必要
1285 $this->addScriptFile($this->selectedJQueryFilename); // JQueryスクリプト追加
1286 $this->addScriptFile(ScriptLibInfo::JQUERY_CONTEXTMENU_FILENAME); // jQuery Contextmenu Lib
1287 $this->addScriptFile(self::M3_ADMIN_SCRIPT_FILENAME); // 管理スクリプトライブラリ追加
1288 //$this->addScript('', ScriptLibInfo::LIB_JQUERY_JQEASYPANEL); // パネルメニュー(一般画面と管理画面の切り替え等)用
1289 $this->addScript('', ScriptLibInfo::LIB_JQUERY_M3_SLIDEPANEL);// パネル用スクリプト追加
1290 $this->addScript('', ScriptLibInfo::LIB_JQUERY_CLUETIP);// HELP用スクリプト追加
1292 $this->addCssFile(self::M3_ADMIN_CSS_FILE); // 管理機能用CSS
1293 if (!$this->useBootstrap) $this->addCssFile(self::M3_NO_BOOTSTRAP_CSS_FILE); // Bootstrapを読み込まない場合は代替CSSを読み込む
1295 } else if ($cmd == M3_REQUEST_CMD_DO_WIDGET && !empty($openBy)){ // ウィジェット単体実行でウィンドウを持つ場合の追加スクリプト
1296 if ($gEnvManager->isContentEditableUser()){ // コンテンツ編集可能ユーザの場合
1297 $this->isEditMode = true; // 一般画面編集モード
1299 //$this->addScript('', ScriptLibInfo::LIB_FCKEDITOR);// FCKEditorスクリプト追加
1300 $this->addScript('', ScriptLibInfo::getWysiwygEditorLibId()); // WYSIWYGエディターを追加
1301 $this->addScriptFile(self::M3_PLUS_SCRIPT_FILENAME); // 一般画面追加用スクリプト追加(PLUSライブラリを追加する場合はFCKEditorも使用可能にする)
1302 $this->addScriptFile(self::M3_OPTION_SCRIPT_FILENAME); // Magic3のオプションライブラリ追加
1303 $this->addScript('', ScriptLibInfo::LIB_JQUERY_CLUETIP);// HELP用スクリプト追加
1305 // Googleマップライブラリの読み込み
1306 if ($this->useGooglemaps && $this->wysiwygEditor == ScriptLibInfo::LIB_CKEDITOR){ // CKEditorの場合はGoogleマップライブラリを読み込む
1307 $this->addScriptFile(ScriptLibInfo::getScript(ScriptLibInfo::LIB_GOOGLEMAPS));
1315 $row = $this->getPageInfo($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId());
1317 // ショートURLで取得できない場合は、ページコンテンツタイプを取得
1318 if (empty($this->contentType)) $this->contentType = $row['pn_content_type'];
1321 $this->currentPageInfo = $row; // 現在のページのページ情報
1325 if ($openBy == 'tabs') $this->isTransparentMode = true; // 画面透過モード
1334 global $gEnvManager;
1335 global $gSystemManager;
1337 $lang = $gEnvManager->getCurrentLanguage();
1339 // デフォルト言語とカレント言語が異なる場合のみ実行
1340 if ($lang != $gEnvManager->getDefaultLanguage()){
1342 $gSystemManager->roadSiteDefByLang($lang);
1346 $this->headDescription = $gSystemManager->getSiteDef(M3_TB_FIELD_SITE_DESCRIPTION); // HTMLヘッダ「description」に出力する文字列
1347 $this->headKeywords = $gSystemManager->getSiteDef(M3_TB_FIELD_SITE_KEYWORDS); // HTMLヘッダ「keywords」に出力する文字列
1348 $this->headOthers = $gSystemManager->getSiteDef(self::SD_HEAD_OTHERS); // HTMLヘッダに出力するタグ文字列
1350 // デフォルトのページ情報でヘッダを更新
1351 if (!empty($this->currentPageInfo)){
1352 $title = $this->currentPageInfo['pn_meta_title']; // 画面タイトル
1353 $desc = $this->currentPageInfo['pn_meta_description']; // ページ要約
1354 $keyword = $this->currentPageInfo['pn_meta_keywords']; // ページキーワード
1355 $headOthers = $this->currentPageInfo['pn_head_others']; // ヘッダその他タグ
1357 if (!empty($title)) $this->setHeadSubTitle($title);
1358 if (!empty($desc)) $this->setHeadDescription($desc);
1359 if (!empty($keyword)) $this->setHeadKeywords($keyword);
1360 if (!empty($headOthers)) $this->setHeadOthers($headOthers);
1363 // 現在の言語のページ情報でヘッダを更新
1364 $ret = $this->db->getPageInfo($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId(), $lang, $row);
1366 $title = $row['pn_meta_title']; // 画面タイトル
1367 $desc = $row['pn_meta_description']; // ページ要約
1368 $keyword = $row['pn_meta_keywords']; // ページキーワード
1369 $headOthers = $row['pn_head_others']; // ヘッダその他タグ
1371 if (!empty($title)) $this->setHeadSubTitle($title);
1372 if (!empty($desc)) $this->setHeadDescription($desc);
1373 if (!empty($keyword)) $this->setHeadKeywords($keyword);
1374 if (!empty($headOthers)) $this->setHeadOthers($headOthers);
1377 // $this->currentPageInfo = $row; // 現在のページのページ情報
1381 * スクリプト追加情報から、管理機能用のJavascriptファイル、CSSを追加する
1383 * @param string $task 指定タスク
1384 * @param string $scriptInfo スクリプト追加情報
1387 function addAdminScript($task, $scriptInfo)
1389 $itemArray = explode(self::SCRIPT_LIB_SEPARATOR, strtolower(trim($scriptInfo)));// 小文字に変換したものを解析
1390 for ($i = 0; $i < count($itemArray); $i++){
1391 $pos = strpos($itemArray[$i], '=');
1392 if ($pos === false){// 見つからないときは、タスクが指定されないとき
1393 $libs = trim($itemArray[$i]);
1394 } else { // タスク指定のとき
1395 list($libTask, $libs) = explode('=', trim($itemArray[$i]));
1396 $libTask = trim($libTask);
1397 $libs = trim($libs);
1399 if (strEndsWith($libTask, '_')){ // 「task_subtask」形式のタスクのとき
1400 if (!strStartsWith($task, $libTask)) $libs = ''; // タスクIDの先頭部が異なるときは追加しない
1402 if (empty($libTask) || $libTask != $task) $libs = ''; // タスクが異なるときは追加しない
1405 if (!empty($libs)){ // // スクリプト、CSSの追加を行うとき
1406 $libsArray = explode(',', $libs);
1407 for ($j = 0; $j < count($libsArray); $j++){
1408 $lib = strtolower(trim($libsArray[$j]));// 小文字に変換
1409 if (isset($this->libFiles[$lib])){ // ライブラリが存在するとき
1411 if (strcmp($lib, ScriptLibInfo::LIB_ELFINDER) == 0 || strcmp($lib, ScriptLibInfo::LIB_JQUERY_TIMEPICKER) == 0){ // elFinderを使用する場合
1412 // jQuery UIライブラリを追加
1413 $dependentLib = ScriptLibInfo::getDependentLib($lib);
1414 for ($l = 0; $l < count($dependentLib); $l++){
1415 $addLib = $dependentLib[$l];
1418 if (isset($this->libFiles[$addLib]['script'])){
1419 $scriptFiles = $this->libFiles[$addLib]['script'];
1420 for ($m = 0; $m < count($scriptFiles); $m++){
1421 $this->addAdminScriptFile($scriptFiles[$m]); // 通常機能用のスクリプト追加
1424 if (isset($this->libFiles[$addLib]['css'])){
1425 $cssFiles = $this->libFiles[$addLib]['css'];
1426 for ($m = 0; $m < count($cssFiles); $m++){
1427 $this->addAdminCssFile($cssFiles[$m]); // 通常機能用のCSS追加
1432 if (!$this->outputTheme){ // jQueryUIテーマ出力を行ったかどうか
1433 $this->addAdminCssFile($this->getAdminDefaultThemeUrl()); // CSS追加(絶対パス)
1434 $this->outputTheme = true;
1438 if (isset($this->libFiles[$lib]['script'])){
1439 $scriptFiles = $this->libFiles[$lib]['script'];
1440 for ($l = 0; $l < count($scriptFiles); $l++){
1441 $this->addAdminScriptFile($scriptFiles[$l]); // 管理機能用のスクリプト追加
1445 if (isset($this->libFiles[$lib]['css'])){
1446 $cssFiles = $this->libFiles[$lib]['css'];
1447 for ($l = 0; $l < count($cssFiles); $l++){
1448 $this->addAdminCssFile($cssFiles[$l]); // 管理機能用のCSS追加
1452 if (strncmp($lib, 'jquery-ui.', 10) == 0){ // jQuery UIのwidgetsまたはeffectsのとき。jQuery UI Coreはデフォルトで読み込まれている。
1454 if (!$this->outputTheme){ // jQueryUIテーマ出力を行ったかどうか
1455 //$this->addHeadCssFile($this->getAdminDefaultThemeUrl()); // CSS追加
1456 $this->addAdminCssFile($this->getAdminDefaultThemeUrl()); // CSS追加(絶対パス)
1457 $this->outputTheme = true;
1466 * スクリプト追加情報から、通常機能用のJavascriptファイル、CSSを追加する
1468 * @param string $task 指定タスク
1469 * @param string $scriptInfo スクリプト追加情報
1472 function addScript($task, $scriptInfo)
1475 $jQueryUiInfo = ScriptLibInfo::getJQueryUiInfo();
1477 $itemArray = explode(self::SCRIPT_LIB_SEPARATOR, strtolower(trim($scriptInfo)));// 小文字に変換したものを解析
1478 for ($i = 0; $i < count($itemArray); $i++){
1479 $pos = strpos($itemArray[$i], '=');
1480 if ($pos === false){// 見つからないときは、タスクが指定されないとき
1481 $libs = trim($itemArray[$i]);
1482 } else { // タスク指定のとき
1483 list($libTask, $libs) = explode('=', trim($itemArray[$i]));
1484 $libTask = trim($libTask);
1485 $libs = trim($libs);
1486 if (empty($libTask) || $libTask != $task) $libs = ''; // タスクが異なるときは追加しない
1488 if (!empty($libs)){ // // スクリプト、CSSの追加を行うとき
1489 $libsArray = explode(',', $libs);
1490 for ($j = 0; $j < count($libsArray); $j++){
1491 $lib = strtolower(trim($libsArray[$j]));// 小文字に変換
1493 // jQueryライブラリ等、デフォルトでは追加されないライブラリを追加
1494 if (strcmp($lib, 'jquery') == 0){// jQuery本体のとき
1495 $this->addScriptFile($this->selectedJQueryFilename); // JQueryスクリプト追加
1496 } else if (isset($this->libFiles[$lib])){ // ライブラリが存在するとき
1497 // ライブラリの依存ライブラリファイルを追加
1498 if (strncmp($lib, 'jquery.', 7) == 0){ // jQueryプラグインのとき
1499 $this->addScriptFile($this->selectedJQueryFilename); // JQueryスクリプト追加
1500 if (strcmp($lib, 'jquery.mobile') == 0){ // jQueryMobileファイルのとき
1501 // ##### jQueryMobileが読み込まれる前に読み込む必要があるスクリプトを設定 #####
1502 if (!empty($this->headPreMobileScriptFiles)){ // jQueryMobileファイルの前に出力
1503 for ($l = 0; $l < count($this->headPreMobileScriptFiles); $l++){
1504 $this->addScriptFile($this->headPreMobileScriptFiles[$l]); // 通常機能用のスクリプト追加
1508 } else if (strcmp($lib, ScriptLibInfo::LIB_JQUERY_UI) == 0){ // jQuery UI
1509 $this->addScriptFile($this->selectedJQueryFilename); // JQueryスクリプト追加
1510 //} else if (strcmp($lib, ScriptLibInfo::LIB_JQUERY_UI_PLUS) == 0){ // jQuery UI plus
1511 // $this->addScriptFile($this->selectedJQueryFilename); // JQueryスクリプト追加
1512 // $this->addScriptFile($this->selectedJQueryUiFilename); // jQuery Coreスクリプト追加
1513 } else if (strncmp($lib, 'jquery-ui.', 10) == 0){ // jQuery UIのwidgetsまたはeffectsのとき
1515 $parentLib = $jQueryUiInfo[$lib]; // 依存ライブラリ取得
1516 for ($l = 0; $l < count($parentLib); $l++){
1517 $addLib = $parentLib[$l];
1520 if (isset($this->libFiles[$addLib]['script'])){
1521 $scriptFiles = $this->libFiles[$addLib]['script'];
1522 for ($m = 0; $m < count($scriptFiles); $m++){
1523 $this->addScriptFile($scriptFiles[$m]); // 通常機能用のスクリプト追加
1526 if (isset($this->libFiles[$addLib]['css'])){
1527 $cssFiles = $this->libFiles[$addLib]['css'];
1528 for ($m = 0; $m < count($cssFiles); $m++){
1529 $this->addCssFile($cssFiles[$m]); // 通常機能用のCSS追加
1534 if (!$this->outputTheme){ // jQueryUIテーマ出力を行ったかどうか
1535 //$this->addHeadCssFile($this->getAdminDefaultThemeUrl()); // CSS追加
1536 $this->addHeadCssFile($this->getDefaultThemeUrl()); // CSS追加
1537 $this->outputTheme = true;
1542 if (isset($this->libFiles[$lib]['script'])){
1543 $scriptFiles = $this->libFiles[$lib]['script'];
1544 for ($l = 0; $l < count($scriptFiles); $l++){
1545 $this->addScriptFile($scriptFiles[$l]); // 通常機能用のスクリプト追加
1548 if (isset($this->libFiles[$lib]['css'])){
1549 $cssFiles = $this->libFiles[$lib]['css'];
1550 for ($l = 0; $l < count($cssFiles); $l++){
1551 $this->addCssFile($cssFiles[$l]); // 通常機能用のCSS追加
1560 * 非ログイン時の管理機能用のJavascriptファイル、CSSを追加する
1562 * @param string $libId 追加ライブラリID
1565 function addDefaultAdminScript($libId)
1568 if (isset($this->libFiles[$libId]['script'])){
1569 $scriptFiles = $this->libFiles[$libId]['script'];
1570 for ($i = 0; $i < count($scriptFiles); $i++){
1571 $this->defaultAdminDirScriptFiles[] = $scriptFiles[$i]; // デフォルトで読み込むスクリプトファイル(管理ディレクトリ用)
1575 if (isset($this->libFiles[$libId]['css'])){
1576 $cssFiles = $this->libFiles[$libId]['css'];
1577 for ($i = 0; $i < count($cssFiles); $i++){
1578 $this->defaultAdminDirCssFiles[] = $cssFiles[$i]; // デフォルトで読み込むCSSファイル(管理ディレクトリ用)
1587 * ・ウィジェットで生成されたHTTPヘッダを設定する
1589 * @param RequestManager $request HTTPリクエスト処理クラス
1590 * @param bool $getOutput 出力を取得するかどうか
1591 * @return string 最終出力HTML
1593 function endPage($request, $getOutput = false)
1595 global $gRequestManager;
1596 global $gInstanceManager;
1597 global $gEnvManager;
1598 global $gDispManager;
1599 global $gAccessManager;
1602 if ($this->isAbort) return '';
1607 $cmd = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
1609 // 最終HTML(ページ全体で使用するHTML)の出力
1610 if ($cmd != M3_REQUEST_CMD_DO_WIDGET){ // ウィジェット単体オペレーションのときは出力しない
1612 $contents = $this->getLastContents($request);
1614 echo $this->getLastContents($request);
1619 $userInfo = $gInstanceManager->getUserInfo();
1620 $gRequestManager->setSessionValueWithSerialize(M3_SESSION_USER_INFO, $userInfo);
1623 $gDispManager->save();
1625 // キャッシュリミッタは、各リクエスト毎に(アウトプットバッファー が無効な場合は、
1626 // session_start()がコールされる 前に) session_cache_limiter()をコールする必要がある。
1628 // session_cache_limiter('private');
1629 // session_cache_expire(5);
1630 if ($this->isRedirect) return ''; // リダイレクトの場合は終了
1632 // ########## HTTPヘッダ出力処理 ########
1633 if (headers_sent($filename, $linenum)){ // HTTPヘッダが既に送信されているとき
1634 echo "$filename の $linenum 行目でヘッダがすでに送信されています。";
1636 if ($gEnvManager->isMobile()){ // 携帯の場合
1637 // ドコモ端末の場合はリクエストヘッダにXHTMLを指定しないとXHTMLを処理しない
1638 $agent = $gInstanceManager->getMobileAgent();
1639 if ($agent->isDoCoMo()){ // ドコモ端末のとき
1640 header('Content-Type: application/xhtml+xml;');
1644 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');// 過去の日付
1645 header('Cache-Control: no-store, no-cache, must-revalidate');// HTTP/1.1
1646 header('Cache-Control: post-check=0, pre-check=0', false);
1647 header('Pragma: no-cache');
1650 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
1652 // Ajax用JSON型データをHTTPヘッダに格納
1653 $gInstanceManager->getAjaxManager()->header();
1655 // システム制御画面が設定されている場合はステータスコードを変更
1656 //if ($this->gEnv->getIsMaintenance()){
1657 if (!$this->isRedirect){ // リダイレクトがセットされていない場合
1658 switch ($this->systemHandleMode){
1659 case 10: // サイト非公開(システムメンテナンス)
1660 header('HTTP/1.1 503 Service Temporarily Unavailable');
1661 header('Status: 503 Service Temporarily Unavailable');
1663 case 11: // アクセス禁止のとき
1664 header('HTTP/1.1 403 Forbidden');
1665 header('Status: 403 Forbidden');
1667 case 12: // 存在しないページのとき
1668 header("HTTP/1.1 404 Not Found");
1669 header("Status: 404 Not Found");
1674 // ##### 自動ログイン #####
1675 $gAccessManager->endAutoLogin();
1684 function abortPage()
1686 global $gInstanceManager;
1687 global $gRequestManager;
1689 // HTTPヘッダを削除(PHP 5.3以上で有効)
1690 if (version_compare(PHP_VERSION, '5.3.0') >= 0) header_remove();
1692 // exit()等でabortPage()が最後の処理になってしまう可能性があるのでなるべく必要な処理を行う
1693 //if (ob_get_level() > 0) ob_end_clean();// バッファ内容が残っているときは破棄
1694 while (ob_get_level()) ob_end_clean(); // バッファ削除方法変更(2009/12/2)
1697 $userInfo = $gInstanceManager->getUserInfo();
1698 $gRequestManager->setSessionValueWithSerialize(M3_SESSION_USER_INFO, $userInfo);
1700 $this->isAbort = true; // ページ作成処理を中断するかどうか
1707 function exitSystem()
1709 global $gEnvManager;
1710 global $gAccessManager;
1712 // DBが使用可能であれば、アクセスログのユーザを登録
1713 if ($gEnvManager->canUseDb()) $gAccessManager->accessLogUser();
1718 * Joomla!v1.5タグを読み込んでウィジェット実行
1720 * @param string $srcBuf バッファデータ
1721 * @param int $templateVer テンプレートバージョン(0=デフォルト(Joomla!v1.0)、-1=携帯用、1=Joomla!v1.5、2=Joomla!v2.5)
1722 * @return string 変換後文字列
1724 function launchWidgetByJoomlaTag($srcBuf, $templateVer)
1730 if (preg_match_all('#<jdoc:include\ type="([^"]+)" (.*)\/>#iU', $srcBuf, $matches)){
1731 $count = count($matches[1]);
1732 for ($i = 0; $i < $count; $i++)
1735 $type = $matches[1][$i];
1737 if (strcasecmp($type, 'head') == 0){ // ヘッダ埋め込みタグの場合
1740 $contents = ob_get_contents();
1741 } else if (strcasecmp($type, 'modules') == 0 ||
1742 strcasecmp($type, 'module') == 0){ // ポジションタグの場合
1743 $name = ''; // ポジション名
1744 $style = ''; // 表示スタイル
1745 $params = explode(' ', $matches[2][$i]);
1746 for ($j = 0; $j < count($params); $j++){
1747 list($key, $value) = explode('=', $params[$j]);
1748 if (strcasecmp($key, 'name') == 0){
1749 $name = strtolower(trim($value, "\"'"));
1750 $attr['name'] = $name;
1751 } else if (strcasecmp($key, 'style') == 0){
1753 $style = trim($value, "\"'");
1754 } else if (strcasecmp($key, 'artstyle') == 0){ // 表示スタイル
1755 $attr['artstyle'] = trim($value, "\"'");
1758 if (!empty($name)){ // ポジション名が取得できたとき
1759 // Joomla!では、テンプレートの「jdoc:include」タグの属性styleが空のときは「none」で処理される
1760 // Joomla!デフォルトで設定可能なのは「none,table,horz,xhtml,rounded,outline」
1762 if (strStartsWith($name, 'user') || // ナビゲーションメニュー位置の場合
1763 strcasecmp($name, 'position-1') == 0){ // Joomla!v2.5テンプレート対応
1764 $style = '_mainmenu'; // デフォルトはナビゲーション型
1770 $contents = $this->getContents($name, $style, $templateVer, $attr);
1772 } else if (strcasecmp($type, 'component') == 0){ // メインポジションタグの場合
1774 $style = ''; // 表示スタイル
1775 $params = explode(' ', $matches[2][$i]);
1776 for ($j = 0; $j < count($params); $j++){
1777 list($key, $value) = explode('=', $params[$j]);
1778 if (strcasecmp($key, 'style') == 0){
1780 $style = trim($value, "\"'");
1784 if ($style != 'none') $style = 'xhtml';
1785 $contents = $this->getContents('main', $style, $templateVer, $attr);
1786 } else if (strcasecmp($type, 'message') == 0){ // メッセージタグの場合
1788 $replace[$i] = $contents;
1791 $destBuf = str_replace($matches[0], $replace, $srcBuf);
1798 * 遅延実行インデックスのついているウィジェットをインデックス順に実行し、出力バッファデータ内のタグの位置に出力を埋め込む
1800 * @param RequestManager $request HTTPリクエスト処理クラス
1801 * @param string $srcBuf バッファデータ
1802 * @return string 変換後文字列
1804 function lateLaunchWidget($request, $srcBuf)
1806 global $gEnvManager;
1807 global $gErrorManager;
1808 global $gDesignManager;
1810 // ウィジェットヘッダ(Joomla!1.0用)を出力のタイプを取得
1811 $widgetHeaderType = $this->getTemplateWidgetHeaderType();
1813 // 遅延実行ウィジェットをインデックス順にソート
1814 asort($this->lateLaunchWidgetList, SORT_NUMERIC);
1818 foreach ($this->lateLaunchWidgetList as $widgetId => $value){
1820 $count = count($this->latelaunchWidgetParam);
1821 for ($i = 0; $i < $count; $i++){
1822 list($wId, $index, $confId, $preId, $serial, $style, $cssStyle, $title, $shared) = $this->latelaunchWidgetParam[$i];
1823 if ($wId == $widgetId){
1825 $this->lastHeadCss = ''; // 最後に設定したHTMLヘッダにCSS出力する文字列
1826 $this->lastHeadScript = ''; // 最後に設定したHTMLヘッダにJavascript出力する文字列
1827 $this->lastHeadString = ''; // 最後に設定したHTMLヘッダに出力する任意文字列
1833 $widgetIndexFile = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/index.php';
1836 $configId = $confId; // ウィジェット定義ID
1837 if ($configId == 0) $configId = '';
1838 $prefix = $preId; // サフィックス文字列
1840 // Joomla!1.0テンプレートのときはウィジェットタイトルを出力
1841 $joomlaTitleVisble = false;
1842 if ($widgetHeaderType > 0 && empty($style)){ // Joomla!1.0テンプレートのとき
1843 if (!empty($title)){
1844 if ($widgetHeaderType == 1){ // PC用ウィジェットヘッダ出力
1845 echo '<table ' . self::JOOMLA10_DEFAULT_WIDGET_MENU_PARAM . '>' . M3_NL;
1846 echo '<tr><th>' . $title . '</th></tr>' . M3_NL;
1847 echo '<tr><td>' . M3_NL;
1848 $joomlaTitleVisble = true;
1849 } else if ($widgetHeaderType == 2){ // 携帯用ウィジェットヘッダ出力
1850 echo '<div>' . $title . '</div>' . M3_NL;
1851 $joomlaTitleVisble = true;
1856 //echo '<div class="' . self::WIDGET_TAG_HEAD_SHORT . $widgetId . '">' . M3_NL;
1857 // ウィジェット親のCSS定義があるときは、タグを追加
1858 if (!empty($cssStyle)) echo '<div style="' . $cssStyle . '">' . M3_NL;
1861 echo $gDesignManager->getAdditionalWidgetOutput(true);
1864 $gEnvManager->setCurrentWidgetId($widgetId);
1867 $gEnvManager->setCurrentWidgetConfigId($configId);
1870 $gEnvManager->setCurrentPageDefSerial($serial);
1873 $gEnvManager->setCurrentWidgetPrefix($prefix); // プレフィックス文字列
1876 $gEnvManager->setCurrentWidgetTitle('');
1878 // ウィジェットのページ共通状況を設定
1879 $gEnvManager->setIsCurrentWidgetShared($shared);
1882 $this->db->writeWidgetLog($widgetId, 0/*ページ実行*/);
1885 // ウィジェットの呼び出しは、複数回存在する可能性があるのでrequire_once()で呼び出さない
1886 $msg = 'widget-start(' . $widgetId . ')';
1887 $gErrorManager->writeDebug(__METHOD__, $msg); // 時間計測用
1888 require($widgetIndexFile);
1889 $msg = 'widget-end(' . $widgetId . ')';
1890 $gErrorManager->writeDebug(__METHOD__, $msg); // 時間計測用
1893 $gEnvManager->setCurrentWidgetId('');
1896 $gEnvManager->setCurrentWidgetConfigId('');
1899 $gEnvManager->setCurrentPageDefSerial(0);
1902 $gEnvManager->setCurrentWidgetPrefix(''); // プレフィックス文字列
1904 // ウィジェットのページ共通状況を解除
1905 $gEnvManager->setIsCurrentWidgetShared(false);
1908 $newTitle = $gEnvManager->getCurrentWidgetTitle();
1911 echo $gDesignManager->getAdditionalWidgetOutput(false);
1913 // ウィジェット親のCSS定義があるときは、タグを追加
1914 if (!empty($cssStyle)) echo '</div>' . M3_NL;
1916 //echo '</div>' . M3_NL;
1918 // Joomla!1.0テンプレートのときはタイトルを出力
1919 if ($joomlaTitleVisble && $widgetHeaderType == 1){ // PC用ウィジェットヘッダ出力
1920 echo '</td></tr>' . M3_NL;
1921 echo '</table>' . M3_NL;
1924 // 現在のバッファ内容を取得し、バッファを破棄
1925 $srcContents = ob_get_contents();
1929 $tag = self::WIDGET_ID_TAG_START . $widgetId . self::WIDGET_ID_SEPARATOR . $index . self::WIDGET_ID_TAG_END;
1930 $destBuf = str_replace($tag, $srcContents, $destBuf);
1933 if (!empty($newTitle)) $title = $newTitle;
1934 $tag = self::WIDGET_ID_TITLE_TAG_START . $widgetId . self::WIDGET_ID_SEPARATOR . $index . self::WIDGET_ID_TITLE_TAG_END;
1935 $destBuf = str_replace($tag, $title, $destBuf);
1939 $destBuf = $this->replaceHead($destBuf);
1945 * @param string $srcBuf 変換元
1946 * @return string 変換後文字列
1948 function replaceHead($srcBuf)
1952 // ##### ヘッダ部分の置換 #####
1953 if ($this->outputHead){ // HTMLヘッダ出力を行っているとき
1955 $replaceStr = $this->getHeaderOutput();
1958 $destBuf = str_replace(self::HEAD_TAGS, $replaceStr, $destBuf);
1960 $this->replaceHeadDone = true; // ヘッダマクロ変換処理が完了したかどうか
1964 * ウィジェット検索モードの場合のページサブIDの設定
1966 * @param RequestManager $request HTTPリクエスト処理クラス
1968 function redirectToUpdatedPageSubId($request)
1970 global $gEnvManager;
1972 // 現在設定されているページIDを取得
1973 $pageId = $gEnvManager->getCurrentPageId();
1974 $pageSubId = $gEnvManager->getCurrentPageSubId();
1977 $fromWidgetId = $request->trimValueOf(M3_REQUEST_PARAM_FROM);
1980 $targetWidgetId = $request->trimValueOf(M3_REQUEST_PARAM_WIDGET_ID);
1982 // 対象のウィジェットのページサブIDを取得
1983 $ret = $this->db->getSubPageId($targetWidgetId, $pageId, $rows);
1984 if ($ret){// データが存在する
1985 if (empty($rows[0]['pd_sub_id'])){ // 共通ウィジェットのときは、送信元にあわせる
1986 $ret = $this->db->getSubPageId($fromWidgetId, $pageId, $rows2);
1987 if ($ret){// データが存在する
1988 if (empty($rows2[0]['pd_sub_id'])){ // 送信元が共通ウィジェットのときは、既に設定されているページサブIDを使用
1990 $gEnvManager->setCurrentPageSubId($rows2[0]['pd_sub_id']);
1995 for ($i = 0; $i < count($rows); $i++){
1996 $ret = $this->db->isExistsWidgetOnPage($pageId, $rows[$i]['pd_sub_id'], $fromWidgetId);
2001 if ($i == count($rows)){ // 送信元が見つからない場合は1番目のページサブIDを使用
2002 $gEnvManager->setCurrentPageSubId($rows[0]['pd_sub_id']);
2004 $gEnvManager->setCurrentPageSubId($rows[$i]['pd_sub_id']);// 存在するときは見つかったページサブIDで更新
2007 } else { // 対象のウィジェットが見つからない場合は、互換ウィジェットを探す
2008 $widgetId = $this->db->getCompatibleWidgetId($targetWidgetId);
2009 if (!empty($widgetId)){
2010 $targetWidgetId = $widgetId;
2012 // 対象のウィジェットのページサブIDを取得
2013 $ret = $this->db->getSubPageId($targetWidgetId, $pageId, $rows);
2014 if ($ret){// データが存在する
2015 if (empty($rows[0]['pd_sub_id'])){ // 共通ウィジェットのときは、送信元にあわせる
2016 $ret = $this->db->getSubPageId($fromWidgetId, $pageId, $rows2);
2017 if ($ret){// データが存在する
2018 if (empty($rows2[0]['pd_sub_id'])){ // 送信元が共通ウィジェットのときは、既に設定されているページサブIDを使用
2020 $gEnvManager->setCurrentPageSubId($rows2[0]['pd_sub_id']);
2025 for ($i = 0; $i < count($rows); $i++){
2026 $ret = $this->db->isExistsWidgetOnPage($pageId, $rows[$i]['pd_sub_id'], $fromWidgetId);
2031 if ($i == count($rows)){ // 送信元が見つからない場合は1番目のページサブIDを使用
2032 $gEnvManager->setCurrentPageSubId($rows[0]['pd_sub_id']);
2034 $gEnvManager->setCurrentPageSubId($rows[$i]['pd_sub_id']);// 存在するときは見つかったページサブIDで更新
2040 // ページサブIDが見つからないときは、既に設定されている値を使用
2041 // 既に設定されている値は、URL「sub」パラメータで指定されている値か
2042 // 設定されていない場合はデフォルトのサブページID
2043 // ********** 指定ページへリダイレクト ***********
2045 $todo = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TODO);
2046 $todo = str_replace(M3_TODO_SEPARATOR, '&', $todo); // セパレータを変換
2047 $redirectUrl = '?' . M3_REQUEST_PARAM_PAGE_SUB_ID . '=' . $gEnvManager->getCurrentPageSubId();
2048 if (!empty($todo)) $redirectUrl .= '&' . $todo;
2049 if ($gEnvManager->getIsMobileSite()){ // 携帯用アクセスポイントの場合
2050 $this->redirect($redirectUrl, true/*遷移時のダイアログ表示を抑止*/);
2052 $this->redirect($redirectUrl);
2058 * テンプレートの出力が完了した後、HTMLとして出力する最後の出力を行う
2059 * 追加するHTMLは主にウィンドウ管理用のスクリプト
2061 * @param RequestManager $request HTTPリクエスト処理クラス
2062 * @return string 最終HTML
2064 function getLastContents($request)
2066 global $gEnvManager;
2069 $initScript = ''; // 初期化用スクリプト
2070 $pageId = $gEnvManager->getCurrentPageId();
2071 $pageSubId = $gEnvManager->getCurrentPageSubId();
2072 $cmd = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
2075 if ($cmd == M3_REQUEST_CMD_RSS) return '';
2077 if ($gEnvManager->getIsMobileSite()){ // 携帯用URLのとき
2078 } else { // PC用URLのとき
2079 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
2080 //if ($gEnvManager->isSystemAdmin()){ // 管理者権限がある場合のみ有効
2081 if ($gEnvManager->isSystemManageUser()){ // システム運用権限がある場合のみ有効
2083 if ($cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // ウィジェット付きポジション表示
2084 //$contents .= '<div class="clear"></div>' . M3_NL;
2086 $contents .= '<div id="m3_overlay">' . M3_NL; // ロード中表示
2087 $contents .= '<div id="preloader"><img src="' . $gEnvManager->getImagesUrl() . '/system/loader.gif" alt="" /></div>' . M3_NL;
2088 $contents .= '</div>' . M3_NL;*/
2091 if (count($this->viewPosId) > 0){
2093 for ($i = 0; $i < count($this->viewPosId); $i++){
2094 $posArrayStr .= '\'#' . $this->viewPosId[$i] . '\'';
2095 //$posArrayStr .= '\'' . $this->viewPosId[$i] . '\'';
2096 if ($i < count($this->viewPosId) - 1) $posArrayStr .= ',';
2098 $posArrayStr .= ']';
2099 $contents .= 'var M3_POSITIONS=' . $posArrayStr . ';' . M3_NL;
2102 $contents .= 'var M3_REVISION=' . $this->pageDefRev . ';' . M3_NL;
2105 $contents .= 'function m3UpdateByConfig(serial){' . M3_NL;
2106 $contents .= M3_INDENT_SPACE . 'window.m3.m3UpdateByConfig(serial);' . M3_NL;
2107 $contents .= '}' . M3_NL;
2109 // 携帯用テンプレートのときは、プレビューウィンドウの更新を通知する
2110 /*if ($gEnvManager->getCurrentTemplateType() == 1){
2111 $contents .= 'if (window.parent.m3UpdateByChildWindow) window.parent.m3UpdateByChildWindow();' . M3_NL;
2113 } else if ($cmd == M3_REQUEST_CMD_CONFIG_WIDGET){ // ウィジェット設定画面
2115 $contents .= 'function m3UpdateByConfig(serial){' . M3_NL;
2116 $contents .= M3_INDENT_SPACE . 'var href = window.location.href.split("#");' . M3_NL;
2117 $contents .= M3_INDENT_SPACE . 'window.location.href = href[0];' . M3_NL;
2118 $contents .= M3_INDENT_SPACE . 'm3UpdateParentWindow();' . M3_NL; // 親ウィンドウ更新
2119 $contents .= '}' . M3_NL;
2122 $contents .= 'function hideIEErrors(){' . M3_NL;
2123 $contents .= M3_INDENT_SPACE . 'return true;' . M3_NL;
2124 $contents .= '}' . M3_NL;
2125 $contents .= 'window.onerror = hideIEErrors;' . M3_NL;
2126 } else { // ダッシュボード画面、メイン管理画面
2128 $contents .= 'function m3UpdateByConfig(serial){' . M3_NL;
2129 $contents .= M3_INDENT_SPACE . 'var href = window.location.href.split("#");' . M3_NL;
2130 $contents .= M3_INDENT_SPACE . 'window.location.href = href[0];' . M3_NL;
2131 $contents .= '}' . M3_NL;
2134 // ウィジェット単体実行以外のときの処理
2135 if (!$this->showWidget){
2136 if ($this->updateParentWindow){ // 管理画面からの親画面の更新
2137 $initScript .= M3_INDENT_SPACE . 'm3UpdateParentWindowByConfig(' . $this->updateDefSerial . ');' . M3_NL;// 更新する項目のページ定義シリアル番号
2141 // ##### ヘルプシステムの組み込み #####
2142 // ヘルプシステムはすべての初期処理完了後に実行する
2143 // ヘルプシステムは、「span」タグで埋め込み、「title」属性を使用する
2144 if ($this->useHelp){ // ヘルプ表示のとき
2145 $initScript .= M3_INDENT_SPACE . '$(\'span.m3help\').cluetip({splitTitle: \'|\', cluezIndex: 2000});' . M3_NL;
2146 //if ($cmd != M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // ウィジェット付きポジション表示以外のとき
2147 $initScript .= M3_INDENT_SPACE . 'if (jQuery().tooltip) $(\'[rel=m3help]\').tooltip({ placement: \'top\'});' . M3_NL; // Bootstrapツールチップ。タイトルのみ表示。
2149 } else { // ヘルプ非表示のときは、title属性をクリアする
2150 $initScript .= M3_INDENT_SPACE . '$(\'span.m3help\').attr(\'title\', \'\');' . M3_NL;
2154 if ($gEnvManager->isSystemManageUser()){ // システム運用権限がある場合のみ有効
2156 $contents .= 'function m3UpdateByConfig(serial){' . M3_NL;
2157 $contents .= M3_INDENT_SPACE . 'var href = window.location.href.split("#");' . M3_NL;
2158 $contents .= M3_INDENT_SPACE . 'window.location.href = href[0];' . M3_NL;
2159 $contents .= '}' . M3_NL;
2164 if (!empty($contents) || !empty($initScript)){
2165 $destContents .= '<script type="text/javascript">' . M3_NL;
2166 $destContents .= '//<![CDATA[' . M3_NL;
2167 $destContents .= $contents;
2168 if (!empty($initScript)){ // 初期化用スクリプト
2169 $destContents .= '$(function(){' . M3_NL;
2170 $destContents .= $initScript;
2171 $destContents .= '});' . M3_NL;
2173 $destContents .= '//]]>' . M3_NL;
2174 $destContents .= '</script>' . M3_NL;
2176 return $destContents;
2181 * テンプレートの出力が完了した後、HTMLとして出力する最後の出力を行う
2183 * @param RequestManager $request HTTPリクエスト処理クラス
2184 * @return string 最終HTML
2186 function getOptionContents($request)
2188 global $gEnvManager;
2193 if (!$gEnvManager->isMobile() && $this->outputByHtml){ // 携帯以外で、HTML出力のとき
2194 $contents .= '<!-- created by ' . M3_SYSTEM_NAME . ' v' . M3_SYSTEM_VERSION . ' - http://www.magic3.org -->' . M3_NL;
2195 $contents .= '<!-- convert time: ' . sprintf('%01.03f', microtime(true) - M3_MTIME) . ' -->' . M3_NL;
2200 * Widget単体起動用のHTMLのヘッダ部(headタグ)出力
2202 * Widgetの出力方法は、以下のパターンがある
2203 * ・HTMLヘッダ付加 - Widget単体で画面出力するためにHTMLヘッダを付加するパターン
2204 * ・HTMLヘッダなし - Wiget単体のタグ出力のみのパターン
2206 * @param string $cmd 起動コマンド
2208 function startWidget($cmd)
2210 global $gEnvManager;
2211 global $gRequestManager;
2213 // ウィジェット単体表示のときのみ出力
2214 if (!$this->showWidget) return;
2217 $openBy = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPEN_BY); // ウィンドウオープンタイプ
2218 $task = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
2220 // $isHtml5 = false; // HTML5で出力するかどうか
2221 $tempVer = $gEnvManager->getCurrentTemplateType(); // テンプレートタイプを取得(0=デフォルト(Joomla!v1.0),1=Joomla!v1.5,2=Joomla!v2.5)
2222 if (intval($tempVer) >= 2) $this->isHtml5 = true; // HTML5で出力するかどうか
2225 if ($this->isHtml5){
2226 echo '<!DOCTYPE html>' . M3_NL;
2227 echo '<html dir="ltr" lang="' . $gEnvManager->getCurrentLanguage() . '">' . M3_NL;
2228 echo '<head>' . M3_NL;
2230 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . M3_NL;
2231 echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $gEnvManager->getCurrentLanguage() . '" lang="' . $gEnvManager->getCurrentLanguage() . '">' . M3_NL;
2232 echo '<head>' . M3_NL;
2233 // echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' . M3_NL;
2236 // HTMLのヘッダ部(headタグ内)出力
2240 $widgetId = $gEnvManager->getCurrentWidgetId(); // カレントのウィジェットID
2243 if ($gEnvManager->getUseSslAdmin()){
2244 $rootUrl = $gEnvManager->getSslRootUrl();
2245 $templatesUrl = $gEnvManager->getSslTemplatesUrl(); // テンプレート読み込み用パス
2246 $widgetsUrl = $gEnvManager->getSslWidgetsUrl(); // ウィジェット格納パス
2248 $rootUrl = $gEnvManager->getRootUrl();
2249 $templatesUrl = $gEnvManager->getTemplatesUrl(); // テンプレート読み込み用パス
2250 $widgetsUrl = $gEnvManager->getWidgetsUrl(); // ウィジェット格納パス
2253 // ##### テンプレートのCSSの読み込み #####
2254 // テンプレートは管理用テンプレートに固定されている
2255 if ($cmd == M3_REQUEST_CMD_CONFIG_WIDGET){ // ウィジェット設定のとき
2256 $curTemplateUrl = $templatesUrl . '/' . $gEnvManager->getCurrentTemplateId();
2257 if ($this->isHtml5){
2258 echo '<link rel="stylesheet" href="' . $curTemplateUrl . '/css/style.css" media="screen">' . M3_NL;
2259 echo '<link rel="stylesheet" href="' . $curTemplateUrl . '/css/widget.css" media="screen">' . M3_NL; // ウィジェット設定画面用CSS
2260 echo '<!--[if IE]><link rel="stylesheet" href="' . $curTemplateUrl . '/css/iestyles.css" media="screen"><![endif]-->' . M3_NL;
2261 echo '<!--[if lt IE 9]><script src="' . $curTemplateUrl . '/html5shiv.js"></script><![endif]-->' . M3_NL;
2263 echo '<link href="' . $curTemplateUrl . '/css/style.css" rel="stylesheet" type="text/css" />' . M3_NL;
2264 echo '<!--[if IE]><link rel="stylesheet" type="text/css" media="screen" href="' . $curTemplateUrl . '/css/iestyles.css" /><![endif]-->' . M3_NL;
2268 $ret = $this->db->getWidgetInfo($widgetId, $row);
2270 // ##### 共通ライブラリ読み込み設定 #####
2271 if ($cmd == M3_REQUEST_CMD_DO_WIDGET){ // ウィジェット単体実行のとき
2272 $scritLib = trim($row['wd_add_script_lib']);
2273 if (!empty($scritLib)) $this->addScript($task, $scritLib);
2276 // CSS読み込みが指定されていて、ディレクトリがあるときはディレクトリ内読み込み
2277 if ($row['wd_read_css']){
2278 $searchPath = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/' . M3_DIR_NAME_CSS;
2279 if (is_dir($searchPath)){
2280 $dir = dir($searchPath);
2281 while (($file = $dir->read()) !== false){
2282 $filePath = $searchPath . '/' . $file;
2283 if ($file != '.' && $file != '..' && is_file($filePath)
2284 && strncmp($file, '_', 1) != 0){ // 「_」で始まる名前のファイルは読み込まない
2287 $cssURL = $widgetsUrl . '/' . $widgetId . '/' . M3_DIR_NAME_CSS . '/' . $file;
2288 echo '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2295 // スクリプト読み込みが指定されていて、ディレクトリがあるときはディレクトリ内読み込み
2296 if ($row['wd_read_scripts']){
2297 $searchPath = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/' . M3_DIR_NAME_SCRIPTS;
2298 if (is_dir($searchPath)){
2299 $dir = dir($searchPath);
2300 while (($file = $dir->read()) !== false){
2301 $filePath = $searchPath . '/' . $file;
2302 if ($file != '.' && $file != '..' && is_file($filePath)
2303 && strncmp($file, '_', 1) != 0){ // 「_」で始まる名前のファイルは読み込まない
2306 $scriptURL = $widgetsUrl . '/' . $widgetId . '/' . M3_DIR_NAME_SCRIPTS . '/' . $file;
2308 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
2309 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();
2310 echo '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
2318 $title = $row['wd_name'];
2319 if (empty($title)) $title = $row['wd_id'];
2320 echo '<title>' . self::WIDGET_TITLE_START . htmlspecialchars($title) . self::WIDGET_TITLE_END . '</title>' . M3_NL;
2321 echo '</head>' . M3_NL;
2322 // タブでウィンドウを開く場合は背景を透過モードにする
2323 if ($this->isTransparentMode){
2324 echo '<body style="background-color:transparent;">' . M3_NL;
2326 echo '<body>' . M3_NL;
2329 if ($this->useBootstrap) echo '<div class="container">' . M3_NL;
2331 // 別ウィンドウで表示のときは、「閉じる」ボタンを表示
2332 if ($cmd == M3_REQUEST_CMD_SHOW_WIDGET || // ウィジェットの単体表示のとき
2333 $cmd == M3_REQUEST_CMD_CONFIG_WIDGET || // ウィジェット詳細設定画面のとき
2334 $cmd == M3_REQUEST_CMD_DO_WIDGET){ // ウィジェット単体実行のとき
2336 if ($this->isEditMode){// 一般画面編集モードのとき
2337 if (!empty($openBy)){
2338 // サーバ指定されている場合はサーバ情報を取得
2340 $server = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_SERVER);
2341 if (!empty($server)){
2343 $ret = $this->db->getServerById($server, $row);
2345 $serverName = 'サーバ名:' . $row['ts_name'];// サーバ名
2346 echo '<div align="left" style="float:left;padding-left:30px;"><label>' . convertToHtmlEntity($serverName) . '</label></div>';
2349 // タブ形式以外のときは「閉じる」ボタンを表示
2350 if ($openBy != 'tabs'){
2351 if ($openBy == 'logout'){
2352 $titleStr = 'ログアウト';
2353 echo '<div class="m3configclose"><a href="#" onclick="location.href=\'?cmd=logout\';"><img src="' . $rootUrl . self::CLOSE_ICON_FILE .
2354 '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></div>' . M3_NL;
2357 echo '<div class="m3configclose"><a href="#" onclick="window.close();"><img src="' . $rootUrl . self::CLOSE_ICON_FILE .
2358 '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></div>' . M3_NL;
2364 echo '<div class="m3configprev" style="display:none;"><a id="m3configprev" href="#"><img src="' . $rootUrl . self::PREV_ICON_FILE .
2365 '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></div>' . M3_NL;
2367 echo '<div class="m3confignext" style="display:none;"><a id="m3confignext" href="#"><img src="' . $rootUrl . self::NEXT_ICON_FILE .
2368 '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></div>' . M3_NL;
2371 echo '<!-- Widget Start -->' . M3_NL;
2374 * Widget単体起動用のタグを閉じる
2376 * @param string $cmd 起動コマンド
2378 function endWidget($cmd)
2380 // ウィジェット単体表示のときのみ出力
2381 if (!$this->showWidget) return;
2383 echo '<!-- Widget End -->' . M3_NL;
2385 // ##### ウィジェットからの指定による処理 #####
2386 if ($this->updateParentWindow){ // 親ウィンドウ再描画のとき
2387 echo '<script type="text/javascript">' . M3_NL;
2388 echo '//<![CDATA[' . M3_NL;
2389 echo '$(function(){' . M3_NL;
2390 if ($cmd == M3_REQUEST_CMD_CONFIG_WIDGET){ // ウィジェット詳細設定画面のとき
2391 echo str_repeat(M3_INDENT_SPACE, 1) . 'm3UpdateParentWindowByConfig(' . $this->updateDefSerial . ');' . M3_NL;// 更新する項目のページ定義シリアル番号
2392 } else if ($cmd == M3_REQUEST_CMD_DO_WIDGET){ // ウィジェット単体実行のとき
2393 echo str_repeat(M3_INDENT_SPACE, 1) . 'm3UpdateParentWindow();' . M3_NL;
2396 echo '//]]>' . M3_NL;
2397 echo '</script>' . M3_NL;
2401 if ($this->useBootstrap) echo '</div>' . M3_NL;
2403 echo '</body>' . M3_NL;
2404 echo '</html>' . M3_NL;
2407 * Widget単体RSS出力用のHTMLのヘッダ部(headタグ)出力
2409 * Widgetの出力方法は、以下のパターンがある
2410 * ・HTMLヘッダ付加 - Widget単体で画面出力するためにHTMLヘッダを付加するパターン
2411 * ・HTMLヘッダなし - Wiget単体のタグ出力のみのパターン
2413 * @param string $cmd 起動コマンド
2415 function startWidgetRss($cmd)
2419 * Widget単体RSS出力用のタグを閉じる
2421 * @param string $cmd 起動コマンド
2422 * @param string $rssContent RSS配信内容
2424 function endWidgetRss($cmd, $rssContent)
2426 global $gEnvManager;
2429 if ($this->isAbort) return;
2431 echo '<?xml version="1.0" encoding="' . M3_HTML_CHARSET . '" ?>' . M3_NL;
2434 $lang = $gEnvManager->getCurrentLanguage();
2435 $date = getW3CDate(); // RSS1.0用日付
2436 $copyright = $gEnvManager->getSiteCopyRight(); // 著作権
2437 $title = $this->rssChannel['title']; // タイトル
2438 $link = $this->rssChannel['link']; // RSS取得用URL
2439 $desc = $this->rssChannel['description']; // 説明
2440 $seq = $this->rssChannel['seq']; // 項目の並び順(URL)
2442 switch ($this->rssVersion){ // RSSバージョン
2445 echo '<rdf:RDF xmlns="http://purl.org/rss/1.0/" ';
2446 echo 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ';
2447 echo 'xmlns:dc="http://purl.org/dc/elements/1.1/" ';
2448 echo 'xml:lang="' . $lang . '">' . M3_NL;
2449 echo '<channel rdf:about="' . convertUrlToHtmlEntity($link) . '">' . M3_NL;
2450 echo '<title>' . convertToHtmlEntity($title) . '</title>' . M3_NL;
2451 echo '<link>' . convertUrlToHtmlEntity($link) . '</link>' . M3_NL; // 「convertUrlToHtmlEntity」が必要
2452 echo '<description>' . convertToHtmlEntity($desc) . '</description>' . M3_NL;
2453 echo '<dc:language>' . $lang . '</dc:language>' . M3_NL;
2454 if (!empty($copyright)) echo '<dc:rights>' . convertToHtmlEntity($copyright) . '</dc:rights>' . M3_NL;
2455 echo '<dc:date>' . $date . '</dc:date>' . M3_NL;
2456 echo '<items>' . M3_NL;
2457 if (count($seq) > 0){
2458 echo str_repeat(M3_INDENT_SPACE, 1) . '<rdf:Seq>' . M3_NL;
2459 for ($i = 0; $i < count($seq); $i++){
2460 echo str_repeat(M3_INDENT_SPACE, 2) . '<rdf:li rdf:resource="' . convertUrlToHtmlEntity($seq[$i]) . '" />' . M3_NL;
2462 echo str_repeat(M3_INDENT_SPACE, 1) . '</rdf:Seq>' . M3_NL;
2464 echo '</items>' . M3_NL;
2465 echo '</channel>' . M3_NL;
2467 echo '</rdf:RDF>' . M3_NL;
2474 header("Content-type: text/xml; charset=utf-8");
2477 * 直サーバ接続時のXML出力用のHTMLのヘッダ部(headタグ)出力
2479 * @param string $cmd 起動コマンド
2482 function startWidgetXml($cmd)
2485 //header("Content-type: text/xml; charset=utf-8");
2490 * @param string $cmd 起動コマンド
2493 function endWidgetXml()
2499 * @return string ドキュメントタイプ出力
2501 function getMobileDocType()
2503 global $gEnvManager;
2504 global $gInstanceManager;
2505 global $gRequestManager;
2507 $docTypeStr = ''; // 出力するDocType
2508 $agent = $gInstanceManager->getMobileAgent();
2509 if ($agent->isDoCoMo()){ // ドコモ端末のとき
2510 $htmlVer = $agent->getHTMLVersion();
2513 $docTypeStr = '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.0) 1.0//EN" "i-xhtml_4ja_10.dtd">';
2516 $docTypeStr = '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.1) 1.0//EN" "i-xhtml_4ja_10.dtd">';
2519 $docTypeStr = '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.0) 1.0//EN" "i-xhtml_4ja_10.dtd">';
2522 $docTypeStr = '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.1) 1.0//EN" "i-xhtml_4ja_10.dtd">';
2525 $docTypeStr = '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.2) 1.0//EN" "i-xhtml_4ja_10.dtd">';
2528 $docTypeStr = '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.3) 1.0//EN" "i-xhtml_4ja_10.dtd">';
2531 if (preg_match("/^DoCoMo\/1\.0/i", $gRequestManager->trimServerValueOf('HTTP_USER_AGENT'))){ // mova端末のとき
2532 // mova端末のときはドキュメントタイプなしにすると画面表示可能
2537 } else if ($agent->isEZweb()){ // au端末のとき
2538 if ($agent->isWAP2()){
2539 $docTypeStr = '<!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML 1.0//EN" "http://www.openwave.com/DTD/xhtml-basic.dtd">';
2541 } else if ($agent->isSoftBank()){ // ソフトバンク端末のとき
2542 if ($agent->isTypeW() || $agent->isType3GC()){
2543 $docTypeStr = '<!DOCTYPE html PUBLIC "-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN" "xhtml-basic10-plus.dtd">';
2546 if ($gEnvManager->getIsMobileSite()){ // 携帯用サイトへのアクセスの場合
2547 echo '<?xml version="1.0" encoding="' . $gEnvManager->getMobileCharset() . '" ?>' . M3_NL;
2549 echo '<?xml version="1.0" encoding="' . M3_HTML_CHARSET . '" ?>' . M3_NL;
2551 if (empty($docTypeStr)) $docTypeStr = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
2552 echo $docTypeStr . M3_NL;
2557 * @return string XML宣言
2559 function getDefaultXmlDeclaration()
2561 return '<?xml version="1.0" encoding="' . M3_HTML_CHARSET . '" ?>';
2564 * HTMLのヘッダ部(headタグ内)出力
2566 * システムに共通な定義をHTMLのheadタグ内に出力する
2567 * mosFunc.phpからも実行されるので、このメソッドは引数なしに固定。
2568 * この関数は、以下の「形式1」または「形式2」でheadタグ内に記述する
2570 * 形式1: <!-- m3:HTMLHeader -->
2571 * 形式2(old style): <?php mosShowHead(); ?>
2573 function getHeader()
2575 global $gEnvManager;
2576 global $gRequestManager;
2578 $this->outputHead = true; // HTMLヘッダ出力を行ったかどうか
2581 $cmd = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
2583 // ######### 携帯用サイトの場合は別にヘッダを作成する #########
2584 if ($gEnvManager->getIsMobileSite()){
2586 echo '<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=' . $gEnvManager->getMobileCharset() . '" />' . M3_NL;
2589 echo '<meta http-equiv="Pragma" content="no-cache" />' . M3_NL;
2590 echo '<meta http-equiv="Cache-Control" content="no-cache" />' . M3_NL;
2591 echo '<meta http-equiv="Expires" content="-1" />' . M3_NL;
2594 echo '<meta name="generator" content="' . M3_SYSTEM_NAME . ' ver.' . M3_SYSTEM_VERSION . ' - ' . M3_SYSTEM_DESCRIPTION . '" />' . M3_NL;
2595 } else { // PC用サイト、管理用サイト、スマートフォン用サイトのとき
2596 // $isHtml5 = false; // HTML5で出力するかどうか
2597 if ($gEnvManager->getIsSmartphoneSite()){ // スマートフォン用サイトのときはHTML5で設定
2598 $this->isHtml5 = true;
2600 $tempVer = $gEnvManager->getCurrentTemplateType(); // テンプレートタイプを取得(0=デフォルト(Joomla!v1.0),1=Joomla!v1.5,2=Joomla!v2.5)
2601 if (intval($tempVer) >= 2) $this->isHtml5 = true;
2604 // ********** メタタグの設定 **********
2607 //if ($gEnvManager->getIsSmartphoneSite()){ // スマートフォン用サイトのときはHTML5で設定
2608 if ($this->isHtml5){
2609 //echo '<meta http-equiv="content-type" content="text/html; charset=' . M3_HTML_CHARSET .'" />' . M3_NL;
2610 echo '<meta charset="' . M3_HTML_CHARSET . '">' . M3_NL;
2612 echo '<meta http-equiv="content-script-type" content="text/javascript" />' . M3_NL;
2613 echo '<meta http-equiv="content-style-type" content="text/css" />' . M3_NL;
2614 echo '<meta http-equiv="content-type" content="application/xhtml+xml; charset=' . M3_HTML_CHARSET .'" />' . M3_NL;
2618 if ($cmd == M3_REQUEST_CMD_SHOW_POSITION || // 表示位置を表示するとき
2619 $cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // 表示位置を表示するとき(ウィジェット付き)
2621 if ($gEnvManager->getUseSslAdmin()){
2622 $rootUrl = $gEnvManager->getSslRootUrl();
2624 $rootUrl = $gEnvManager->getRootUrl();
2626 echo '<base href="' . $rootUrl . '/" />' . M3_NL;
2629 echo self::HEAD_TAGS; // HTMLヘッダの埋め込みデータ
2634 * @return string HTMLヘッダ出力文字列
2636 function getHeaderOutput()
2638 global $gEnvManager;
2639 global $gRequestManager;
2640 global $gInstanceManager;
2641 global $gSystemManager;
2643 $replaceStr = ''; // 変換文字列
2645 // ********************************************************
2647 // ********************************************************
2648 // ##### テンプレートの設定、フレームの設定から必要なライブラリを取得 #####
2650 // if (!$this->useBootstrap) $this->useBootstrap = $gEnvManager->getCurrentTemplateUseBootstrap();
2651 if ($this->useBootstrap){
2652 if ($gEnvManager->isAdminDirAccess()){
2653 if ($gEnvManager->isSystemManageUser()){ // システム運用権限がある場合のみ有効(ログイン中の場合)
2654 $this->addAdminScript('', ScriptLibInfo::LIB_BOOTSTRAP); // 管理画面でBootstrapを使用するかどうか
2655 $this->addAdminScript('', ScriptLibInfo::LIB_BOOTSTRAP_ADMIN); // Bootstrap管理画面オプション
2656 } else { // ログインしていない場合(ログイン画面等)
2657 $this->addDefaultAdminScript(ScriptLibInfo::LIB_BOOTSTRAP);
2658 $this->addDefaultAdminScript(ScriptLibInfo::LIB_BOOTSTRAP_ADMIN);// Bootstrap管理画面オプション
2661 $this->addScript('', ScriptLibInfo::LIB_BOOTSTRAP); // 一般画面でBootstrapを使用するかどうか
2665 // ********************************************************
2667 // ********************************************************
2668 // ##### インストール時のヘッダ出力 #####
2669 if (defined('M3_STATE_IN_INSTALL')){
2672 if (count($this->headSubTitle) > 0) $title = htmlspecialchars(trim($this->headSubTitle[0]));
2674 // ********** メタタグの設定 **********
2675 $replaceStr .= '<title>' . $title . '</title>' . M3_NL;
2677 // ##### インストーラ用のファイルの読み込み #####
2678 $scriptsUrl = '../scripts';
2680 // 管理機能用共通ライブラリのCSSの読み込み
2681 $count = count($this->defaultAdminCssFiles);
2682 for ($i = 0; $i < $count; $i++){
2684 $cssFilename = $this->defaultAdminCssFiles[$i];
2685 if (strncasecmp($cssFilename, 'http://', 7) == 0 || strncasecmp($cssFilename, 'https://', 8) == 0){
2686 $cssURL = $cssFilename;
2688 $cssURL = $scriptsUrl . '/' . $cssFilename;
2690 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2693 // 管理画面用の共通スクリプトを読み込む
2694 $count = count($this->defaultAdminScriptFiles);
2695 for ($i = 0; $i < $count; $i++){
2696 $scriptFilename = $this->defaultAdminScriptFiles[$i];
2699 if (strncasecmp($scriptFilename, 'http://', 7) == 0 || strncasecmp($scriptFilename, 'https://', 8) == 0){
2700 $scriptURL = $scriptFilename;
2704 $scriptURL = str_replace('http://', 'https://', $scriptURL);
2706 $scriptURL = str_replace('https://', 'http://', $scriptURL);
2709 $scriptURL = $scriptsUrl . '/' . $scriptFilename;
2712 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
2713 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();
2714 $replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
2720 $cmd = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
2721 $task = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
2724 $cleanType = $gEnvManager->getCurrentTemplateCleanType(); // テンプレートクリーンタイプ
2725 /* if ($this->db->getTemplate($gEnvManager->getCurrentTemplateId(), $templateRow)){
2726 $cleanType = $templateRow['tm_clean_type'];
2731 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
2733 if ($gEnvManager->getUseSslAdmin()) $isSslPage = true; // 管理画面でSSLを使用するとき
2735 $isSslPage = $this->isSslPage($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId());
2738 $rootUrl = $gEnvManager->getSslRootUrl();
2739 $scriptsUrl = $gEnvManager->getSslScriptsUrl(); // スクリプト読み込み用パス
2740 $widgetsUrl = $gEnvManager->getSslWidgetsUrl(); // ウィジェット格納パス
2741 $templatesUrl = $gEnvManager->getSslTemplatesUrl(); // テンプレート読み込み用パス
2743 $rootUrl = $gEnvManager->getRootUrl();
2744 $scriptsUrl = $gEnvManager->getScriptsUrl(); // スクリプト読み込み用パス
2745 $widgetsUrl = $gEnvManager->getWidgetsUrl(); // ウィジェット格納パス
2746 $templatesUrl = $gEnvManager->getTemplatesUrl(); // テンプレート読み込み用パス
2750 if (!$this->showWidget){// 単体実行以外のとき
2751 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスの場合
2753 // メイン画面は「サイト名 - 管理画面」、サブ画面は個別画面名
2754 $siteName = $gEnvManager->getSiteName();
2755 // if (empty($siteName)) $siteName = self::DEFAULT_SITE_NAME;
2756 $title = $siteName . ' - ' . self::DEFAULT_ADMIN_TITLE;
2757 $titleCount = count($this->headSubTitle);
2758 if ($titleCount > 0) $title = $this->headSubTitle[$titleCount -1]; // サブタイトルが設定されている場合は変更
2759 $replaceStr .= '<title>' . htmlspecialchars($title) . '</title>' . M3_NL;
2760 } else { // 管理画面以外の画面へのアクセスの場合
2762 $titleItemCount = 0; // タイトル項目数
2763 $defaultTitle = trim($this->gSystem->getSiteDef(M3_TB_FIELD_SITE_TITLE));
2764 if (!empty($defaultTitle)) $titleItemCount++;
2765 if (!empty($this->headSubTitle)){ // サブタイトルが設定されているとき
2766 $titleItemCount += count($this->headSubTitle);
2770 if ($titleItemCount > 0){
2771 $format = $this->gSystem->getSystemConfig(self::CONFIG_KEY_HEAD_TITLE_FORMAT);
2772 if (empty($format)){
2773 $title = htmlspecialchars($defaultTitle);
2775 $formats = explode(';', $format);
2776 $titleItemCount = ($titleItemCount > count($formats)) ? count($formats) : $titleItemCount;
2777 $title = $formats[$titleItemCount -1];
2779 if (!empty($defaultTitle)){
2780 $title = str_replace('$1', htmlspecialchars($defaultTitle), $title);
2783 for ($i = 0; $i < count($this->headSubTitle); $i++){
2784 $key = '$' . $number;
2785 $value = htmlspecialchars(trim($this->headSubTitle[$i]));
2786 $title = str_replace($key, $value, $title);
2791 if (!empty($title)) $replaceStr .= '<title>' . $title . '</title>' . M3_NL;
2794 if (!empty($this->headDescription)) $replaceStr .= '<meta name="description" content="' . htmlspecialchars($this->headDescription) . '" />' . M3_NL;
2797 if (!empty($this->headKeywords)) $replaceStr .= '<meta name="keywords" content="' . htmlspecialchars($this->headKeywords) . '" />' . M3_NL;
2799 // その他HTMLヘッダに出力するタグ文字列
2800 if (!empty($this->headOthers)){
2802 $this->headOthers = $gInstanceManager->getTextConvManager()->convContentMacro($this->headOthers, false/*改行コードをbrタグに変換しない*/, array(), true/*変換後の値はHTMLエスケープ処理する*/);
2803 $replaceStr .= $this->headOthers . M3_NL;
2808 // ##### PC用URLと携帯用URLのアクセス別に処理 #####
2809 if ($gEnvManager->getIsMobileSite()){ // 携帯用URLのとき
2810 } else { // PC用URLまたはスマートフォン用URLのとき
2811 // ##### テンプレート情報に応じた処理 #####
2812 // テンプレートクリーンが必要な場合はJQueryを追加
2813 if ($cleanType != 0) $this->addScriptFile($this->selectedJQueryFilename); // JQueryスクリプト追加
2816 $robots = htmlspecialchars(trim($this->gSystem->getSiteDef(M3_TB_FIELD_SITE_ROBOTS)));
2817 if (!empty($robots)){
2818 $replaceStr .= '<meta name="robots" content="' . $robots . '" />' . M3_NL;
2822 $replaceStr .= '<meta name="generator" content="' . M3_SYSTEM_NAME . ' ver.' . M3_SYSTEM_VERSION . ' - ' . M3_SYSTEM_DESCRIPTION . '" />' . M3_NL;
2825 $templateId = $gEnvManager->getCurrentTemplateId();
2826 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
2827 // テンプレートのFaviconがない場合はシステムのデフォルトのFaviconを使用
2828 $faviconPath = $gEnvManager->getTemplatesPath() . '/' . $templateId . self::DEFAULT_FAVICON_FILE;
2829 if (file_exists($faviconPath)){ // ファイルが存在しているとき
2830 $faviconFile = $templatesUrl . '/' . $templateId . self::DEFAULT_FAVICON_FILE;
2831 $replaceStr .= '<link rel="shortcut icon" href="' . $faviconFile .'" />' . M3_NL;
2834 $faviconPath = $gEnvManager->getSystemRootPath() . self::DEFAULT_ADMIN_FAVICON_FILE;
2835 if (file_exists($faviconPath)){ // ファイルが存在しているとき
2836 $faviconFile = $rootUrl . self::DEFAULT_ADMIN_FAVICON_FILE;
2837 $replaceStr .= '<link rel="shortcut icon" href="' . $faviconFile .'" />' . M3_NL;
2841 $faviconPath = $gEnvManager->getTemplatesPath() . '/' . $templateId . self::DEFAULT_FAVICON_FILE;
2842 if (file_exists($faviconPath)){ // ファイルが存在しているとき
2843 $faviconFile = $templatesUrl . '/' . $templateId . self::DEFAULT_FAVICON_FILE;
2844 $replaceStr .= '<link rel="shortcut icon" href="' . $faviconFile .'" />' . M3_NL;
2847 // ##### 追加ライブラリの読み込み #####
2848 if ($gEnvManager->getIsSmartphoneSite()){ // スマートフォン用URLのとき
2849 $value = $gSystemManager->getSystemConfig(self::CF_SMARTPHONE_USE_JQUERY_MOBILE);// スマートフォン画面で常にjQuery Mobileを使用
2851 // ##### jQueryMobileが読み込まれる前に読み込む必要があるスクリプトを設定 #####
2852 if (!empty($this->headPreMobileScriptFiles)){ // jQueryMobileファイルの前に出力
2853 for ($l = 0; $l < count($this->headPreMobileScriptFiles); $l++){
2854 $this->addScriptFile($this->headPreMobileScriptFiles[$l]); // 通常機能用のスクリプト追加
2857 $this->addScriptFile($this->selectedJQueryMobileFilename);
2861 // ##### Ajaxライブラリの読み込み #####
2862 if (!$gEnvManager->isAdminDirAccess()){ // 通常画面へのアクセスのとき
2863 if ($this->db->isExistsWidgetWithAjax($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId())){// Ajaxライブラリを使用しているウィジェットがあるときは追加
2864 $this->addScriptFile($this->selectedJQueryFilename); // デフォルトAjaxライブラリ追加
2865 $this->addScriptFile(self::M3_OPTION_SCRIPT_FILENAME); // Magic3のオプションライブラリ追加
2869 // ##### 共通ライブラリの読み込み #####
2870 if (!$this->showWidget){// 単体実行以外のとき
2871 $this->db->getWidgetsIdWithLib($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId(), $rows);
2872 for ($i = 0; $i < count($rows); $i++){
2873 $this->addScript($task, trim($rows[$i]['wd_add_script_lib']));
2877 // ##### 共通CSS読み込み #####
2878 if ($this->isEditMode){ // 一般画面編集モード
2879 $cssURL = $scriptsUrl . '/' . self::M3_EDIT_CSS_FILE;
2880 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2882 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
2883 //if ($gEnvManager->isSystemAdmin()){ // 管理者権限がある場合のみ有効
2884 if ($gEnvManager->isSystemManageUser()){ // システム運用権限がある場合のみ有効
2885 // 管理機能用共通ライブラリのCSSの読み込み
2886 $count = count($this->defaultAdminCssFiles);
2887 for ($i = 0; $i < $count; $i++){
2889 //$cssURL = $scriptsUrl . '/' . $this->defaultAdminCssFiles[$i];
2890 $cssFilename = $this->defaultAdminCssFiles[$i];
2891 if (strncasecmp($cssFilename, 'http://', 7) == 0 || strncasecmp($cssFilename, 'https://', 8) == 0){
2892 $cssURL = $cssFilename;
2894 $cssURL = $scriptsUrl . '/' . $cssFilename;
2896 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2899 // 管理権限なしで管理ディレクトリアクセスで必要なCSSファイルを読み込む
2900 $count = count($this->defaultAdminDirCssFiles);
2901 for ($i = 0; $i < $count; $i++){
2903 $cssURL = $scriptsUrl . '/' . $this->defaultAdminDirCssFiles[$i];
2904 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2909 $count = count($this->defaultCssFiles);
2910 for ($i = 0; $i < $count; $i++){
2912 $cssURL = $scriptsUrl . '/' . $this->defaultCssFiles[$i];
2913 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2917 // ##### 表示モードによるCSS読み込み #####
2918 // ウィジェット付きポジション画面は管理画面のアクセスではない
2919 if ($cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // ウィジェット付きポジション表示
2921 $cssURL = $scriptsUrl . self::M3_ADMIN_WIDGET_CSS_FILE;
2922 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2925 // ##### ウィジェットごとのCSS読み込み #####
2927 $this->db->getWidgetsIdWithCss($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId(), $rows);
2928 for ($i = 0; $i < count($rows); $i++){
2929 $searchPath = $gEnvManager->getWidgetsPath() . '/' . $rows[$i]['wd_id'] . '/' . M3_DIR_NAME_CSS;
2930 // ディレクトリがあるときはディレクトリ内読み込み
2931 if (is_dir($searchPath)){
2932 $dir = dir($searchPath);
2933 while (($file = $dir->read()) !== false){
2934 $filePath = $searchPath . '/' . $file;
2935 if ($file != '.' && $file != '..' && is_file($filePath)
2936 && strncmp($file, '_', 1) != 0){ // 「_」で始まる名前のファイルは読み込まない
2939 $cssURL = $widgetsUrl . '/' . $rows[$i]['wd_id'] . '/' . M3_DIR_NAME_CSS . '/' . $file;
2940 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssURL . '" />' . M3_NL;
2946 // ウィジェットからの追加のCSS読み込み
2947 $count = count($this->headCssFiles);
2948 for ($i = 0; $i < $count; $i++){
2949 $cssUrl = $this->headCssFiles[$i];
2950 if ($isSslPage) $cssUrl = str_replace('http://', 'https://', $cssUrl); // SSL化が必要なときは変換
2951 $replaceStr .= '<link rel="stylesheet" type="text/css" href="' . $cssUrl . '" />' . M3_NL;
2954 // ##### RSS配信情報の読み込み #####
2955 $count = count($this->headRssFiles);
2956 for ($i = 0; $i < $count; $i++){
2957 $rssUrl = $this->headRssFiles[$i]['href'];// リンク先URL
2958 $rssTitle = $this->headRssFiles[$i]['title'];// タイトル
2959 $replaceStr .= '<link rel="alternate" type="application/rss+xml" title="' . $rssTitle . '" href="' . convertUrlToHtmlEntity($rssUrl) . '" />' . M3_NL;
2962 // ##### 共通Javascriptの読み込み #####
2963 if ($gEnvManager->isAdminDirAccess()){ // 管理画面へのアクセスのとき
2964 if ($gEnvManager->isSystemManageUser()){ // システム運用権限がある場合のみ有効
2965 // 管理画面用の共通スクリプトを読み込む
2966 $count = count($this->defaultAdminScriptFiles);
2967 for ($i = 0; $i < $count; $i++){
2968 $scriptFilename = $this->defaultAdminScriptFiles[$i];
2971 if (strncasecmp($scriptFilename, 'http://', 7) == 0 || strncasecmp($scriptFilename, 'https://', 8) == 0){
2972 $scriptURL = $scriptFilename;
2976 $scriptURL = str_replace('http://', 'https://', $scriptURL);
2978 $scriptURL = str_replace('https://', 'http://', $scriptURL);
2981 $scriptURL = $scriptsUrl . '/' . $scriptFilename;
2984 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
2985 //$scriptURL = $scriptsUrl . '/' . $scriptFilename;
2986 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();
2987 $replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
2989 if ($cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // ウィジェット付きポジション表示のときは、ウィジェット操作ライブラリを読み込む
2991 $scriptURL = $scriptsUrl . '/' . self::M3_ADMIN_WIDGET_SCRIPT_FILENAME;
2992 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();// スクリプトをキャッシュ保存しない場合は、パラメータを付加
2993 $replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
2995 //$scriptURL = $scriptsUrl . '/' . ScriptLibInfo::JQUERY_JSHOTKEYS_FILENAME;
2996 //if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();// スクリプトをキャッシュ保存しない場合は、パラメータを付加
2997 //$replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
2999 } else { // システム運用権限がない場合
3000 // 管理権限なしで管理ディレクトリアクセスで必要なスクリプトを読み込む
3001 $count = count($this->defaultAdminDirScriptFiles);
3002 for ($i = 0; $i < $count; $i++){
3003 $scriptFilename = $this->defaultAdminDirScriptFiles[$i];
3005 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
3006 $scriptURL = $scriptsUrl . '/' . $scriptFilename;
3007 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();
3008 $replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
3012 // Googleマップライブラリの読み込み
3013 if ($this->useGooglemaps && $this->isContentGooglemaps) $this->addScriptFile(ScriptLibInfo::getScript(ScriptLibInfo::LIB_GOOGLEMAPS)); // コンテンツにGoogleマップが含むかどうか
3015 $count = count($this->defaultScriptFiles);
3016 for ($i = 0; $i < $count; $i++){
3017 $defaultScriptFile = $this->defaultScriptFiles[$i];
3019 // ##### jQueryMobileスクリプトを追加する場合は直前に初期化スクリプトを追加 #####
3020 if ($defaultScriptFile == $this->selectedJQueryMobileFilename){
3021 if (count($this->headPreMobileScript) > 0){
3022 $replaceStr .= '<script type="text/javascript">' . M3_NL;
3023 $replaceStr .= '//<![CDATA[' . M3_NL;
3024 for ($j = 0; $j < count($this->headPreMobileScript); $j++){
3025 $replaceStr .= $this->headPreMobileScript[$j];
3027 $replaceStr .= M3_NL;
3028 $replaceStr .= '//]]>' . M3_NL;
3029 $replaceStr .= '</script>' . M3_NL;
3034 if (strncasecmp($defaultScriptFile, 'http://', 7) == 0 || strncasecmp($defaultScriptFile, 'https://', 8) == 0){
3035 $scriptURL = $defaultScriptFile;
3039 $scriptURL = str_replace('http://', 'https://', $scriptURL);
3041 $scriptURL = str_replace('https://', 'http://', $scriptURL);
3044 $scriptURL = $scriptsUrl . '/' . $defaultScriptFile;
3047 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
3048 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();
3049 $replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
3052 // ##### ウィジェットごとのJavaScript読み込み #####
3053 // スクリプトがあるウィジェットを取得
3054 $this->db->getWidgetsIdWithScript($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId(), $rows);
3055 for ($i = 0; $i < count($rows); $i++){
3056 $searchPath = $gEnvManager->getWidgetsPath() . '/' . $rows[$i]['wd_id'] . '/' . M3_DIR_NAME_SCRIPTS;
3058 // ディレクトリがあるときはディレクトリ内読み込み
3059 if (is_dir($searchPath)){
3060 $dir = dir($searchPath);
3061 while (($file = $dir->read()) !== false){
3062 $filePath = $searchPath . '/' . $file;
3063 if ($file != '.' && $file != '..' && is_file($filePath)
3064 && strncmp($file, '_', 1) != 0){ // 「_」で始まる名前のファイルは読み込まない
3067 $scriptURL = $widgetsUrl . '/' . $rows[$i]['wd_id'] . '/' . M3_DIR_NAME_SCRIPTS . '/' . $file;
3068 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
3069 if (!$this->hasScriptCache) $scriptURL .= $this->getCacheParam();
3070 $replaceStr .= '<script type="text/javascript" src="' . $scriptURL . '"></script>' . M3_NL;
3076 // ウィジェットからの追加のCSS読み込み
3077 $count = count($this->headScriptFiles);
3078 for ($i = 0; $i < $count; $i++){
3079 $scriptUrl = $this->headScriptFiles[$i];
3080 if ($isSslPage) $scriptUrl = str_replace('http://', 'https://', $scriptUrl); // SSL化が必要なときは変換
3082 // スクリプトをキャッシュ保存しない場合は、パラメータを付加
3083 if (!$this->hasScriptCache) $scriptUrl .= $this->getCacheParam();
3084 $replaceStr .= '<script type="text/javascript" src="' . $scriptUrl . '"></script>' . M3_NL;
3088 $openType = $this->gSystem->getSystemConfig(self::CF_CONFIG_WINDOW_OPEN_TYPE);// ウィジェット設定画面のウィンドウ表示タイプ(0=別ウィンドウ、1=タブ)
3090 // ##### ページへJavascriptの埋め込む #####
3091 // JavaScriptグローバル変数の設定
3092 //$replaceStr .= '<script type="text/javascript">' . M3_NL;
3093 //$replaceStr .= '<!--' . M3_NL;
3094 $replaceStr .= '<script type="text/javascript">' . M3_NL;
3095 $replaceStr .= '//<![CDATA[' . M3_NL;
3096 $replaceStr .= '// Magic3 Global values' . M3_NL;
3097 $replaceStr .= 'var M3_ROOT_URL = "' . $rootUrl . '";' . M3_NL; // システムルートURL
3099 if ($gEnvManager->isAdminDirAccess() && $gEnvManager->isSystemManageUser()){ // 管理画面へのアクセス、システム運用権限があり
3101 $replaceStr .= 'var M3_DEFAULT_ADMIN_URL="' . $gEnvManager->getDefaultAdminUrl() . '";' . M3_NL; // 管理機能URL
3102 if ($openType != '') $replaceStr .= 'var M3_CONFIG_WINDOW_OPEN_TYPE = ' . $openType . ';' . M3_NL;
3105 $replaceStr .= 'var M3_PAGE_ID = "' . $gEnvManager->getCurrentPageId() . '";' . M3_NL;
3106 $replaceStr .= 'var M3_PAGE_SUB_ID = "' . $gEnvManager->getCurrentPageSubId() . '";' . M3_NL;
3108 $replaceStr .= 'var M3_WYSIWYG_EDITOR = "' . $this->wysiwygEditor . '";' . M3_NL;
3110 // Googleマップライブラリの読み込み
3111 if ($this->useGooglemaps){
3112 $replaceStr .= 'var M3_USE_GOOGLEMAPS = true;' . M3_NL;
3114 $replaceStr .= 'var M3_USE_GOOGLEMAPS = false;' . M3_NL;
3117 if ($cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // ウィジェット付きポジション表示
3118 $pageId = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_DEF_PAGE_ID); // ページID
3119 $pageSubId = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_DEF_PAGE_SUB_ID);// ページサブID
3121 if (!empty($task)){ // 戻りタスクが設定されているときのみ最大化可能
3122 $replaceStr .= 'function gobackPagedef(){' . M3_NL;
3123 $replaceStr .= ' window.location.href = "' . $gEnvManager->getDefaultAdminUrl() . '?pageid=' . $pageId . '&pagesubid=' . $pageSubId . '&task=' . $task . '";' . M3_NL;
3124 $replaceStr .= '}' . M3_NL;
3125 //$replaceStr .= '$(document).ready(function(){' . M3_NL;
3126 $replaceStr .= '$(function(){' . M3_NL;
3127 //$replaceStr .= ' jQuery.hotkeys.add("esc", function(){' . M3_NL;
3128 //$replaceStr .= ' gobackPagedef();' . M3_NL;
3129 $replaceStr .= ' $(document).keyup(function(e){' . M3_NL;
3130 $replaceStr .= ' if (e.which == 36) gobackPagedef();' . M3_NL;
3131 $replaceStr .= ' });' . M3_NL;
3132 $replaceStr .= '});' . M3_NL;
3135 // ##### 管理用テンプレートを使用している場合の処理 #####
3136 // Bootstrap用のスクリプト処理
3137 if ($this->useBootstrap){
3138 $replaceStr .= '$(function(){' . M3_NL;
3139 $replaceStr .= ' $(\'.button\').addClass(\'' . self::BOOTSTRAP_BUTTON_CLASS . '\');' . M3_NL;
3140 $replaceStr .= '});' . M3_NL;
3143 } else if ($this->isPageEditable){ // 一般画面ページ編集可能モードのとき
3144 $replaceStr .= 'var M3_DEFAULT_ADMIN_URL="' . $gEnvManager->getDefaultAdminUrl() . '";' . M3_NL; // 管理機能URL
3145 if ($openType != '') $replaceStr .= 'var M3_CONFIG_WINDOW_OPEN_TYPE = ' . $openType . ';' . M3_NL;
3148 $replaceStr .= 'var M3_PAGE_ID = "' . $gEnvManager->getCurrentPageId() . '";' . M3_NL;
3149 $replaceStr .= 'var M3_PAGE_SUB_ID = "' . $gEnvManager->getCurrentPageSubId() . '";' . M3_NL;
3151 $replaceStr .= 'var M3_WYSIWYG_EDITOR = "' . $this->wysiwygEditor . '";' . M3_NL;
3152 } else if ($this->isEditMode){ // 一般画面編集モード
3154 $replaceStr .= 'var M3_WYSIWYG_EDITOR = "' . $this->wysiwygEditor . '";' . M3_NL;
3157 // ##### パネルメニュー(一般画面と管理画面の切り替え等)の表示 #####
3158 // PC用、携帯用、スマートフォン用画面とウィジェット付きポジションの管理画面時に表示
3159 if (($gEnvManager->isAdminDirAccess() && $cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET) || // 管理画面(ウィジェット付きポジション表示)のとき
3160 (!$gEnvManager->isAdminDirAccess() && // 一般用画面のとき
3161 $cmd != M3_REQUEST_CMD_DO_WIDGET && // ウィジェット単体実行でない
3162 $cmd != M3_REQUEST_CMD_RSS)){ // RSS配信でない
3163 //if ($gEnvManager->isSystemAdmin()){ // 管理者権限がある場合のみ有効
3164 if ($gEnvManager->isSystemManageUser()){ // システム運用権限ありの場合
3167 $adminTag = ''; // 管理画面ボタン
3168 $editTag = ''; // 編集ボタン
3169 $logoutTag = ''; // ログアウトボタン
3171 if ($gEnvManager->isAdminDirAccess()){ // 管理画面(ウィジェット付きポジション表示)の場合
3173 /* $titleStr = '編集終了';
3174 $linkUrl = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_BACKUP_URL); // 退避していたURLを取得
3175 if (empty($linkUrl)) $linkUrl = $gEnvManager->getDefaultUrl();
3176 $editTag = '<li><a href="' . convertUrlToHtmlEntity($linkUrl) . '">';
3177 $editTag .= '<img src="' . $rootUrl . self::EDIT_END_ICON_FILE . '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></li>';
3180 $linkUrl = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_BACKUP_URL); // 退避していたURLを取得
3181 if (empty($linkUrl)) $linkUrl = $gEnvManager->getDefaultUrl();
3182 $editTag = '<div class="m3editend"><a href="' . convertUrlToHtmlEntity($linkUrl) . '">';
3183 $editTag .= '<img src="' . $rootUrl . self::EDIT_END_ICON_FILE . '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></div>';
3184 $linkStr .= $editTag;
3186 $this->initScript .= str_repeat(M3_INDENT_SPACE, 1) . 'if (window.parent && window.parent.frames.length == 0){' . M3_NL;// インラインフレームでないときパネルメニューを表示
3187 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$("body").prepend(\'' . $linkStr . '\');' . M3_NL; // appendでうまく表示できないのでprependで表示
3188 $this->initScript .= str_repeat(M3_INDENT_SPACE, 1) . '}' . M3_NL;
3189 } else if ($this->isAccessPointWithAdminMenu){ // 通常画面は、管理メニューを使用するアクセスポイントの場合のみ表示
3192 $linkUrl = $gEnvManager->getDefaultAdminUrl();
3193 $adminTag = '<li><a href="' . convertUrlToHtmlEntity($linkUrl) . '">';
3194 $adminTag .= '<img src="' . $rootUrl . self::ADMIN_ICON_FILE . '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></li>';
3198 $linkUrl = $gEnvManager->getDefaultAdminUrl() . '?' . M3_REQUEST_PARAM_OPERATION_COMMAND . '=' .M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET;
3199 $linkUrl .= '&' . M3_REQUEST_PARAM_DEF_PAGE_ID . '=' . $gEnvManager->getCurrentPageId();
3200 $linkUrl .= '&' . M3_REQUEST_PARAM_DEF_PAGE_SUB_ID . '=' . $gEnvManager->getCurrentPageSubId();
3201 $linkUrl .= '&' . M3_REQUEST_PARAM_BACKUP_URL . '=' . urlencode($gEnvManager->getCurrentRequestUri()); // URL退避用
3202 $editTag = '<li><a href="' . convertUrlToHtmlEntity($linkUrl) . '">';
3203 $editTag .= '<img src="' . $rootUrl . self::EDIT_PAGE_ICON_FILE . '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></li>';
3206 $titleStr = 'ログアウト';
3207 // if ($gEnvManager->isAdminDirAccess()){ // 管理画面の場合
3208 // $linkUrl = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_BACKUP_URL); // 退避していたURLを取得
3209 // if (empty($linkUrl)) $linkUrl = $gEnvManager->getDefaultUrl();
3211 $linkUrl = $gEnvManager->getCurrentRequestUri();
3213 $linkUrl = createUrl($linkUrl, M3_REQUEST_PARAM_OPERATION_COMMAND . '=' . M3_REQUEST_CMD_LOGOUT);
3214 $logoutTag = '<li><a href="' . convertUrlToHtmlEntity($linkUrl) . '">';
3215 $logoutTag .= '<img src="' . $rootUrl . self::LOGOUT_ICON_FILE . '" alt="' . $titleStr . '" title="' . $titleStr . '" /></a></li>';
3217 $linkStr .= '<div id="m3slidemenubar">';
3218 $linkStr .= '<div id="m3slidemenubarpanel">';
3219 $linkStr .= '<ul class="menubarbuttons">';
3220 if ($gEnvManager->isSystemAdmin()){ // 管理画面、編集モードは、管理者権限がある場合のみ有効
3221 $linkStr .= $adminTag;
3222 $linkStr .= $editTag;
3224 $linkStr .= $logoutTag;
3225 $linkStr .= '</ul>';
3226 $linkStr .= '</div>';
3227 $linkStr .= '<div id="slidetrigger">';
3228 $linkStr .= '<a href="#" class="m3open">開く</a>';
3229 $linkStr .= '<a href="#" class="m3close">閉じる</a>';
3230 $linkStr .= '</div>';
3231 $linkStr .= '</div>';
3233 $this->initScript .= str_repeat(M3_INDENT_SPACE, 1) . 'if (window.parent && window.parent.frames.length == 0){' . M3_NL;// インラインフレームでないときパネルメニューを表示
3234 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$("body").append(\'' . $linkStr . '\');' . M3_NL;
3235 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$("#m3slidemenubarpanel").m3SlideMenubar();' . M3_NL;
3236 $this->initScript .= str_repeat(M3_INDENT_SPACE, 1) . '}' . M3_NL;
3240 // 一般画面からのウィジェット操作用ツールバー
3241 if (!$gEnvManager->isAdminDirAccess() &&
3242 $cmd != M3_REQUEST_CMD_DO_WIDGET && // ウィジェット単体実行でない
3243 $cmd != M3_REQUEST_CMD_RSS){ // RSS配信でない
3244 if ($gEnvManager->isSystemManageUser()){ // 一般用画面で管理者権限がある場合のみ有効
3246 $this->initScript .= M3_INDENT_SPACE . '$(\'div.m3_widget\').each(function(){' . M3_NL;
3247 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var attrs = m3_splitAttr($(this).attr(\'m3\'));' . M3_NL;
3248 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var widgetId = attrs[\'widgetid\'];' . M3_NL;
3249 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var serialNo = attrs[\'serial\'];' . M3_NL;
3250 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var configId = attrs[\'configid\'];' . M3_NL;
3251 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var useconfig = attrs[\'useconfig\'];' . M3_NL;
3253 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var html = \'\';' . M3_NL;
3254 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'if (useconfig == 1){' . M3_NL;
3255 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) .
3256 'html += \'<a href="javascript:void(0);" onclick="m3ShowConfigWindow(\\\'\' + widgetId + \'\\\', \' + configId + \', \' + serialNo + \');return false;" >' .
3257 '<img src="' . $rootUrl . self::CONFIG_ICON32_FILE . '" alt="ウィジェット設定" title="ウィジェット設定" width="32" height="32" /></a>\';' . M3_NL;
3258 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '}' . M3_NL;
3259 if ($gEnvManager->isSystemAdmin()){ // 位置調整は管理者権限がある場合のみ有効(管理ウィジェットの機能のため)
3260 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) .
3261 'html += \'<a href="javascript:void(0);" onclick="m3ShowAdjustWindow(\' + configId + \', \' + serialNo + \', M3_PAGE_ID, M3_PAGE_SUB_ID);return false;" >' .
3262 '<img src="' . $rootUrl . self::ADJUST_ICON32_FILE . '" alt="タイトル・位置調整" title="タイトル・位置調整" width="32" height="32" /></a>\';' . M3_NL;
3264 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'if (html != \'\'){' . M3_NL;
3265 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) .
3266 'html = \'<div class="m3tooltip" style="display:none;">\' + html + \'<a class="m3closebox" href="javascript:void(0);">' .
3267 '<img src="' . $rootUrl . self::CLOSE_BOX_ICON32_FILE . '" alt="閉じる" title="閉じる" width="11" height="11" /></a></div>\';' . M3_NL;
3269 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '$(this).append(html);' . M3_NL;
3270 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '}' . M3_NL;
3272 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$(this).click(function(){' . M3_NL;
3273 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var tooltipObj = $(this).children(\'.m3tooltip\');' . M3_NL;
3274 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'if (tooltipObj.css(\'display\') == \'none\'){' . M3_NL;
3275 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'tooltipObj.show();' . M3_NL;
3276 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '} else {' . M3_NL;
3277 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'tooltipObj.hide();' . M3_NL;
3278 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '}' . M3_NL;
3279 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '});' . M3_NL;
3280 // ウィジェットボーダーハイライト、ツールチップ表示
3281 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$(this).hover(function(){' . M3_NL;
3282 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '$(this).addClass(\'m3_widget_highlight\');' . M3_NL;
3283 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var tooltipObj = $(this).children(\'.m3tooltip\');' . M3_NL;
3284 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var pos = $(this).position();' . M3_NL;
3285 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var width = $(this).outerWidth();' . M3_NL;
3286 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var tooltipWidth = tooltipObj.outerWidth(true);' . M3_NL;
3287 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var x = pos.left + width - tooltipWidth;' . M3_NL;
3288 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var y = pos.top;' . M3_NL;
3289 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'tooltipObj.css({position: "absolute",top: y + "px", left: x + "px"}).show();' . M3_NL;
3290 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '}, function(){' . M3_NL;
3291 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '$(this).removeClass(\'m3_widget_highlight\');' . M3_NL;
3292 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var tooltipObj = $(this).children(\'.m3tooltip\');' . M3_NL;
3293 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'tooltipObj.hide();' . M3_NL;
3294 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '});' . M3_NL;
3296 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$(this).find(\'.m3closebox\').click(function(event){' . M3_NL;
3297 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '$(this).children(\'.m3tooltip\').hide();' . M3_NL;
3298 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '});' . M3_NL;
3300 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var pos = $(this).position();' . M3_NL;
3301 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var offset = $(this).offset();' . M3_NL;
3302 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'var width = $(this).outerWidth();' . M3_NL;
3303 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '$(this).find(\'.m3edittool\').each(function(){' . M3_NL;
3304 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '$(this).offset({left: offset.left});' . M3_NL;
3305 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '$(this).width(width);' . M3_NL;
3306 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '});' . M3_NL;
3307 $this->initScript .= M3_INDENT_SPACE . '});' . M3_NL;
3310 $this->initScript .= M3_INDENT_SPACE . 'var widgetWindow = \'<div class="m3_contextmenu" id="m3_widgetmenu" style="visibility:hidden;">\';' . M3_NL;
3311 $this->initScript .= M3_INDENT_SPACE . 'widgetWindow += \'<ul>\';' . M3_NL;
3312 if ($gEnvManager->isSystemAdmin()){ // 位置調整は管理者権限がある場合のみ有効(管理ウィジェットの機能のため)
3313 $this->initScript .= M3_INDENT_SPACE . 'widgetWindow += \'<li id="m3_wadjust"><img src="\' + M3_ROOT_URL + \'/images/system/adjust_widget.png" /> <span>タイトル・位置調整</span></li>\';' . M3_NL;
3315 $this->initScript .= M3_INDENT_SPACE . 'widgetWindow += \'<li id="m3_wconfig"><img src="\' + M3_ROOT_URL + \'/images/system/config.png" /> <span>ウィジェットの設定</span></li>\';' . M3_NL;
3316 $this->initScript .= M3_INDENT_SPACE . 'widgetWindow += \'</ul>\';' . M3_NL;
3317 $this->initScript .= M3_INDENT_SPACE . 'widgetWindow += \'</div>\';' . M3_NL;
3318 $this->initScript .= M3_INDENT_SPACE . '$("body").append(widgetWindow);' . M3_NL;
3319 $this->initScript .= M3_INDENT_SPACE . '$(\'div.m3_widget\').contextMenu(\'m3_widgetmenu\', {' . M3_NL;
3320 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'menuStyle: {' . M3_NL;
3321 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '// border : "2px solid green",' . M3_NL;
3322 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'backgroundColor: \'#FFFFFF\',' . M3_NL;
3323 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'width: "150px",' . M3_NL;
3324 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'textAlign: \'left\',' . M3_NL;
3325 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'font: \'12px/1.5 Arial, sans-serif\'' . M3_NL;
3326 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '},' . M3_NL;
3327 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'itemStyle: {' . M3_NL;
3328 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'padding: \'3px 3px\'' . M3_NL;
3329 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '},' . M3_NL;
3330 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'bindings: {' . M3_NL;
3331 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '\'m3_wconfig\': function(t){' . M3_NL;
3332 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'var attrs = m3_splitAttr($(\'#\' + t.id).attr(\'m3\'));' . M3_NL;
3333 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'if (attrs[\'useconfig\'] == \'0\'){' . M3_NL;
3334 $this->initScript .= str_repeat(M3_INDENT_SPACE, 5) . 'alert("このウィジェットには設定画面がありません");' . M3_NL;
3335 $this->initScript .= str_repeat(M3_INDENT_SPACE, 5) . 'return;' . M3_NL;
3336 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . '}' . M3_NL;
3337 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'm3ShowConfigWindow(attrs[\'widgetid\'], attrs[\'configid\'], attrs[\'serial\']);' . M3_NL;
3338 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '},' . M3_NL;
3339 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '\'m3_wadjust\': function(t){' . M3_NL;
3340 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'var attrs = m3_splitAttr($(\'#\' + t.id).attr(\'m3\'));' . M3_NL;
3341 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . 'm3ShowAdjustWindow(attrs[\'configid\'], attrs[\'serial\'], M3_PAGE_ID, M3_PAGE_SUB_ID);' . M3_NL;
3342 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '}' . M3_NL;
3343 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '},' . M3_NL;
3344 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'onContextMenu: function(e){' . M3_NL;
3345 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'return true;' . M3_NL;
3346 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '},' . M3_NL;
3347 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . 'onShowMenu: function(e, menu){' . M3_NL;
3348 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '// メニュー項目の変更' . M3_NL;
3349 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'var attrs = m3_splitAttr($(e.target).parents(\'dl\').attr(\'m3\'));' . M3_NL;
3350 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'if (attrs[\'useconfig\'] == \'0\'){' . M3_NL;
3351 $this->initScript .= str_repeat(M3_INDENT_SPACE, 4) . '$(\'#m3_wconfig\', menu).remove();' . M3_NL;
3352 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . '}' . M3_NL;
3353 $this->initScript .= str_repeat(M3_INDENT_SPACE, 3) . 'return menu;' . M3_NL;
3354 $this->initScript .= str_repeat(M3_INDENT_SPACE, 2) . '}' . M3_NL;
3355 $this->initScript .= M3_INDENT_SPACE . '});' . M3_NL;
3358 // ポップアップメッセージがある場合は表示
3359 if (!empty($this->popupMsg)){
3360 $replaceStr .= 'alert("' . $this->popupMsg . '");' . M3_NL;
3363 if ($cleanType == 1){
3364 // HTMLのクリーン処理が必要なときはコードを埋め込む
3365 $this->initScript .= ' $(\'.PostHeaderIcons\').remove();' . M3_NL;// 不要なアイコン表示タグの削除
3366 $this->initScript .= ' $(\'.PostMetadataHeader\').each(function(i){' . M3_NL;
3367 $this->initScript .= ' if ($(this).text().trim() == \'\') $(this).remove();' . M3_NL;
3368 $this->initScript .= ' });' . M3_NL;
3371 if (!empty($this->initScript)){
3372 $replaceStr .= '$(function(){' . M3_NL;
3373 $replaceStr .= $this->initScript;
3374 $replaceStr .= '});' . M3_NL;
3377 //$replaceStr .= '// -->' . M3_NL;
3378 //$replaceStr .= '</script>' . M3_NL;
3379 $replaceStr .= '//]]>' . M3_NL;
3380 $replaceStr .= '</script>' . M3_NL;
3382 // HEADタグに埋め込むCSS,JavaScript,任意文字列
3383 if (count($this->headCss) > 0){
3384 // CSSの場合は全体をstyleタグで囲む
3385 $replaceStr .= '<style type="text/css">' . M3_NL;
3386 $replaceStr .= '<!--' . M3_NL;
3387 for ($i = 0; $i < count($this->headCss); $i++){
3388 $replaceStr .= $this->headCss[$i];
3390 $replaceStr .= M3_NL . '//-->' . M3_NL;
3391 $replaceStr .= '</style>' . M3_NL;
3393 if (count($this->headScript) > 0){
3394 // JavaScriptの場合は全体をscriptタグで囲む
3395 //$replaceStr .= '<script type="text/javascript">' . M3_NL;
3396 //$replaceStr .= '<!--' . M3_NL;
3397 $replaceStr .= '<script type="text/javascript">' . M3_NL;
3398 $replaceStr .= '//<![CDATA[' . M3_NL;
3399 for ($i = 0; $i < count($this->headScript); $i++){
3400 $replaceStr .= $this->headScript[$i];
3402 //$replaceStr .= M3_NL . '//-->' . M3_NL;
3403 //$replaceStr .= '</script>' . M3_NL;
3404 $replaceStr .= M3_NL;
3405 $replaceStr .= '//]]>' . M3_NL;
3406 $replaceStr .= '</script>' . M3_NL;
3408 if (count($this->headString) > 0){
3410 for ($i = 0; $i < count($this->headString); $i++){
3411 $replaceStr .= $this->headString[$i];
3420 * @param string $position HTMLテンプレート上の書き出し位置
3421 * @param string $style ウィジェットの表示スタイル(空の場合=Joomla!v1.0テンプレート用、空以外=Joomla!v1.5テンプレート用)
3422 * @param int $templateVer テンプレートバージョン(0=デフォルト(Joomla!v1.0)、-1=携帯用、1=Joomla!v1.5、2=Joomla!v2.5)
3423 * @param array $attr その他属性
3424 * @return string 出力コンテンツ
3426 function getContents($position, $style = '', $templateVer = 0, $attr = array())
3428 static $render; // Joomla!v1.5テンプレート用
3429 global $gRequestManager;
3430 global $gEnvManager;
3433 $filename = $gEnvManager->getCurrentPageId();
3434 $subId = $gEnvManager->getCurrentPageSubId();
3435 if (empty($subId)) $subId = $gEnvManager->getDefaultPageSubId();
3437 // ポジション名表示モードに応じて出力を作成
3438 $contents = ''; // 出力コンテンツ
3439 switch ($this->showPositionMode){
3441 // ページ定義を取得。同じポジションが続く場合は最初の一度だけ定義を取得
3442 if (empty($this->pageDefPosition) || $position != $this->pageDefPosition){ // ポジションが異なる場合
3443 $ret = $this->db->getPageDef($filename, $subId, $position, $rows, 0/*定義セットIdデフォルト*/, true/*表示ウィジェットのみ*/);
3444 if ($ret){ // 1行以上データが取得できたとき
3445 $this->pageDefRows = $rows; // ページ定義レコード
3446 $this->pageDefPosition = $position;
3448 $this->pageDefRows = array();
3449 $this->pageDefPosition = '';
3453 $count = count($this->pageDefRows);
3455 if ($templateVer == 0){ // echo出力のとき(Joomla!v1.0テンプレートの場合)
3456 ob_start();// バッファ作成
3458 // ウィジェットヘッダ(Joomla!1.0用)を出力するテンプレートかどうかチェック
3459 $widgetHeaderType = $this->getTemplateWidgetHeaderType();
3460 for ($i = 0; $i < $count; $i++){
3461 $pageDefParam = $this->pageDefRows[$i]; // 画面定義パラメータ
3462 $widgetId = $this->pageDefRows[$i]['wd_id'];
3464 // ### 遅延実行ウィジェットはキャッシュしない ###
3465 // キャッシュデータがあるときはキャッシュデータを使用
3466 $cacheData = $this->gCache->getWidgetCache($request, $this->pageDefRows[$i], $metaTitle, $metaDesc, $metaKeyword);
3468 if (empty($cacheData)){ // キャッシュデータがないとき
3470 $ret = $this->pageDefLoop($i, $this->pageDefRows[$i], $style, $titleTag, $widgetHeaderType);
3472 $widgetContent = ob_get_contents();
3475 $widgetContent = $this->_addOptionContent($widgetContent, $pageDefParam);
3478 $this->gCache->setWidgetCache($gRequestManager, $this->pageDefRows[$i], $widgetContent,
3479 $this->lastHeadTitle, $this->lastHeadDescription, $this->lastHeadKeywords);
3482 $widgetClassSuffix = $this->pageDefRows[$i]['pd_suffix']; // 追加CSSクラスサフィックス
3483 $widgetOuterClass = self::WIDGET_TAG_HEAD_SHORT . str_replace('/', '_', $widgetId);// ウィジェットの外枠のクラス
3484 if (!empty($widgetClassSuffix)) $widgetOuterClass .= ' ' . $widgetOuterClass . '_' . $widgetClassSuffix; // 追加CSSクラス
3485 $widgetOuterClass .= ' ' . self::WIDGET_OUTER_CLASS_HEAD_POSITION . $position; // ポジションブロッククラス
3486 $widgetContent = '<div class="' . $widgetOuterClass . '">' . $widgetContent . '</div>';
3487 if ($this->isPageEditable){ // 一般画面ページ編集可能モードのとき
3488 $configId = $this->pageDefRows[$i]['pd_config_id']; // 定義ID
3489 $serial = $this->pageDefRows[$i]['pd_serial']; // シリアル番号
3490 $hasAdmin = '0'; // 管理画面があるかどうか
3491 if ($this->pageDefRows[$i]['wd_has_admin']) $hasAdmin = '1';
3492 $shared = '0'; // 共通属性があるかどうか
3493 if (empty($this->pageDefRows[$i]['pd_sub_id'])) $shared = '1'; // 共通ウィジェットのとき
3494 $m3Option = 'm3="widgetid:' . $widgetId . '; serial:' . $serial . '; configid:' . $configId . '; useconfig:' . $hasAdmin . '; shared:' . $shared . '"';
3495 $widgetTag = self::WIDGET_TAG_HEAD . $position . '_' . $i; // ウィジェット識別用ユニークタグ
3496 $widgetContent = '<div id="' . $widgetTag . '" class="m3_widget" rel="#m3editwidget" ' . $m3Option . '>' . $widgetContent . '</div>';
3498 } else { // キャッシュデータがあるとき
3499 $widgetContent = $cacheData;
3502 if (!empty($metaTitle)) $this->setHeadSubTitle($metaTitle);
3503 if (!empty($metaDesc)) $this->setHeadDescription($metaDesc);
3504 if (!empty($metaKeyword)) $this->setHeadKeywords($metaKeyword);
3506 $contents .= $widgetContent;
3508 ob_end_clean(); // バッファ破棄
3510 if ($i < $count) return '';// 処理中断のときは終了
3511 } else { // Joomla!v1.5テンプレートの場合
3512 for ($i = 0; $i < $count; $i++){
3513 $pageDefParam = $this->pageDefRows[$i]; // 画面定義パラメータ
3514 $widgetId = $this->pageDefRows[$i]['wd_id'];
3516 // ### 遅延実行ウィジェットはキャッシュしない ###
3517 // キャッシュデータがあるときはキャッシュデータを使用
3518 $cacheData = $this->gCache->getWidgetCache($request, $this->pageDefRows[$i], $metaTitle, $metaDesc, $metaKeyword);
3520 if (empty($cacheData)){ // キャッシュデータがないとき
3522 $gEnvManager->setCurrentWidgetTitle('');
3524 // Joomla用のパラメータを初期化
3525 $gEnvManager->setCurrentWidgetJoomlaParam(array());
3528 $ret = $this->pageDefLoop($i, $this->pageDefRows[$i], $style, $titleTag, false);
3529 $widgetContent = ob_get_contents();
3531 $trimContent = trim($widgetContent);
3532 if (!empty($trimContent)){ // 出力が空でない場合
3533 $isRendered = false; // Joomla!の描画処理を行ったかどうか
3534 if (!empty($this->pageDefRows[$i]['pd_use_render'])){ // Joomla!の描画処理を使用する場合
3535 // Joomla!ウィジェットの出力に埋め込む
3536 if (strcasecmp($style, 'none') != 0){
3538 if (!isset($render)) $render = new JRender();
3540 // デフォルトのウィジェットタイトル取得
3541 $defaultTitle = $gEnvManager->getCurrentWidgetTitle();
3544 $joomlaParam = $gEnvManager->getCurrentWidgetJoomlaParam();
3546 // 遅延ウィジェットのときはタイトルタグを埋め込む
3547 if (!empty($titleTag)) $defaultTitle = $titleTag;
3549 // タイトルが空でタイトル表示を行う場合は、デフォルトタイトルを使用
3550 $title = $this->pageDefRows[$i]['pd_title'];
3551 if ($this->pageDefRows[$i]['pd_title_visible']){ // タイトル表示のとき
3552 if (empty($title)) $title = $defaultTitle;
3554 $title = ''; // タイトルは非表示
3558 $params = array(); // ウィジェットごとの属性
3559 $widgetType = $this->pageDefRows[$i]['wd_type']; // ウィジェットタイプ
3561 // オプションのJoomlaクラス(縦型メニュー(art-vmenu)等)
3562 $joomlaClass = $this->pageDefRows[$i]['wd_joomla_class']; // 「wd_joomla_class」は使っていない?
3563 if (!empty($joomlaClass)) $params['moduleclass_sfx'] = $joomlaClass;
3564 if (isset($joomlaParam['moduleclass_sfx'])) $params['moduleclass_sfx'] = $joomlaParam['moduleclass_sfx'];// ウィジェットでjoomla用パラメータの設定があるとき
3566 if (strcmp($position, 'main') == 0){// メイン部のとき
3567 $widgetContent = $render->getComponentContents($style, $widgetContent, $title, $attr, $params, $pageDefParam, $templateVer);
3568 } else if (strStartsWith($position, 'user') || // ナビゲーションメニュー位置の場合
3569 strcasecmp($position, 'position-1') == 0){ // Joomla!v2.5テンプレート対応
3570 $moduleContent = '';
3571 if ($style == '_mainmenu'){ // ナビゲーションバーメニューはメニュータイプのウィジェットのみ実行
3572 if ($widgetType == 'menu') $moduleContent = $render->getMenuContents($style, $widgetContent, $title, $attr, $params, $pageDefParam, $templateVer);
3574 // ナビゲーションバータイプで作成できないときはデフォルトの出力を取得
3575 if (empty($moduleContent)) $moduleContent = $render->getModuleContents('xhtml', $widgetContent, $title, $attr, $params, $pageDefParam, $templateVer);
3577 $moduleContent = $render->getModuleContents($style, $widgetContent, $title, $attr, $params, $pageDefParam, $templateVer);
3579 $widgetContent = $moduleContent;
3580 } else { // その他の位置のとき
3581 $widgetContent = $render->getModuleContents($style, $widgetContent, $title, $attr, $params, $pageDefParam, $templateVer);
3583 $isRendered = true; // Joomla!の描画処理を行ったかどうか
3586 if (!$isRendered){ // Joomla!の描画処理を行っていない場合
3588 $widgetContent = $this->_addOptionContent($widgetContent, $pageDefParam);
3591 if (!$ret) return ''; // 処理中断のときは終了
3594 $this->gCache->setWidgetCache($gRequestManager, $this->pageDefRows[$i], $widgetContent,
3595 $this->lastHeadTitle, $this->lastHeadDescription, $this->lastHeadKeywords);
3598 $widgetClassSuffix = $this->pageDefRows[$i]['pd_suffix']; // 追加CSSクラスサフィックス
3599 $widgetOuterClass = self::WIDGET_TAG_HEAD_SHORT . str_replace('/', '_', $widgetId);// ウィジェットの外枠のクラス
3600 if (!empty($widgetClassSuffix)) $widgetOuterClass .= ' ' . $widgetOuterClass . '_' . $widgetClassSuffix; // 追加CSSクラス
3601 $widgetOuterClass .= ' ' . self::WIDGET_OUTER_CLASS_HEAD_POSITION . $position; // ポジションブロッククラス
3602 $widgetContent = '<div class="' . $widgetOuterClass . '">' . $widgetContent . '</div>';
3603 if ($this->isPageEditable){ // 一般画面ページ編集可能モードのとき
3604 //$editInfo = 'widgetid:' . $this->pageDefRows[$i]['wd_id'];
3605 $configId = $this->pageDefRows[$i]['pd_config_id']; // 定義ID
3606 $serial = $this->pageDefRows[$i]['pd_serial']; // シリアル番号
3607 $hasAdmin = '0'; // 管理画面があるかどうか
3608 if ($this->pageDefRows[$i]['wd_has_admin']) $hasAdmin = '1';
3609 $shared = '0'; // 共通属性があるかどうか
3610 if (empty($this->pageDefRows[$i]['pd_sub_id'])) $shared = '1'; // 共通ウィジェットのとき
3611 $m3Option = 'm3="widgetid:' . $widgetId . '; serial:' . $serial . '; configid:' . $configId . '; useconfig:' . $hasAdmin . '; shared:' . $shared . '"';
3612 $widgetTag = self::WIDGET_TAG_HEAD . $position . '_' . $i; // ウィジェット識別用ユニークタグ
3613 $widgetContent = '<div id="' . $widgetTag . '" class="m3_widget" rel="#m3editwidget" ' . $m3Option . '>' . $widgetContent . '</div>';
3615 } else { // キャッシュデータがあるとき
3616 $widgetContent = $cacheData;
3619 if (!empty($metaTitle)) $this->setHeadSubTitle($metaTitle);
3620 if (!empty($metaDesc)) $this->setHeadDescription($metaDesc);
3621 if (!empty($metaKeyword)) $this->setHeadKeywords($metaKeyword);
3623 $contents .= $widgetContent;
3627 if ($position == 'main'){ // メイン部のときは、メッセージを出力
3628 /*if (strlen($this->popupMsg) > 0){
3629 echo "\n<script language=\"javascript\">alert('" . addslashes($this->popupMsg) . "');</script>";
3631 } else if ($position == 'debug'){ // デバッグ文出力
3637 $contents .= '<div style="background-color:#eee;margin:2px;padding:10px;border:3px solid #f00;color:#700;">ポジション名: ';
3638 $contents .= '<b>' . $position . '</b>';
3639 $contents .= '</div>';
3641 case 2: // ポジション表示(ウィジェット付き)
3642 $rev = '555'; // データのリビジョン番号
3643 // ポジションのHTMLタグIDを作成
3646 for ($i = 0; $i < 100; $i++){
3647 $posId = $position . '_' . $num;
3648 $viewPosId = self::POSITION_TAG_HEAD . $posId;
3649 if (!in_array($viewPosId, $this->viewPosId)) break;
3652 $this->viewPosId[] = $viewPosId;// IDを保存
3654 // ページ定義を取得。同じポジションが続く場合は最初の一度だけ定義を取得
3655 if (empty($this->pageDefPosition) || $position != $this->pageDefPosition){ // ポジションが異なる場合
3656 $ret = $this->db->getPageDef($filename, $subId, $position, $rows);
3657 if ($ret){ // 1行以上データが取得できたとき
3658 $this->pageDefRows = $rows; // ページ定義レコード
3659 $this->pageDefPosition = $position;
3661 $this->pageDefRows = array();
3662 $this->pageDefPosition = '';
3665 $contents .= '<div id="' . $viewPosId . '" class="m3_widgetpos_box" m3="pos:' . $position . ';rev:' . $rev . ';">' . M3_NL; // リビジョン番号を付加
3666 $contents .= '<h2 class="m3_widgetpos_box_title">' . $position . '</h2>' . M3_NL;
3669 $widgetTagHead = self::WIDGET_TAG_HEAD . $posId;
3670 $contents .= $this->getWidgetList($gEnvManager->getCurrentPageId(), $gEnvManager->getCurrentPageSubId(), $widgetTagHead, $this->pageDefRows);
3672 $contents .= '</div>' . M3_NL;
3675 $contents .= '<div style="background-color:#eee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">param error</div>';
3679 $this->viewPositions[] = $position;
3684 * ウィジェット共通のコンテンツ追加処理
3686 * @param string $src ウィジェット出力
3687 * @param array $pageDefParam 画面定義レコード
3688 * @return string コンテンツを付加したウィジェット出力
3690 function _addOptionContent($src, $pageDefParam)
3693 $dest = $pageDefParam['pd_top_content'] . $src . $pageDefParam['pd_bottom_content'];
3696 if ($pageDefParam['pd_show_readmore']){
3697 $title = $pageDefParam['pd_readmore_title'];
3698 if (empty($title)) $title = self::DEFAULT_READMORE_TITLE;
3699 $dest .= '<div><a href="' . convertUrlToHtmlEntity($pageDefParam['pd_readmore_url']) . '">' . convertToHtmlEntity($title) . '</a></div>';
3704 * BODYタグに付加するスタイルを取得(管理画面用)
3706 * @param string CSS文字列
3708 function getBodyStyle()
3710 // 画面透過モードのときスタイルを追加
3712 if ($this->isTransparentMode) $transCss = ' style="background-color:transparent;"';
3718 * @param string $position HTMLテンプレート上の書き出し位置
3719 * @return int コンテンツの数
3721 function getWidgetsCount($position)
3723 global $gRequestManager;
3724 global $gEnvManager;
3727 $cmd = $gRequestManager->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
3728 if ($cmd == M3_REQUEST_CMD_SHOW_POSITION_WITH_WIDGET){ // ウィジェット付きポジション表示
3729 return 1; // ウィジェットが設定されていないポジション名を表示するために固定で値を返す
3732 // 単一ポジション以外の設定のときは固定で返す(or等)
3733 $pos = strpos($position, ' ');
3734 if ($pos !== false) return 1;
3737 $filename = $gEnvManager->getCurrentPageId();
3738 $subId = $gEnvManager->getCurrentPageSubId();
3739 if (empty($subId)) $subId = $gEnvManager->getDefaultPageSubId();
3741 // 取得しようとするページ定義のポジションが既に取得しているポジションと異なるときはデータを取得
3742 if (empty($this->pageDefPosition) || $position != $this->pageDefPosition){ // 現在取得しているページ定義のポジション
3743 $ret = $this->db->getPageDef($filename, $subId, $position, $rows, 0/*定義セットIdデフォルト*/, true/*表示ウィジェットのみ*/);
3744 if ($ret){ // 1行以上データが取得できたとき
3745 $this->pageDefRows = $rows; // ページ定義レコード
3746 $this->pageDefPosition = $position;
3748 $this->pageDefRows = array();
3749 $this->pageDefPosition = '';
3752 return count($this->pageDefRows);
3757 * 画面作成機能でウィジェット情報を取得するためのAjaxインターフェイス
3759 * @param RequestManager $request HTTPリクエスト処理クラス
3761 function getWidgetInfoByAjax($request)
3763 global $gEnvManager;
3764 global $gDesignManager;
3765 global $gCacheManager;
3767 // アクセスするページIDからPC用、携帯用、スマートフォン用かを判断
3768 $widgetDeviceType = 0; // 端末タイプをPC用に初期化
3769 $pageId = $request->trimValueOf(M3_REQUEST_PARAM_DEF_PAGE_ID);
3770 $pageSubId = $request->trimValueOf(M3_REQUEST_PARAM_DEF_PAGE_SUB_ID);
3771 $mobilePageIdPrefix = M3_DIR_NAME_MOBILE . '_';
3772 $smartphonePageIdPrefix = M3_DIR_NAME_SMARTPHONE . '_';
3773 if (strncmp($pageId, $mobilePageIdPrefix, strlen($mobilePageIdPrefix)) == 0){
3774 $widgetDeviceType = 1; // 携帯用
3775 } else if (strncmp($pageId, $smartphonePageIdPrefix, strlen($smartphonePageIdPrefix)) == 0){
3776 $widgetDeviceType = 2; // スマートフォン用
3779 $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
3780 if ($task == 'list'){
3782 $ret = $this->db->getAvailableWidgetList($widgetDeviceType, $rows);
3784 for ($i = 0; $i < count($rows); $i++){
3785 $widgetId = $rows[$i]['wd_id'];
3786 $desc = $rows[$i]['wd_description'];
3787 $widgetTag = self::WIDGET_TYPE_TAG_HEAD . $widgetId;
3788 $image = $gDesignManager->getWidgetIconUrl($widgetId, self::WIDGET_ICON_IMG_SIZE);
3789 if ($gEnvManager->getUseSslAdmin()){
3790 //$image = str_replace('http://', 'https://', $image); // SSL通信の場合はSSL用に変換
3791 $image = $gEnvManager->getSslUrl($image);
3793 $imageTag = '<img class="' . self::WIDTET_CLASS_NAME . '" src="' . $image . '" ';
3794 $imageTag .= 'width="' . self::WIDGET_ICON_IMG_SIZE . '"';
3795 $imageTag .= ' height="' . self::WIDGET_ICON_IMG_SIZE . '"';
3797 echo '<dl class="m3_widgetlist_item" id="' . $widgetTag . '">' . M3_NL;
3798 echo '<dt>' . $rows[$i]['wd_name'] . '</dt>' . M3_NL; // ウィジェット名
3799 echo '<dd><table width="100%"><tr valign="top"><td width="35">' . $imageTag . '</td><td>' . $desc . '</td></tr></table></dd>' . M3_NL;
3800 echo '</dl>' . M3_NL;
3803 } else if ($task == 'wget' || $task == 'wdelete' || $task == 'wtoggle' || $task == 'wadd' || $task == 'wmove'){ // ウィジェット再取得、ウィジェット削除,ウィジェット共通属性変更、ウィジェット追加、ウィジェット移動のとき
3804 $rev = $request->trimValueOf('rev'); // リビジョン
3805 $serial = $request->trimValueOf('serial');
3806 $position = $request->trimValueOf('pos');
3807 $widgetsStr = $request->trimValueOf('widgets');
3808 if (empty($widgetsStr)){
3811 $widgets = explode(',', $widgetsStr);
3813 $shared = $request->trimValueOf('shared');
3814 $updatepos = explode(',', $request->trimValueOf('updatepos'));
3815 $index = $request->trimValueOf('index');
3818 if ($task == 'wmove'){
3819 $positions = explode(',', $position);
3820 if (count($positions) >= 2){
3821 $position = $positions[0];
3822 $position2 = $positions[1];
3824 $position = $positions[0];
3828 // ##### エラーチェック #####
3831 $rev = '111'; // データのリビジョン番号
3834 $ret = $this->db->getPageDef($pageId, $pageSubId, $position, $rows); // 0レコードでも正常とする
3836 // 変更前のウィジェットのシリアル番号をチェック
3837 if (count($widgets) == count($rows)){
3838 if (!($task == 'wmove' && empty($position2))){ // 同一ブロック内の移動の場合はチェックなし
3839 for ($i = 0; $i < count($rows); $i++){
3840 if ($widgets[$i] != $rows[$i]['pd_serial']){// シリアル番号
3851 if (!$isErr){ // エラーなしのとき
3852 if ($task == 'wdelete'){
3853 $ret = $this->db->deleteWidget($serial);
3854 } else if ($task == 'wtoggle'){
3856 if (empty($shared)) $newShared = 1;
3857 $ret = $this->db->toggleSharedWidget($pageId, $pageSubId, $serial, $newShared);
3858 } else if ($task == 'wadd'){ // ウィジェットの追加
3859 $widget = $request->trimValueOf('widget');
3862 if (empty($widget)) $isErr = true;
3865 if (!$isErr) $this->db->addWidget($pageId, $pageSubId, $position, $widget, $index);
3866 } else if ($task == 'wmove'){
3868 if (!$isErr) $this->db->moveWidget($pageId, $pageSubId, $position, $serial, $index);
3872 $ret = $this->db->getPageDef($pageId, $pageSubId, $position, $rows);// 0レコードでも正常とする
3874 // 移動のときは、移動元と移動先の再表示データを取得
3875 if ($task == 'wmove' && !empty($position2)){
3876 $ret = $this->db->getPageDef($pageId, $pageSubId, $position2, $rows2);// 0レコードでも正常とする
3881 echo '<div>' . M3_NL;
3882 for ($i = 0; $i < count($updatepos); $i++){
3884 $widgetTagHead = str_replace(self::POSITION_TAG_HEAD, self::WIDGET_TAG_HEAD, $updatepos[$i]);
3887 $posName = str_replace(self::POSITION_TAG_HEAD, '', substr($updatepos[$i], 0, strlen($updatepos[$i]) - strlen(strrchr($updatepos[$i], "_"))));
3888 if ($task == 'wmove' && $posName == $position2){
3890 echo '<div id="' . $updatepos[$i] . '" class="m3_widgetpos_box" m3="pos:' . $position2 . ';rev:' . $rev . ';">' . M3_NL; // リビジョン番号を付加
3891 echo '<h2 class="m3_widgetpos_box_title">' . $position2 . '</h2>' . M3_NL;
3894 echo $this->getWidgetList($pageId, $pageSubId, $widgetTagHead, $rows2);
3897 echo '<div id="' . $updatepos[$i] . '" class="m3_widgetpos_box" m3="pos:' . $position . ';rev:' . $rev . ';">' . M3_NL; // リビジョン番号を付加
3898 echo '<h2 class="m3_widgetpos_box_title">' . $position . '</h2>' . M3_NL;
3901 echo $this->getWidgetList($pageId, $pageSubId, $widgetTagHead, $rows);
3904 echo '</div>' . M3_NL;
3906 echo '</div>' . M3_NL;
3909 $gCacheManager->clearAllCache();
3913 * 画面作成用ウィジェット一覧データ出力
3915 * @param string $pageId ページID
3916 * @param string $pageSubId ページサブID
3917 * @param string $widgetTagHead HTMLウィジェットID用のヘッダ
3918 * @param array $rows ウィジェット一覧データ
3919 * @return string ウィジェット一覧出力
3921 function getWidgetList($pageId, $pageSubId, $widgetTagHead, $rows)
3923 global $gEnvManager;
3924 global $gDesignManager;
3925 global $gSystemManager;
3927 if ($gEnvManager->getUseSslAdmin()){
3928 $rootUrl = $gEnvManager->getSslRootUrl();
3930 $rootUrl = $gEnvManager->getRootUrl();
3934 $line = $this->getPageInfo($pageId, $pageSubId);
3935 if (!empty($line)) $pageContentType = $line['pn_content_type'];
3937 $contents = ''; // ウィジェット一覧出力コンテンツ
3938 for ($i = 0; $i < count($rows); $i++){
3939 $widgetId = $rows[$i]['wd_id'];
3940 $desc = $rows[$i]['wd_description'];
3941 $widgetIndex = $rows[$i]['pd_index']; // 表示順
3942 $configId = $rows[$i]['pd_config_id']; // 定義ID
3943 $serial = $rows[$i]['pd_serial']; // シリアル番号
3944 $widgetTag = $widgetTagHead . '_' . $i; // ウィジェット識別用ユニークタグ
3945 $image = $gDesignManager->getWidgetIconUrl($widgetId, self::WIDGET_ICON_IMG_SIZE);
3946 if ($gEnvManager->getUseSslAdmin()){
3947 //$image = str_replace('http://', 'https://', $image); // SSL通信の場合はSSL用に変換
3948 $image = $gEnvManager->getSslUrl($image);
3950 $imageTag = '<img class="' . self::WIDTET_CLASS_NAME . '" src="' . $image . '" ';
3951 $imageTag .= 'width="' . self::WIDGET_ICON_IMG_SIZE . '"';
3952 $imageTag .= ' height="' . self::WIDGET_ICON_IMG_SIZE . '"';
3955 if (empty($rows[$i]['pd_config_name'])){
3956 if ($rows[$i]['wd_use_instance_def'] && $configId == 0){ // インスタンス定義が必要で未定義のとき
3957 $configName = '<span style="color:red;">[未設定]</span>';
3962 $configName = '[' . $rows[$i]['pd_config_name'] . ']';
3964 $hasAdmin = '0'; // 管理画面があるかどうか
3965 $configImg = ''; // 設定アイコンの表示
3967 // ウィジェットの配置位置に問題があるかどうかを表示
3968 // メインコンテンツとページ属性が一致するかどうかチェック
3969 $widgetContentType = $rows[$i]['wd_content_type'];
3970 if (!empty($widgetContentType) && $widgetContentType != $pageContentType &&
3971 (in_array($widgetContentType, $this->_getAllContentType()) || in_array($widgetContentType, $this->_getAllFeatureType()))){
3972 //$title = 'ウィジェット配置注意';
3973 $title = 'ページ属性と不一致';
3974 $configImg .= '<img src="' . $rootUrl . self::NOTICE_ICON_FILE . '" alt="' . $title . '" title="' . $title . '" /> ';
3976 if ($rows[$i]['wd_has_admin']){
3978 $title = 'ウィジェット設定';
3979 $configImg .= '<a href="javascript:void(0);" onclick="m3ShowConfigWindow(\'' . $widgetId . '\', \'' . $configId . '\', \'' . $serial . '\');return false;" >' .
3980 '<img src="' . $rootUrl . self::CONFIG_ICON_FILE . '" alt="' . $title . '" title="' . $title . '" /></a> ';
3982 $shared = '0'; // 共通属性があるかどうか
3983 $sharedClassName = '';
3984 if (empty($rows[$i]['pd_sub_id'])){
3985 $shared = '1'; // 共通ウィジェットのとき
3986 $sharedClassName = 'm3_widget_shared'; // 共通ウィジェットのクラス
3988 $m3Option = 'm3="widgetid:' . $widgetId . '; serial:' . $serial . '; configid:' . $configId . '; useconfig:' . $hasAdmin . '; shared:' . $shared . '"';
3989 $contents .= '<dl class="m3_widget m3_widget_sortable" id="' . $widgetTag . '" ' . $m3Option . ' >' . M3_NL;
3990 $contents .= '<dt class="m3_widget_with_check_box ' . $sharedClassName . '">' . $rows[$i]['wd_name'] . '</dt>' . M3_NL;
3991 $contents .= '<dd><table width="100%"><tr valign="top"><td width="35">' . $imageTag . '</td><td>' . $desc . '</td></tr></table>' . M3_NL;
3992 $contents .= '<table width="100%"><tr><td>' . $configName . '</td><td align="right">' . $configImg . $widgetIndex . '</td></tr></table></dd>' . M3_NL;
3993 $contents .= '</dl>' . M3_NL;
4000 * @param int $index 行番号
4001 * @param array $fetchedRow fetch取得した行
4002 * @param string $style ウィジェットの表示スタイル(空の場合=Joomla!v1.0テンプレート用、空以外=Joomla!v1.5テンプレート用)
4003 * @param string $titleTag タイトル埋め込み用タグ(遅延ウィジェットの場合のみ作成)
4004 * @param int $widgetHeaderType ウィジェットタイトルを出力方法(0=出力なし、1=Joomla!v1.0PC用出力、2=Joomla!v1.0携帯用出力)
4005 * @return bool 処理を継続するかどうか(true=続行、false=中断)
4007 function pageDefLoop($index, $fetchedRow, $style, &$titleTag, $widgetHeaderType = 0)
4009 global $gEnvManager;
4010 global $gErrorManager;
4011 global $gDesignManager;
4014 if ($this->isAbort) return false;
4016 // ウィジェット実行停止中のときは空で返す
4017 // 管理者、運営者どのレベルで制限をかける?
4018 if (!$fetchedRow['wd_active']) return true;
4020 // ページ共通属性ありの場合は現在のページが例外ページにないかチェック
4021 if (empty($fetchedRow['pd_sub_id'])){
4022 $exceptPageStr = $fetchedRow['pd_except_sub_id'];
4023 if (!empty($exceptPageStr)){
4024 $exceptPageArray = explode(',', $exceptPageStr);
4025 if (in_array($gEnvManager->getCurrentPageSubId(), $exceptPageArray)) return true; // 例外ページの場合は出力しない
4029 // ウィジェット表示タイプによる表示制御。システム管理者以上の場合は常時表示。
4030 if (!$gEnvManager->isSystemAdmin() && $fetchedRow['pd_view_control_type'] != 0){
4031 switch ($fetchedRow['pd_view_control_type']){
4032 case 1: // ログイン時のみ表示
4033 if (!$gEnvManager->isCurrentUserLogined()) return true; // ログインしていなければ終了
4035 case 2: // 非ログイン時のみ表示
4036 if ($gEnvManager->isCurrentUserLogined()) return true; // ログインしていれば終了
4047 $widgetId = $fetchedRow['wd_id'];
4048 $widgetIndexFile = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/index.php';
4051 $configId = $fetchedRow['pd_config_id']; // ウィジェット定義ID
4052 if ($configId == 0) $configId = '';
4053 $prefix = $fetchedRow['wd_suffix']; // サフィックス文字列
4054 $title = $fetchedRow['wd_name']; // デフォルトのウィジェットタイトル
4055 if (empty($title)) $title = $fetchedRow['wd_id'];
4056 $serial = $fetchedRow['pd_serial']; // シリアル番号
4057 $cssStyle = $fetchedRow['pd_style']; // CSS
4058 $lateLaunchIndex = $fetchedRow['wd_launch_index']; // 遅延実行インデックス
4060 if (empty($fetchedRow['pd_sub_id'])) $shared = true;// 共通属性あり
4061 if ($this->nonSharedWidgetCount == -1) $this->nonSharedWidgetCount = 0; // 初期化されていない場合は初期化
4062 if (!$shared) $this->nonSharedWidgetCount++; // 非共通ウィジェットの数を更新
4064 // ウィジェットが遅延実行に指定されている場合は、ウィジェットのタグのみ埋め込む
4065 if ($lateLaunchIndex > 0){ // 遅延実行のとき
4067 if (!isset($this->lateLaunchWidgetList[$widgetId])){
4068 $this->lateLaunchWidgetList[$widgetId] = (int)$lateLaunchIndex;
4071 $maxNo = 0; // 最大シリアル番号
4072 $count = count($this->latelaunchWidgetParam);
4073 for ($i = 0; $i < $count; $i++){
4074 list($wId, $index, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $tmp6, $tmp7) = $this->latelaunchWidgetParam[$i];
4075 if ($wId == $widgetId) $maxNo = $index + 1;
4077 // Joomla!1.0テンプレートの場合はタイトルを修正
4078 if ($widgetHeaderType > 0 && empty($style)){ // Joomla!1.0テンプレートのとき
4079 if (!empty($fetchedRow['pd_title'])) $title = $fetchedRow['pd_title'];
4081 $this->latelaunchWidgetParam[] = array($widgetId, $maxNo, $configId, $prefix, $serial, $style, $cssStyle, $title, $shared);
4084 echo self::WIDGET_ID_TAG_START . $widgetId . self::WIDGET_ID_SEPARATOR . $maxNo . self::WIDGET_ID_TAG_END;
4087 $titleTag = self::WIDGET_ID_TITLE_TAG_START . $widgetId . self::WIDGET_ID_SEPARATOR . $maxNo . self::WIDGET_ID_TITLE_TAG_END;
4090 if (!file_exists($widgetIndexFile)) {
4091 echo 'widget not found error: ' . $widgetId;
4094 $this->lastHeadCss = ''; // 最後に設定したHTMLヘッダにCSS出力する文字列
4095 $this->lastHeadScript = ''; // 最後に設定したHTMLヘッダにJavascript出力する文字列
4096 $this->lastHeadString = ''; // 最後に設定したHTMLヘッダに出力する任意文字列
4097 $this->lastHeadTitle = ''; // ヘッダ部titleにセットした文字列
4098 $this->lastHeadDescription = ''; // ヘッダ部descriptionにセットした文字列
4099 $this->lastHeadKeywords = ''; // ヘッダ部keywordsにセットした文字列
4101 // Joomla!1.0テンプレートのときはウィジェットタイトルを出力
4102 $joomlaTitleVisble = false;
4103 if ($widgetHeaderType > 0 && empty($style)){ // Joomla!1.0テンプレートのとき
4104 if ($fetchedRow['pd_title_visible']){
4105 if ($widgetHeaderType == 1){ // PC用出力のとき
4106 $joomlaTitle = $fetchedRow['pd_title'];
4107 if (empty($joomlaTitle)) $joomlaTitle = $title;
4108 echo '<table ' . self::JOOMLA10_DEFAULT_WIDGET_MENU_PARAM . '>' . M3_NL;
4109 echo '<tr><th>' . $joomlaTitle . '</th></tr>' . M3_NL;
4110 echo '<tr><td>' . M3_NL;
4111 $joomlaTitleVisble = true;
4112 } else if ($widgetHeaderType == 2){ // 携帯用出力のとき
4113 $joomlaTitle = $fetchedRow['pd_title'];
4114 if (empty($joomlaTitle)) $joomlaTitle = $title;
4115 echo '<div>' . $joomlaTitle . '</div>' . M3_NL;
4116 $joomlaTitleVisble = true;
4121 //echo '<div class="' . self::WIDGET_TAG_HEAD_SHORT . $widgetId . '">' . M3_NL;
4122 // ウィジェット親のCSS定義があるときは、タグを追加
4123 if (!empty($cssStyle)) echo '<div style="' . $cssStyle . '">' . M3_NL;
4126 echo $gDesignManager->getAdditionalWidgetOutput(true);
4129 $gEnvManager->setCurrentWidgetId($widgetId);
4132 $gEnvManager->setCurrentWidgetConfigId($configId);
4135 $gEnvManager->setCurrentPageDefSerial($fetchedRow['pd_serial']);
4138 $gEnvManager->setCurrentWidgetPrefix($prefix); // プレフィックス文字列
4141 $gEnvManager->setCurrentWidgetTitle($title);
4143 // ウィジェットのページ共通状況を設定
4144 $gEnvManager->setIsCurrentWidgetShared($shared);
4147 $this->db->writeWidgetLog($widgetId, 0/*ページ実行*/);
4150 //require_once($widgetIndexFile);
4151 // ウィジェットの呼び出しは、複数回存在する可能性があるのでrequire_once()で呼び出さない
4152 $msg = 'widget-start(' . $widgetId . ')';
4153 $gErrorManager->writeDebug(__METHOD__, $msg); // 時間計測用
4154 require($widgetIndexFile);
4155 $msg = 'widget-end(' . $widgetId . ')';
4156 $gErrorManager->writeDebug(__METHOD__, $msg); // 時間計測用
4159 $gEnvManager->setCurrentWidgetId('');
4162 $gEnvManager->setCurrentWidgetConfigId('');
4165 $gEnvManager->setCurrentPageDefSerial(0);
4168 $gEnvManager->setCurrentWidgetPrefix(''); // プレフィックス文字列
4170 // ウィジェットのページ共通状況を解除
4171 $gEnvManager->setIsCurrentWidgetShared(false);
4174 echo $gDesignManager->getAdditionalWidgetOutput(false);
4175 // echo "<!-- ".time()." -->";
4177 // ウィジェット親のCSS定義があるときは、タグを追加
4178 if (!empty($cssStyle)) echo '</div>' . M3_NL;
4180 //echo '</div>' . M3_NL;
4182 // Joomla!1.0テンプレートのときはタイトルを出力
4183 if ($joomlaTitleVisble && $widgetHeaderType == 1){ // PC用出力のとき
4184 echo '</td></tr>' . M3_NL;
4185 echo '</table>' . M3_NL;
4189 return true; // 処理継続
4192 * 定義IDを指定してウィジェットの出力を取得
4194 * @param string $widgetId ウィジェットID
4195 * @param int $configId ウィジェット定義ID
4196 * @return string ウィジェットの出力
4198 function getWidgetOutput($widgetId, $configId)
4200 global $gEnvManager;
4201 global $gErrorManager;
4203 // ウィジェットのアクセス権をチェック
4204 if (!$this->db->canAccessWidget($widgetId)) return '';
4207 if (!$this->db->getWidgetInfo($widgetId, $row)) return '';
4210 if (intval($row['wd_device_type']) != intval($gEnvManager->getCurrentPageDeviceType())) return '';
4212 // 必要なJavascriptライブラリを追加
4213 $scritLib = trim($row['wd_add_script_lib']);
4214 if (!empty($scritLib)) $this->addScript('', $scritLib);
4220 $widgetIndexFile = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/index.php';
4223 $saveWidgetId = $gEnvManager->getCurrentWidgetId();
4224 $gEnvManager->setCurrentWidgetId($widgetId);
4227 $saveConfigId = $gEnvManager->getCurrentWidgetConfigId();
4228 $gEnvManager->setCurrentWidgetConfigId($configId);
4231 //$gEnvManager->setCurrentPageDefSerial(0); // 未使用?
4234 //$gEnvManager->setCurrentWidgetPrefix($prefix); // プレフィックス文字列
4237 //$gEnvManager->setCurrentWidgetTitle($title);
4239 // ウィジェットのページ共通状況を設定
4240 //$gEnvManager->setIsCurrentWidgetShared($shared);
4243 $this->db->writeWidgetLog($widgetId, 0/*ページ実行*/);
4246 //require_once($widgetIndexFile);
4247 // ウィジェットの呼び出しは、複数回存在する可能性があるのでrequire_once()で呼び出さない
4248 $msg = 'widget-start(' . $widgetId . ')';
4249 $gErrorManager->writeDebug(__METHOD__, $msg); // 時間計測用
4250 if (file_exists($widgetIndexFile)){
4251 require($widgetIndexFile);
4253 echo 'widget not found error: ' . $widgetId;
4255 $msg = 'widget-end(' . $widgetId . ')';
4256 $gErrorManager->writeDebug(__METHOD__, $msg); // 時間計測用
4259 $gEnvManager->setCurrentWidgetId($saveWidgetId);
4262 $gEnvManager->setCurrentWidgetConfigId($saveConfigId);
4265 //$gEnvManager->setCurrentPageDefSerial(0); // 未使用?
4268 //$gEnvManager->setCurrentWidgetPrefix(''); // プレフィックス文字列
4270 // ウィジェットのページ共通状況を解除
4271 //$gEnvManager->setIsCurrentWidgetShared(false);
4273 // 現在のバッファ内容を取得し、バッファを破棄
4274 $output = ob_get_contents();
4282 * @param int $cmdNo 実行コマンド(0=初期化、1=更新、2=計算、10=コンテンツ取得)
4283 * @param string $id ウィジェットID+インナーウィジェットID
4284 * @param string $configId インナーウィジェット定義ID
4285 * @param object $paramObj インナーウィジェットに渡すパラメータオブジェクト
4286 * @param object $optionParamObj インナーウィジェットに渡すパラメータオブジェクト(オプション)
4287 * @param object $resultObj インナーウィジェットから返る結果オブジェクト
4288 * @param string $content 出力内容
4289 * @param bool $isAdmin 管理者機能(adminディレクトリ以下)かどうか
4290 * @return bool true=成功、false=失敗
4292 function commandIWidget($cmdNo, $id, $configId, &$paramObj, &$optionParamObj, &$resultObj, &$content, $isAdmin = false)
4294 global $gEnvManager;
4296 // ウィジェットIDとインナーウィジェットIDを取り出す
4297 list($widgetId, $iWidgetId) = explode(M3_WIDGET_ID_SEPARATOR, $id);
4299 // インナーウィジェットに渡すパラメータを設定
4302 $cmd = self::IWIDTET_CMD_INIT; // 初期化
4303 $this->gInstance->getCmdParamManager()->setParam($id . M3_WIDGET_ID_SEPARATOR . $configId, $cmd, $paramObj, $optionParamObj);
4306 $cmd = self::IWIDTET_CMD_UPDATE; // 更新
4307 $this->gInstance->getCmdParamManager()->setParam($id . M3_WIDGET_ID_SEPARATOR . $configId, $cmd); // 設定されているパラメータの更新は行わない
4310 $cmd = self::IWIDTET_CMD_CALC; // 計算
4311 $this->gInstance->getCmdParamManager()->setParam($id . M3_WIDGET_ID_SEPARATOR . $configId, $cmd, $paramObj, $optionParamObj);
4314 $cmd = self::IWIDTET_CMD_CONTENT; // コンテンツ取得
4315 $this->gInstance->getCmdParamManager()->setParam($id . M3_WIDGET_ID_SEPARATOR . $configId, $cmd); // 設定されているパラメータの更新は行わない
4319 $this->gInstance->getCmdParamManager()->setParam($id . M3_WIDGET_ID_SEPARATOR . $configId, $cmd, $paramObj, $optionParamObj);
4323 // インナーウィジェットのエラー出力は呼び出しウィジェット側で受けるため、出力を抑止する
4324 ob_start();// バッファ作成
4327 if (empty($widgetId)){ // ウィジェットIDが指定されていないときは共通ディレクトリ
4328 //$gEnvManager->getIWidgetsPath() . '/' . $iWidgetId . '/' . $containerClass . '.php';
4331 $widgetIndexFile = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId . '/' . M3_DIR_NAME_ADMIN . '/index.php';
4333 $widgetIndexFile = $gEnvManager->getWidgetsPath() . '/' . $widgetId . '/include/iwidgets/' . $iWidgetId . '/index.php';
4337 // 作業中のインナーウィジェットIDを設定
4338 $gEnvManager->setCurrentIWidgetId($id); // インナーウィジェットを設定
4340 // インナーウィジェット定義IDを設定
4341 $gEnvManager->setCurrentIWidgetConfigId($configId);
4344 // ウィジェットの呼び出しは、複数回存在する可能性があるのでrequire_once()で呼び出さない
4345 if (file_exists($widgetIndexFile)){
4346 require($widgetIndexFile);
4348 echo 'file not found error: ' . $widgetIndexFile;
4352 $gEnvManager->setCurrentIWidgetId('');
4354 // インナーウィジェット定義IDを解除
4355 $gEnvManager->setCurrentIWidgetConfigId('');
4357 // 現在のバッファ内容を取得し、バッファを破棄
4358 $content = ob_get_contents();
4362 if ($this->gInstance->getCmdParamManager()->getParam($id . M3_WIDGET_ID_SEPARATOR . $configId, $cmd, $obj, $option)){
4364 $optionParamObj = $option;
4368 if ($this->gInstance->getCmdParamManager()->getResult($id . M3_WIDGET_ID_SEPARATOR . $configId, $resObj)) $resultObj = $resObj;
4372 * コールバックメソッドを実行し、出力を返す
4374 * @param array $callback 実行するコールバック
4375 * @return string 出力結果
4377 function getOutputByCallbackMethod($callback)
4379 ob_start();// バッファ作成
4382 if (is_callable($callback)) call_user_func($callback);
4384 // 現在のバッファ内容を取得し、バッファを破棄
4385 $content = ob_get_contents();
4390 * ページ作成処理中断を行った場合のレスポンスヘッダ設定
4392 * @param int $responseCode レスポンスコード
4395 function setResponse($responseCode)
4397 switch ($responseCode){
4398 case 503: // サイト非公開(システムメンテナンス)
4399 header('HTTP/1.1 503 Service Temporarily Unavailable');
4400 header('Status: 503 Service Temporarily Unavailable');
4402 case 403: // アクセス禁止のとき
4403 header('HTTP/1.1 403 Forbidden');
4404 header('Status: 403 Forbidden');
4406 case 404: // 存在しないページのとき
4407 header("HTTP/1.1 404 Not Found");
4408 header("Status: 404 Not Found");
4415 * @param string $filePath ダウンロードするファイルのファイルパス
4416 * @param string $downloadFilename ダウンロード時のファイル名
4417 * @param bool $deleteFile 実行後ファイルを削除するかどうか(成功失敗に関係なく)
4418 * @return bool true=成功、false=失敗
4420 function downloadFile($filePath, $downloadFilename, $deleteFile=false)
4423 if (!file_exists($filePath)) return false;
4426 $fileSize = filesize($filePath);
4428 // バッファ内容が残っているときは破棄
4429 if (ob_get_level() > 0) ob_end_clean();
4431 header('Cache-Control: public'); // IE6+SSHでダウンロードエラーが出る問題を回避
4432 header('Pragma: public'); // IE6+SSHでダウンロードエラーが出る問題を回避
4433 header('Content-Disposition: attachment; filename=' . $downloadFilename);
4434 header('Content-Length: ' . $fileSize);
4435 header('Content-Type: application/octet-stream; name=' . $downloadFilename);
4436 $fp = fopen($filePath, "r");
4437 echo fread($fp, $fileSize);
4443 if ($deleteFile) unlink($filePath);
4449 * @param string $url 遷移先URL。未指定の場合は現在のスクリプト。URLでないときは、現在のスクリプトに付加。
4450 * @param bool $noMessage 画面を遷移させたとき、ドコモ携帯端末でダイアログ(サイトが移動しました(301))が出ないようにするオプション
4451 * @param int $responseCode レスポンスコード
4454 function redirect($url = '', $noMessage = false, $responseCode = 0)
4456 global $gEnvManager;
4458 // すでにリダイレクトが設定されている場合は終了
4459 if ($this->isRedirect) return; // リダイレクトするかどうか
4463 $toUrl = $gEnvManager->getCurrentScriptUrl();
4464 } else if (strncmp($toUrl, 'http://', 7) != 0 && strncmp($toUrl, 'https://', 8) != 0){ // URL以外のときはクエリー文字列と判断する
4465 $toUrl = $gEnvManager->getCurrentScriptUrl() . $toUrl;
4468 // SSL化が必要な場合はhttpsに変更
4470 if ($gEnvManager->isAdminUrlAccess($toUrl)){ // 管理画面へのアクセスのとき
4472 if ($gEnvManager->getUseSslAdmin()) $isSslPage = true; // 管理画面でSSLを使用するとき
4475 $paramArray = array();
4476 //list($filename, $query) = explode('?', basename($toUrl));
4477 list($url, $query) = explode('?', $toUrl);
4478 $baseUrl = dirname($url);
4479 $filename = basename($url);
4480 if (empty($filename)) $filename = M3_FILENAME_INDEX;
4481 if (!empty($query)) parse_str($query, $paramArray); // クエリーの解析
4484 $pageId = basename($filename, '.php');
4485 $pageSubId = $paramArray[M3_REQUEST_PARAM_PAGE_SUB_ID];
4488 $isSslPage = $this->isSslPage($pageId, $pageSubId);
4491 if ($this->gSystem->hierarchicalPage() && $filename == M3_FILENAME_INDEX){
4492 $toUrl = $baseUrl . '/' . $pageSubId . '/';
4493 unset($paramArray[M3_REQUEST_PARAM_PAGE_SUB_ID]);
4495 $paramStr = $this->_createUrlParamStr($paramArray);
4496 if (!empty($paramStr)) $toUrl .= '?' . $paramStr;
4500 //$toUrl = str_replace('http://', 'https://', $toUrl);
4501 $toUrl = $gEnvManager->getSslUrl($toUrl); // SSL用URLに変換
4503 $toUrl = str_replace('https://', 'http://', $toUrl);
4506 // バッファ内容が残っているときは破棄
4507 if (ob_get_level() > 0) ob_end_clean();
4509 if (empty($responseCode)){
4511 header('HTTP/1.1 302 Found(Moved Temporary)'); // ダイアログメッセージを抑止(ドコモ携帯端末用)
4513 header('HTTP/1.1 301 Moved Permanently');
4515 } else { // レスポンスコードが指定されている場合
4516 switch ($responseCode){
4518 header('HTTP/1.1 301 Moved Permanently');
4521 header('HTTP/1.1 302 Found(Moved Temporary)'); // ダイアログメッセージを抑止(ドコモ携帯端末用)
4524 header('HTTP/1.1 303 See Other');
4527 header('HTTP/1.1 ' . (string)$responseCode);
4531 header('Location: ' . $toUrl);
4533 $this->isRedirect = true; // リダイレクトするかどうか
4539 * @return bool true=リダイレクト、false=リダイレクトでない
4541 function isRedirect()
4543 return $this->isRedirect;
4546 * 指定URLのディレクトリへリダイレクト
4550 function redirectToDirectory()
4552 global $gEnvManager;
4555 $dirPath = dirname($gEnvManager->getCurrentScriptUrl()) . '/';
4556 //$this->redirect($dirPath);
4557 $this->redirect($dirPath, false, 303); // Firefoxでredirect先がキャッシュに残る問題を回避(2012/7/23)
4564 function redirectToInstall()
4566 global $gEnvManager;
4568 $sytemRootUrl = $gEnvManager->calcSystemRootUrl();
4569 //$this->redirect($sytemRootUrl . '/admin/install.php');
4570 $this->redirect($sytemRootUrl . '/admin/install.php', false, 303); // Firefoxでredirect先がキャッシュに残る問題を回避(2012/8/1)
4573 * ログイン、ログアウト処理を行った後、リダイレクト
4575 * @param RequestManager $request HTTPリクエスト処理クラス
4576 * @param bool $success ログインの成否
4577 * @param string $redirectUrl ログイン成功の場合のリダイレクト先
4578 * @return int 0=何も処理しなかった場合、1=ログイン処理、2=ログアウト処理、3=パスワード送信
4580 function standardLoginLogoutRedirect($request, &$success, $redirectUrl = '')
4582 global $gEnvManager;
4583 global $gAccessManager;
4584 global $gRequestManager;
4586 // ログイン、ログアウト処理、および、コンテナの起動
4587 $cmd = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_COMMAND);
4588 if ($cmd == M3_REQUEST_CMD_LOGIN){ // ログインの場合
4589 $act = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_ACT);
4590 if ($act == 'sendpwd'){ // パスワード送信の場合
4591 $success = $gAccessManager->sendPassword($request);
4595 $ret = $gAccessManager->userLogin($request);
4597 if (empty($redirectUrl)){
4598 // システム運用可能ユーザの場合でリダイレクト先が設定されていない場合はデフォルトの管理画面URLへ遷移
4599 $userInfo = $gEnvManager->getCurrentUserInfo();// ユーザ情報取得
4600 if ($userInfo->userType >= UserInfo::USER_TYPE_MANAGER){
4601 $ret = $this->db->getLoginUserRecordById($userInfo->userId, $userInfoRow);
4602 if ($ret && !empty($userInfoRow['lu_default_admin_url'])){
4603 $redirectUrl = $gEnvManager->getDefaultAdminUrl() . $userInfoRow['lu_default_admin_url'];
4609 $this->redirect($redirectUrl);
4610 $success = true; // ログイン成功
4611 } else { // ログイン失敗のとき
4612 $success = false; // ログイン失敗
4616 } else if ($cmd == M3_REQUEST_CMD_LOGOUT){ // ログアウト
4618 $gAccessManager->userLogout(true);
4621 $this->redirect($redirectUrl);
4628 * ウィジェットがセットされているページサブIDを取得
4630 * @param string $pageId ページID
4631 * @param string $widgetId 対象ウィジェットID
4632 * @param int $configId ウィジェット定義ID
4633 * @return string ページサブID
4635 function getPageSubIdByWidget($pageId, $widgetId, $configId = 0)
4639 // 対象のウィジェットのページサブIDを取得
4640 $ret = $this->db->getSubPageId($widgetId, $pageId, $rows);
4641 if ($ret){// データが存在する
4642 for ($i = 0; $i < count($rows); $i++){
4643 if (!empty($rows[$i]['pd_sub_id']) && $rows[$i]['pd_config_id'] == $configId){
4644 $pageSubId = $rows[$i]['pd_sub_id'];
4652 * その他のGET,POSTパラメータからページサブID取得
4654 * @param RequestManager $request HTTPリクエスト処理クラス
4655 * @param string $pageId ページID
4656 * @return string ページサブID
4658 function getPageSubIdByParam($request, $pageId)
4661 $task = $request->trimValueOf('task');
4662 $option = $request->trimValueOf('option');
4663 if ($task == 'search' && $option == 'com_search'){ // joomla!の検索結果表示の場合
4664 $subId = $this->db->getSubPageIdWithContent(M3_VIEW_TYPE_SEARCH, $pageId);// ページサブIDを取得
4665 $this->contentType = M3_VIEW_TYPE_SEARCH; // ページのコンテンツタイプ
4670 * コンテンツタイプとページIDからページサブID取得
4672 * @param string $contentType コンテンツタイプ
4673 * @param string $pageId ページID
4674 * @return string ページサブID
4676 function getPageSubIdByContentType($contentType, $pageId)
4678 $subId = $this->db->getSubPageIdWithContent($contentType, $pageId);// ページサブIDを取得
4682 * 指定のウィジェットがページ上にあるかを取得
4684 * @param string $pageId ページID
4685 * @param string $widgetId 対象ウィジェットID
4686 * @param bool $activePageOnly 公開中のページのウィジェットに制限するかどうか。falseの場合はすべてのページのウィジェットを対象とする。
4687 * @return bool true=ページ上にあり、false=ページ上になし
4689 function isWidgetOnPage($pageId, $widgetId, $activePageOnly=true)
4691 $ret = $this->db->isWidgetOnPage($pageId, $widgetId, $activePageOnly, 0/*定義セットID*/);
4695 * URLで示されるページ上のウィジェットをウィジェット種別で取得
4697 * @param string $url URL
4698 * @param string $widgetType 対象ウィジェットタイプ
4699 * @return string ウィジェットID
4701 function getWidgetIdByWidgetType($url, $widgetType)
4703 $ret = $this->getPageIdFromUrl($url, $pageId, $pageSubId, $param);
4706 if ($ret) $widgetId = $this->db->getWidgetIdByType($pageId, $pageSubId, $widgetType);
4710 * 現在アクティブなメインウィジェットをウィジェット種別で取得
4712 * @param string $widgetType 対象ウィジェットタイプ
4713 * @return string ウィジェットID
4715 function getActiveMainWidgetIdByWidgetType($widgetType)
4718 $widgetId = $this->db->getActiveMainWidgetIdByType($widgetType);
4722 * URLを解析して、ページID,サブページIDを取得
4724 * @param string $url URL
4725 * @param string $pageId ページID
4726 * @param string $pageSubId ページサブID
4727 * @param array $urlParam URLパラメータ
4728 * @return bool true=成功、false=失敗
4730 function getPageIdFromUrl($url, &$pageId, &$pageSubId, &$urlParam)
4732 global $gEnvManager;
4734 // ページID、ページサブIDを求める
4735 list($page, $other) = explode('?', str_replace($gEnvManager->getRootUrl(), '', $url));
4736 parse_str($other, $urlParam);
4738 $pageId = str_replace('/', '_', trim($page, '/'));
4739 $pageId = basename($pageId, '.php');
4742 $pageSubId = $param[M3_REQUEST_PARAM_PAGE_SUB_ID];
4743 if (empty($pageSubId)) $pageSubId = $gEnvManager->getDefaultPageSubId();
4747 * ウィジェットが組み込まれているページのURLを生成
4749 * @param string $widgetId 送信元ウィジェットID
4750 * @param string $param 実行パラメータ
4751 * @param string $pageId ウィジェットが存在するページID
4752 * @return string 生成したURL
4754 function getDefaultPageUrlByWidget($widgetId, $param = '', $pageId = '')
4756 global $gEnvManager;
4758 if (empty($pageId)) $pageId = $gEnvManager->getDefaultPageId();
4760 // このウィジェットがマップされているページサブIDを取得
4762 $subPageId = $this->getPageSubIdByWidget($pageId, $widgetId);
4763 if (empty($subPageId)){
4764 // 見つからないときは互換ウィジェットを探す
4765 $targetWidgetId = $this->db->getCompatibleWidgetId($widgetId);
4766 if (!empty($targetWidgetId)){
4767 $subPageId = $this->getPageSubIdByWidget($pageId, $targetWidgetId);
4770 if (!empty($subPageId)) $sub = M3_REQUEST_PARAM_PAGE_SUB_ID . '=' . $subPageId;
4772 //$url = $gEnvManager->getDefaultUrl();
4773 $url = $gEnvManager->createPageUrl($pageId);
4774 if (!empty($sub)) $url .= '?' . $sub;
4775 if (!empty($param)) $url .= '&' . $param;
4779 * ウィジェット指定呼び出し用のURLを生成
4781 * @param string $toWidgetId 送信先ウィジェットID
4782 * @param string $fromWidgetId 送信元ウィジェットID
4783 * @param string $todo 実行パラメータ
4784 * @param string $pageId ページID(空のときは現在のURL)
4785 * @return string 生成したURL
4787 function createWidgetCmdUrl($toWidgetId, $fromWidgetId, $todo, $pageId = '')
4789 global $gEnvManager;
4791 $url = $gEnvManager->createPageUrl($pageId);
4793 $url .= '?' . M3_REQUEST_PARAM_OPERATION_COMMAND . '=' . M3_REQUEST_CMD_FIND_WIDGET;
4794 $url .= '&' . M3_REQUEST_PARAM_WIDGET_ID . '=' . $toWidgetId;
4795 if (!empty($fromWidgetId)) $url .= '&' . M3_REQUEST_PARAM_FROM . '=' . $fromWidgetId; // 送信元
4796 if (!empty($todo)) $url .= '&' . M3_REQUEST_PARAM_OPERATION_TODO . '=' . urlencode($todo);
4802 * @param string $widgetId 実行ウィジェットID
4803 * @param string $optionParam 追加パラメータ
4804 * @param string $pageId ページID(空のときは現在のURL)
4805 * @param string $pageSubId ページサブID
4806 * @return string 生成したURL
4808 function createRssCmdUrl($widgetId, $optionParam = '', $pageId = '', $pageSubId = '')
4810 global $gEnvManager;
4813 $url = $gEnvManager->createPageUrl() . '?';
4816 if (empty($pageSubId)) $pageSubId = $this->gEnv->getCurrentWidgetPageSubId(); // ページ共通属性ありのときは空
4817 if (!empty($pageSubId)) $url .= M3_REQUEST_PARAM_PAGE_SUB_ID . '=' . $pageSubId . '&';
4819 $url .= M3_REQUEST_PARAM_OPERATION_COMMAND . '=' . M3_REQUEST_CMD_RSS;
4820 $url .= '&' . M3_REQUEST_PARAM_WIDGET_ID . '=' . $widgetId;
4821 if (!empty($optionParam)) $url .= '&' . $optionParam;
4827 * @param string $widgetId 実行ウィジェットID
4828 * @param string $optionParam 追加パラメータ
4829 * @param bool $byMacro マクロ変換で返すかどうか
4830 * @param string $pageId ページID(空のときは現在のURL)
4831 * @param string $pageSubId ページサブID
4832 * @return string 生成したURL
4834 //function createDirectWidgetCmdUrl($widgetId, $optionParam = '', $pageId = '', $pageSubId = '')
4835 function createDirectWidgetCmdUrl($widgetId, $optionParam = '', $byMacro = false, $pageId = '', $pageSubId = '')
4837 global $gEnvManager;
4841 $url = M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END . '/' . M3_FILENAME_INDEX . '?';
4843 $url = $gEnvManager->createPageUrl() . '?';
4847 if (empty($pageSubId)) $pageSubId = $this->gEnv->getCurrentWidgetPageSubId(); // ページ共通属性ありのときは空
4848 if (!empty($pageSubId)) $url .= M3_REQUEST_PARAM_PAGE_SUB_ID . '=' . $pageSubId . '&';
4850 $url .= M3_REQUEST_PARAM_OPERATION_COMMAND . '=' . M3_REQUEST_CMD_DO_WIDGET;
4851 $url .= '&' . M3_REQUEST_PARAM_WIDGET_ID . '=' . $widgetId;
4852 if (!empty($optionParam)) $url .= '&' . $optionParam;
4856 * キャッシュ制御用の付加パラメータを取得
4858 * @return string パラメータ
4860 function getCacheParam()
4862 $addParam = '?' . date('YmdHis');
4866 * 現在のURLにアクセス可能かチェック
4868 * @param bool $isActivePage ページが有効かどうか
4869 * @return bool true=可能、false=不可
4871 function canAccessUrl(&$isActivePage)
4873 global $gEnvManager;
4875 // 現在設定されているページIDを取得
4876 $pageId = $gEnvManager->getCurrentPageId();
4877 $pageSubId = $gEnvManager->getCurrentPageSubId();
4878 $ret = $this->db->canAccessPage($pageId, $pageSubId, $pageVisible, $pageSubVisible, $isAdminMenu);
4879 if ($ret){ // アクセス可能なときは、ユーザ制限もチェックする
4880 $isActivePage = true;
4883 if (!$pageVisible || !$pageSubVisible) return false;
4885 if (!$gEnvManager->isCurrentUserLogined() && $this->isUserLimitedPage($pageId, $pageSubId)){ // ユーザがログインされていない状態でユーザ制限されていればアクセス不可
4888 $this->isAccessPointWithAdminMenu = $isAdminMenu; // 管理メニューを使用するアクセスポイントかどうか
4891 } else { // 無効ページのとき
4892 $isActivePage = false;
4897 * ウィジェットヘッダ(Joomla!1.0用)を出力タイプを取得
4899 * @return int 0=出力しない、1=Joomla!1.0テンプレートPC用、2=Joomla!1.0テンプレート携帯用
4901 function getTemplateWidgetHeaderType()
4903 global $gEnvManager;
4905 $templateId = $gEnvManager->getCurrentTemplateId();
4906 if ($templateId == self::ADMIN_TEMPLATE || // PC管理用テンプレート
4907 $templateId == self::M_ADMIN_TEMPLATE){ // 携帯管理用テンプレート
4909 } else if(strncmp($templateId, 'm/', 2) == 0){ // 携帯用テンプレート
4910 return 2; // 携帯テンプレート用出力
4912 return 1; // PCテンプレート用出力
4918 * @param string $pageId ページID
4919 * @param string $pageSubId ページサブID
4920 * @return bool true=必要、false=不要
4922 function isSslPage($pageId, $pageSubId)
4924 global $gEnvManager;
4927 if (empty($pageId)) $pageId = $gEnvManager->getDefaultPageId();
4930 if ($pageId == $gEnvManager->getDefaultAdminPageId()){
4931 if ($gEnvManager->getUseSslAdmin()){ // 管理用ページにSSLを使用するかどうか
4936 } else { // その他のページのとき
4937 // 一般用ページにSSLを使用しない場合は不要を返す
4938 if (!$gEnvManager->getUseSsl()) return false;
4941 // 一般用ページでSSLを使用する場合は、データベースの設定をチェックする
4942 $line = $this->getPageInfo($pageId, $pageSubId);
4944 if ($line['pn_use_ssl']){
4953 * ユーザ制限が必要なページかどうかを判断
4955 * @param string $pageId ページID
4956 * @param string $pageSubId ページサブID
4957 * @return bool true=必要、false=不要
4959 function isUserLimitedPage($pageId, $pageSubId)
4961 global $gEnvManager;
4964 if (empty($pageId)) $pageId = $gEnvManager->getDefaultPageId();
4966 $line = $this->getPageInfo($pageId, $pageSubId);
4968 if ($line['pn_user_limited']){
4979 * @param string $pageId ページID
4980 * @param string $pageSubId ページサブID
4981 * @return array ページ情報レコード
4983 function getPageInfo($pageId, $pageSubId)
4985 // ページ情報が空のときはデータをロード
4986 if (empty($this->pageInfo)){
4987 $records = $this->db->getPageInfoRecords();
4988 $count = count($records);
4989 $this->pageInfo = array();
4990 for ($i = 0; $i < $count; $i++){
4991 $pId = $records[$i]['pn_id'] . self::PAGE_ID_SEPARATOR . $records[$i]['pn_sub_id'];
4992 $this->pageInfo[$pId] = $records[$i];
4995 return $this->pageInfo[$pageId . self::PAGE_ID_SEPARATOR . $pageSubId];
4998 * 現在のページ情報からテンプレートIDを取得
5000 * @return string テンプレートID
5002 function getTemplateIdFromCurrentPageInfo()
5005 if (!empty($this->currentPageInfo)) $templateId = $this->currentPageInfo['pn_template_id'];
5009 * JavascriptライブラリのIDを取得
5011 * @param int $type 種別(0=すべて、1=jQuery関係すべて、2=jQueryプラグインのみ)
5012 * @return array JavascriptライブラリのID
5014 function getScriptLibId($type = 0)
5016 // Javascriptライブラリのすべてのキーを取得
5017 $keys = array_keys($this->libFiles);
5019 $destKeys = array();
5020 for ($i = 0; $i < count($keys); $i++){
5022 case 1: // jQuery関係すべて
5023 if (strStartsWith($keys[$i], 'jquery')) $destKeys[] = $keys[$i];
5025 case 2: // jQueryプラグインのみ
5026 if (strStartsWith($keys[$i], 'jquery.')) $destKeys[] = $keys[$i];
5033 * Javascriptライブラリの情報を取得
5035 * @param string $id ライブラリID
5036 * @return array ライブラリの情報
5038 function getScriptLibInfo($id)
5040 $libInfo = $this->libFiles[$id];
5041 if (isset($libInfo)){
5048 * 管理画面用jQueryUIテーマのURLを取得
5050 * @return string テーマURL
5052 function getAdminDefaultThemeUrl()
5054 // $themeFile = $this->gEnv->getRootUrl() . self::DEFAULT_THEME_DIR . $this->gSystem->adminDefaultTheme() . '/'. self::THEME_CSS_FILE;
5055 $themeFile = $this->gEnv->getAdminUrl(true/*「admin」削除*/) . self::DEFAULT_THEME_DIR . $this->gSystem->adminDefaultTheme() . '/'. self::THEME_CSS_FILE;
5059 * 一般画面用jQueryUIテーマのURLを取得
5061 * @return string テーマURL
5063 function getDefaultThemeUrl()
5067 if (!isset($themeFile)){
5069 $theme = $this->gSystem->defaultTheme();
5070 if (!empty($theme)){
5071 $path = $this->gEnv->getSystemRootPath() . self::DEFAULT_THEME_DIR . $theme . '/'. self::THEME_CSS_FILE;
5072 if (file_exists($path)) $themeFile = $this->gEnv->getRootUrl() . self::DEFAULT_THEME_DIR . $theme . '/'. self::THEME_CSS_FILE;
5080 * @param array $paramArray URL作成用のパス
5081 * @return string 作成したURLパラメータ
5083 function _createUrlParamStr($paramArray)
5086 if (count($paramArray) == 0) return $destParam;
5088 $sortParam = array();
5089 $keys = array_keys($paramArray);
5090 $keyCount = count($keys);
5091 for ($i = 0; $i < $keyCount; $i++){
5093 $value = $paramArray[$key];
5094 $orderNo = $this->urlParamOrder[$key];
5095 if (!isset($orderNo)) $orderNo = 100;
5096 $sortParam[] = array('key' => $key, 'value' => $value, 'no' => $orderNo);
5098 usort($sortParam, create_function('$a,$b', 'return $a["no"] - $b["no"];'));
5101 $sortCount = count($sortParam);
5102 for ($i = 0; $i < $sortCount; $i++){
5103 if ($i > 0) $destParam .= '&';
5104 $destParam .= rawurlencode($sortParam[$i]['key']) . '=' . rawurlencode($sortParam[$i]['value']);