7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
9 * @package フリーレイアウトお問い合わせ
10 * @author 株式会社 毎日メディアサービス
11 * @copyright Copyright 2009-2013 株式会社 毎日メディアサービス.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: admin_contactus_freelayout3WidgetContainer.php 5824 2013-03-14 05:45:38Z fishbone $
14 * @link http://www.m-media.co.jp
16 require_once($gEnvManager->getContainerPath() . '/baseAdminWidgetContainer.php');
18 class admin_contactus_freelayout3WidgetContainer extends BaseAdminWidgetContainer
20 private $sysDb; // DB接続オブジェクト
21 private $serialNo; // 選択中の項目のシリアル番号
22 private $serialArray = array(); // 表示中のシリアル番号
24 private $configId; // 定義ID
25 private $paramObj; // パラメータ保存用オブジェクト
26 private $typeArray; // 項目タイプ
27 private $fieldInfoArray = array(); // お問い合わせ項目情報
28 private $confirmButtonId; // 確認ボタンのタグID
29 private $sendButtonId; // 送信ボタンのタグID
30 private $cancelButtonId; // 送信キャンセルボタンのタグID
31 private $resetButtonId; // エリアリセットボタンのタグID
32 const DEFAULT_NAME_HEAD = '名称未設定'; // デフォルトの設定名
33 const DEFAULT_USER_EMAIL_SUBJECT = '送信内容ご確認(自動送信メール)';
34 const DEFAULT_USER_EMAIL_FORMAT = "以下の内容でお問い合わせを送信しました。\n\n[#BODY#]";
39 function __construct()
42 parent::__construct();
45 $this->sysDb = $this->gInstance->getSytemDbObject();
48 $this->typeArray = array( array( 'name' => 'テキストボックス', 'value' => 'text'),
49 array( 'name' => 'テキストボックス(Eメール)', 'value' => 'email'),
50 array( 'name' => 'テキストボックス(計算)', 'value' => 'calc'),
51 array( 'name' => 'テキストエリア', 'value' => 'textarea'),
52 array( 'name' => 'セレクトメニュー', 'value' => 'select'),
53 array( 'name' => 'チェックボックス', 'value' => 'checkbox'),
54 array( 'name' => 'ラジオボタン', 'value' => 'radio'));
59 * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
60 * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
62 * @param RequestManager $request HTTPリクエスト処理クラス
63 * @param object $param 任意使用パラメータ。そのまま_assign()に渡る
64 * @return string テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
66 function _setTemplate($request, &$param)
68 $task = $request->trimValueOf('task');
69 if ($task == 'list'){ // 一覧画面
70 return 'admin_list.tmpl.html';
72 return 'admin.tmpl.html';
78 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
80 * @param RequestManager $request HTTPリクエスト処理クラス
81 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
84 function _assign($request, &$param)
86 $task = $request->trimValueOf('task');
87 if ($task == 'list'){ // 一覧画面
88 return $this->createList($request);
90 return $this->createDetail($request);
96 * @param RequestManager $request HTTPリクエスト処理クラス
99 function createDetail($request)
101 // ページ定義IDとページ定義のレコードシリアル番号を取得
102 $this->startPageDefParam($defSerial, $defConfigId, $this->paramObj);
104 $userId = $this->gEnv->getCurrentUserId();
105 $this->langId = $this->gEnv->getCurrentLanguage(); // 表示言語を取得
106 $act = $request->trimValueOf('act');
107 $this->serialNo = $request->trimValueOf('serial'); // 選択項目のシリアル番号
108 $this->configId = $request->trimValueOf('item_id'); // 定義ID
109 if (empty($this->configId)) $this->configId = $defConfigId; // 呼び出しウィンドウから引き継いだ定義ID
112 $name = $request->trimValueOf('item_name'); // 定義名
113 $baseTemplate = $request->valueOf('item_html'); // 入力エリア作成用ベーステンプレート
114 $this->css = $request->valueOf('item_css'); // 入力エリア作成用CSS
115 $this->confirmButtonId = $request->trimValueOf('item_confirm_button'); // 確認ボタンのタグID
116 $this->sendButtonId = $request->trimValueOf('item_send_button'); // 送信ボタンのタグID
117 $this->cancelButtonId = $request->trimValueOf('item_cancel_button'); // 送信キャンセルボタンのタグID
118 $this->resetButtonId = $request->trimValueOf('item_reset_button'); // エリアリセットボタンのタグID
119 $fieldCount = intval($request->trimValueOf('fieldcount')); // お問い合わせ項目数
120 $titles = $request->trimValueOf('item_title'); // お問い合わせ項目タイトル
121 $descs = $request->trimValueOf('item_desc'); // お問い合わせ項目説明
122 $types = $request->trimValueOf('item_type'); // お問い合わせ項目タイプ
123 $defs = $request->trimValueOf('item_def'); // お問い合わせ項目定義
124 $values = $request->trimValueOf('required'); // お問い合わせ項目必須入力
125 $requireds = array();
126 if (strlen($values) > 0) $requireds = explode(',', $values);
127 $values = $request->trimValueOf('disabled'); // 編集不可
128 $disableds = array();
129 if (strlen($values) > 0) $disableds = explode(',', $values);
130 $values = $request->trimValueOf('titlevisible'); // お問い合わせ項目タイトル表示制御
131 $titleVisibles = array();
132 if (strlen($values) > 0) $titleVisibles = explode(',', $values);
133 $values = $request->trimValueOf('alphabet'); // 入力制限半角英字
134 $alphabets = array();
135 if (strlen($values) > 0) $alphabets = explode(',', $values);
136 $values = $request->trimValueOf('number'); // 入力制限半角数値
138 if (strlen($values) > 0) $numbers = explode(',', $values);
139 $defaults = $request->trimValueOf('item_default'); // お問い合わせ項目デフォルト値
140 $fieldIds = $request->trimValueOf('item_field_id'); // お問い合わせ項目フィールドID
141 $calcs = $request->trimValueOf('item_calc'); // お問い合わせ項目計算式
142 $emailSubject = $request->trimValueOf('item_email_subject'); // メールタイトル
143 $emailReceiver = trim($request->valueOf('item_email_receiver')); // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
144 $sendUserEmail = ($request->trimValueOf('item_send_user_email') == 'on') ? 1 : 0; // 入力ユーザ向けメールを送信するかどうか
145 $userEmailReply = $request->trimValueOf('item_user_email_reply'); // 入力ユーザ向けメール返信先メールアドレス
146 $userEmailSubject = $request->trimValueOf('item_user_email_subject'); // 入力ユーザ向けメールタイトル
147 $userEmailFormat = $request->trimValueOf('item_user_email_format'); // 入力ユーザ向けメール本文フォーマット
148 $useArtisteer = ($request->trimValueOf('item_use_artisteer') == 'on') ? 1 : 0; // Artisteer対応デザイン
151 $this->fieldInfoArray = array();
152 for ($i = 0; $i < $fieldCount; $i++){
153 $newInfoObj = new stdClass;
154 $newInfoObj->title = $titles[$i];
155 $newInfoObj->desc = $descs[$i];
156 $newInfoObj->type = $types[$i];
157 $newInfoObj->def = $defs[$i];
158 $newInfoObj->required = $requireds[$i];
159 $newInfoObj->disabled = $disableds[$i];
160 $newInfoObj->titleVisible = $titleVisibles[$i];
161 $newInfoObj->alphabet = $alphabets[$i];
162 $newInfoObj->number = $numbers[$i];
163 $newInfoObj->default = $defaults[$i];
164 $newInfoObj->fieldId = $fieldIds[$i];
165 $newInfoObj->calc = $calcs[$i];
166 $this->fieldInfoArray[] = $newInfoObj;
170 $baseTemplate = $this->gInstance->getTextConvManager()->deleteTag($baseTemplate, 'p');
172 $replaceNew = false; // データを再取得するかどうか
173 if ($act == 'add'){// 新規追加
175 for ($i = 0; $i < $fieldCount; $i++){
176 if (empty($titles[$i])){
177 $this->setUserErrorMsg('タイトルが入力されていません');
182 for ($i = 0; $i < $fieldCount; $i++){
183 if (!empty($fieldIds[$i])){
184 if (preg_match("/[^a-z]/", $fieldIds[$i])){
185 $this->setUserErrorMsg('フィールドIDは英小文字が使用可能です');
191 for ($i = 0; $i < $fieldCount; $i++){
192 if (!empty($calcs[$i])){
193 if (preg_match("/[^0-9a-z-\+\*\/()]/", $calcs[$i])){
194 $this->setUserErrorMsg('計算式はフィールドID、演算子「+-*/」、括弧「()」、数値が使用可能です');
201 for ($i = 0; $i < count($this->paramObj); $i++){
202 $targetObj = $this->paramObj[$i]->object;
203 if ($name == $targetObj->name){ // 定義名
204 $this->setUserErrorMsg('名前が重複しています');
210 if (!empty($sendUserEmail)){
211 $this->checkInput($userEmailSubject, '確認メール件名');
212 $this->checkInput($userEmailFormat, '確認メール本文');
216 if ($this->getMsgCount() == 0){
218 $newObj = new stdClass;
219 $newObj->name = $name;// 表示名
220 $newObj->baseTemplate = $baseTemplate; // 入力エリア作成用ベーステンプレート
221 $newObj->css = $this->css; // 入力エリア用CSS
222 $newObj->confirmButtonId = $this->confirmButtonId; // 確認ボタンのタグID
223 $newObj->sendButtonId = $this->sendButtonId; // 送信ボタンのタグID
224 $newObj->cancelButtonId = $this->cancelButtonId; // 送信キャンセルボタンのタグID
225 $newObj->resetButtonId = $this->resetButtonId; // エリアリセットボタンのタグID
226 $newObj->emailSubject = $emailSubject; // メールタイトル
227 $newObj->emailReceiver = $emailReceiver; // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
228 $newObj->sendUserEmail = $sendUserEmail; // 入力ユーザ向けメールを送信するかどうか
229 $newObj->userEmailReply = $userEmailReply; // 入力ユーザ向けメール返信先メールアドレス
230 $newObj->userEmailSubject = $userEmailSubject; // 入力ユーザ向けメールタイトル
231 $newObj->userEmailFormat = $userEmailFormat; // 入力ユーザ向けメール本文フォーマット
232 $newObj->useArtisteer = $useArtisteer; // Artisteer対応デザイン
233 $newObj->fieldInfo = $this->fieldInfoArray; // フィールド定義
235 $ret = $this->addPageDefParam($defSerial, $defConfigId, $this->paramObj, $newObj);
237 $this->setGuidanceMsg('データを追加しました');
239 $this->configId = $defConfigId; // 定義定義IDを更新
240 $replaceNew = true; // データ再取得
242 $this->setAppErrorMsg('データ追加に失敗しました');
245 } else if ($act == 'update'){ // 設定更新のとき
247 for ($i = 0; $i < $fieldCount; $i++){
248 if (empty($titles[$i])){
249 $this->setUserErrorMsg('タイトルが入力されていません');
254 for ($i = 0; $i < $fieldCount; $i++){
255 if (!empty($fieldIds[$i])){
256 if (preg_match("/[^a-z]/", $fieldIds[$i])){
257 $this->setUserErrorMsg('フィールドIDは英小文字が使用可能です');
263 for ($i = 0; $i < $fieldCount; $i++){
264 if (!empty($calcs[$i])){
265 if (preg_match("/[^0-9a-z-\+\*\/()]/", $calcs[$i])){
266 $this->setUserErrorMsg('計算式はフィールドID、演算子「+-*/」、括弧「()」、数値が使用可能です');
273 if (!empty($sendUserEmail)){
274 $this->checkInput($userEmailSubject, '確認メール件名');
275 $this->checkInput($userEmailFormat, '確認メール本文');
278 if ($this->getMsgCount() == 0){ // エラーのないとき
280 $ret = $this->getPageDefParam($defSerial, $defConfigId, $this->paramObj, $this->configId, $targetObj);
283 $targetObj->baseTemplate = $baseTemplate; // 入力エリア作成用ベーステンプレート
284 $targetObj->css = $this->css; // 入力エリア作成用CSS
285 $targetObj->confirmButtonId = $this->confirmButtonId; // 確認ボタンのタグID
286 $targetObj->sendButtonId = $this->sendButtonId; // 送信ボタンのタグID
287 $targetObj->cancelButtonId = $this->cancelButtonId; // 送信キャンセルボタンのタグID
288 $targetObj->resetButtonId = $this->resetButtonId; // エリアリセットボタンのタグID
289 $targetObj->emailSubject = $emailSubject; // メールタイトル
290 $targetObj->emailReceiver = $emailReceiver; // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
291 $targetObj->sendUserEmail = $sendUserEmail; // 入力ユーザ向けメールを送信するかどうか
292 $targetObj->userEmailSubject = $userEmailSubject; // 入力ユーザ向けメールタイトル
293 $targetObj->userEmailReply = $userEmailReply; // 入力ユーザ向けメール返信先メールアドレス
294 $targetObj->userEmailFormat = $userEmailFormat; // 入力ユーザ向けメール本文フォーマット
295 $targetObj->useArtisteer = $useArtisteer; // Artisteer対応デザイン
296 $targetObj->fieldInfo = $this->fieldInfoArray; // フィールド定義
300 if ($ret) $ret = $this->updatePageDefParam($defSerial, $defConfigId, $this->paramObj, $this->configId, $targetObj);
302 $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
303 $replaceNew = true; // データ再取得
305 $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
308 } else if ($act == 'select'){ // 定義IDを変更
309 $replaceNew = true; // データ再取得
310 } else { // 初期起動時、または上記以外の場合
312 $this->configId = $defConfigId; // 呼び出しウィンドウから引き継いだ定義ID
313 $replaceNew = true; // データ再取得
316 $this->createItemMenu();
319 if (empty($this->configId)){ // 新規登録の場合
320 $this->tmpl->setAttribute('item_name_visible', 'visibility', 'visible');// 名前入力フィールド表示
321 if ($replaceNew){ // データ再取得時
322 $name = $this->createDefaultName(); // デフォルト登録項目名
324 $this->css = $this->getParsedTemplateData('default.tmpl.css', array($this, 'makeCss'));// デフォルト用のCSSを取得
325 $emailSubject = ''; // メールタイトル
326 $emailReceiver = ''; // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
327 $sendUserEmail = 0; // 入力ユーザ向けメールを送信するかどうか
328 $userEmailReply = ''; // 入力ユーザ向けメール返信先メールアドレス
329 $userEmailSubject = self::DEFAULT_USER_EMAIL_SUBJECT; // 入力ユーザ向けメールタイトル
330 $userEmailFormat = self::DEFAULT_USER_EMAIL_FORMAT; // 入力ユーザ向けメール本文フォーマット
331 $useArtisteer = 0; // Artisteer対応デザイン
332 $this->fieldInfoArray = array(); // お問い合わせ項目情報
335 $tagHead = $this->createTagIdHead();
336 $this->confirmButtonId = $tagHead . '_confirm'; // 確認ボタンのタグID
337 $this->sendButtonId = $tagHead . '_send'; // 送信用ボタンのタグID
338 $this->cancelButtonId = $tagHead . '_cancel'; // 送信キャンセルボタンのタグID
339 $this->resetButtonId = $tagHead . '_reset'; // エリアリセットボタンのタグID
340 $baseTemplate = $this->getParsedTemplateData('default.tmpl.html', array($this, 'makeBaseTemplate'));// デフォルトの入力エリア作成用ベーステンプレート
344 if ($replaceNew){// データ再取得時
345 $ret = $this->getPageDefParam($defSerial, $defConfigId, $this->paramObj, $this->configId, $targetObj);
347 $name = $targetObj->name;// 名前
348 $baseTemplate = $targetObj->baseTemplate; // 入力エリア作成用ベーステンプレート
349 $this->css = $targetObj->css; // 入力エリア作成用CSS
350 $this->confirmButtonId = $targetObj->confirmButtonId; // 確認ボタンのタグID
351 $this->sendButtonId = $targetObj->sendButtonId; // 送信ボタンのタグID
352 $this->cancelButtonId = $targetObj->cancelButtonId; // 送信キャンセルボタンのタグID
353 $this->resetButtonId = $targetObj->resetButtonId; // エリアリセットボタンのタグID
354 $emailSubject = $targetObj->emailSubject; // メールタイトル
355 $emailReceiver = $targetObj->emailReceiver; // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
356 $sendUserEmail = $targetObj->sendUserEmail; // 入力ユーザ向けメールを送信するかどうか
357 $userEmailReply = $targetObj->userEmailReply; // 入力ユーザ向けメール返信先メールアドレス
358 $userEmailSubject = $targetObj->userEmailSubject; // 入力ユーザ向けメールタイトル
359 $userEmailFormat = $targetObj->userEmailFormat; // 入力ユーザ向けメール本文フォーマット
360 $useArtisteer = $targetObj->useArtisteer; // Artisteer対応デザイン
361 if (!empty($targetObj->fieldInfo)) $this->fieldInfoArray = $targetObj->fieldInfo; // お問い合わせ項目情報
364 $this->serialNo = $this->configId;
366 // 新規作成でないときは、メニューを変更不可にする(画面作成から呼ばれている場合のみ)
367 if (!empty($defConfigId) && !empty($defSerial)) $this->tmpl->addVar("_widget", "id_disabled", 'disabled');
371 $this->createTypeMenu1();
374 $this->createFieldList();
375 if (empty($this->fieldInfoArray)) $this->tmpl->setAttribute('field_list', 'visibility', 'hidden');// お問い合わせ項目情報一覧
378 if (!empty($this->configId)) $this->tmpl->addVar("_widget", "id", $this->configId); // 定義ID
379 $this->tmpl->addVar("item_name_visible", "name", $name);
380 $this->tmpl->addVar("_widget", "html", $baseTemplate); // 入力エリア作成用ベーステンプレート
381 $this->tmpl->addVar("_widget", "css", $this->css); // 入力エリア作成用CSS
382 $this->tmpl->addVar("_widget", "confirm_button", $this->confirmButtonId); // 確認ボタンのタグID
383 $this->tmpl->addVar("_widget", "send_button", $this->sendButtonId); // 送信ボタンのタグID
384 $this->tmpl->addVar("_widget", "cancel_button", $this->cancelButtonId); // 送信キャンセルボタンのタグID
385 $this->tmpl->addVar("_widget", "reset_button", $this->resetButtonId); // エリアリセットボタンのタグID
386 $tagStr = $this->confirmButtonId . '(確認ボタンのID), ' . $this->sendButtonId . '(送信ボタンのID), ' .
387 $this->cancelButtonId . '(送信キャンセルボタンのID), ' . $this->resetButtonId . '(リセットボタンのID)';
388 $this->tmpl->addVar("_widget", "tag_id_str", $tagStr);// タグIDの表示
389 $this->tmpl->addVar("_widget", "email_subject", $emailSubject); // メールタイトル
390 $this->tmpl->addVar("_widget", "email_receiver", $emailReceiver); // メール受信者(aaaa<xxx@xxx.xxx>形式が可能)
392 if (!empty($sendUserEmail)) $visibleStr = 'checked';
393 $this->tmpl->addVar("_widget", "send_user_email", $visibleStr); // 入力ユーザ向けメールを送信するかどうか
394 $this->tmpl->addVar("_widget", "user_email_reply", $userEmailReply); // 入力ユーザ向けメール返信先メールアドレス
395 $this->tmpl->addVar("_widget", "user_email_subject", $userEmailSubject); // 入力ユーザ向けメールタイトル
396 $this->tmpl->addVar("_widget", "user_email_format", $userEmailFormat); // 入力ユーザ向けメール本文フォーマット
398 if (!empty($useArtisteer)) $checked = 'checked';
399 $this->tmpl->addVar("_widget", "use_artisteer", $checked);// Artisteer対応デザイン
400 $this->tmpl->addVar("_widget", "serial", $this->serialNo);// 選択中のシリアル番号、IDを設定
401 $this->tmpl->addVar('_widget', 'tag_start', M3_TAG_START . M3_TAG_MACRO_ITEM_KEY); // 置換タグ(前)
402 $this->tmpl->addVar('_widget', 'tag_end', M3_TAG_END); // 置換タグ(後)
405 if (empty($this->serialNo)){ // 新規追加項目を選択しているとき
406 $this->tmpl->setAttribute('add_button', 'visibility', 'visible');// 「新規追加」ボタン
409 $this->tmpl->addVar("_widget", "preview_disabled", 'disabled ');// 「プレビュー」ボタン
411 $this->tmpl->setAttribute('update_button', 'visibility', 'visible');// 「更新」ボタン
413 // このウィジェットがマップされているページサブIDを取得
414 $subPageId = $this->gPage->getPageSubIdByWidget($this->gEnv->getDefaultPageId(), $this->gEnv->getCurrentWidgetId(), $defConfigId);
415 $previewUrl = $this->gEnv->getDefaultUrl();
416 if (!empty($subPageId)) $previewUrl .= '?sub=' . $subPageId;
417 $this->tmpl->addVar("_widget", "preview_url", $this->getUrl($previewUrl));
420 $this->convertHelp('update_button');
423 // ページ定義IDとページ定義のレコードシリアル番号を更新
424 $this->endPageDefParam($defSerial, $defConfigId, $this->paramObj);
431 function createItemMenu()
433 for ($i = 0; $i < count($this->paramObj); $i++){
434 $id = $this->paramObj[$i]->id;// 定義ID
435 $targetObj = $this->paramObj[$i]->object;
436 $name = $targetObj->name;// 定義名
438 if ($this->configId == $id) $selected = 'selected';
441 'name' => $name, // 名前
442 'value' => $id, // 定義ID
443 'selected' => $selected // 選択中の項目かどうか
445 $this->tmpl->addVars('title_list', $row);
446 $this->tmpl->parseTemplate('title_list', 'a');
454 function createFieldList()
456 $fieldCount = count($this->fieldInfoArray);
457 for ($i = 0; $i < $fieldCount; $i++){
458 $infoObj = $this->fieldInfoArray[$i];
459 $title = $infoObj->title;// タイトル名
460 $desc = $infoObj->desc; // 説明
461 $type = $infoObj->type; // 項目タイプ
462 $def = $infoObj->def; // 項目定義
464 if (!empty($infoObj->required)) $requiredCheck = 'checked';
465 $disabledCheck = ''; // 編集不可
466 if (!empty($infoObj->disabled)) $disabledCheck = 'checked';
467 $titleVisibleCheck = '';
468 if (!empty($infoObj->titleVisible)) $titleVisibleCheck = 'checked';
470 if (!empty($infoObj->alphabet)) $alphabetCheck = 'checked';
472 if (!empty($infoObj->number)) $numberCheck = 'checked';
473 $default = $infoObj->default; // デフォルト値
474 $fieldId = $infoObj->fieldId; // フィールドID
475 $calc = $infoObj->calc; // 計算式
478 $this->tmpl->clearTemplate('type_list2');
480 for ($j = 0; $j < count($this->typeArray); $j++){
481 $value = $this->typeArray[$j]['value'];
482 $name = $this->typeArray[$j]['name'];
485 if ($value == $type) $selected = 'selected';
488 'value' => $value, // タイプ値
489 'name' => $this->convertToDispString($name), // タイプ名
490 'selected' => $selected // 選択中かどうか
492 $this->tmpl->addVars('type_list2', $tableLine);
493 $this->tmpl->parseTemplate('type_list2', 'a');
497 'title' => $this->convertToDispString($title), // タイトル名
498 'desc' => $this->convertToDispString($desc), // 説明
499 'def' => $this->convertToDispString($def), // 定義情報
500 'required' => $requiredCheck, // 必須入力
501 'disabled' => $disabledCheck, // 編集不可
502 'title_visible' => $titleVisibleCheck, // タイトル表示制御
503 'alphabet' => $alphabetCheck, // 入力制限半角英字
504 'number' => $numberCheck, // 入力制限半角数値
505 'default' => $this->convertToDispString($default), // デフォルト値
506 'field_id' => $this->convertToDispString($fieldId), // フィールドID
507 'calc' => $this->convertToDispString($calc), // 計算式
508 'root_url' => $this->convertToDispString($this->getUrl($this->gEnv->getRootUrl()))
510 $this->tmpl->addVars('field_list', $row);
511 $this->tmpl->parseTemplate('field_list', 'a');
517 * @return string デフォルト名
519 function createDefaultName()
521 $name = self::DEFAULT_NAME_HEAD;
522 for ($j = 1; $j < 100; $j++){
523 $name = self::DEFAULT_NAME_HEAD . $j;
525 for ($i = 0; $i < count($this->paramObj); $i++){
526 $targetObj = $this->paramObj[$i]->object;
527 if ($name == $targetObj->name){ // 定義名
532 if ($i == count($this->paramObj)) break;
539 * @param RequestManager $request HTTPリクエスト処理クラス
542 function createList($request)
544 // ページ定義IDとページ定義のレコードシリアル番号を取得
545 $this->startPageDefParam($defSerial, $defConfigId, $this->paramObj);
547 $userId = $this->gEnv->getCurrentUserId();
548 $langId = $this->gEnv->getCurrentLanguage(); // 表示言語を取得
549 $act = $request->trimValueOf('act');
551 if ($act == 'delete'){ // メニュー項目の削除
552 $listedItem = explode(',', $request->trimValueOf('seriallist'));
554 for ($i = 0; $i < count($listedItem); $i++){
556 $itemName = 'item' . $i . '_selected';
557 $itemValue = ($request->trimValueOf($itemName) == 'on') ? 1 : 0;
559 if ($itemValue){ // チェック項目
560 $delItems[] = $listedItem[$i];
563 if (count($delItems) > 0){
564 $ret = $this->delPageDefParam($defSerial, $defConfigId, $this->paramObj, $delItems);
565 if ($ret){ // データ削除成功のとき
566 $this->setGuidanceMsg('データを削除しました');
568 $this->setAppErrorMsg('データ削除に失敗しました');
573 $this->createItemList();
575 $this->tmpl->addVar("_widget", "serial_list", implode($this->serialArray, ','));// 表示項目のシリアル番号を設定
577 // ページ定義IDとページ定義のレコードシリアル番号を更新
578 $this->endPageDefParam($defSerial, $defConfigId, $this->paramObj);
585 function createItemList()
587 for ($i = 0; $i < count($this->paramObj); $i++){
588 $id = $this->paramObj[$i]->id;// 定義ID
589 $targetObj = $this->paramObj[$i]->object;
590 $name = $targetObj->name;// 定義名
591 $emailReceiver = $targetObj->emailReceiver; // 受信メールアドレス
596 $defCount = $this->sysDb->getPageDefCount($this->gEnv->getCurrentWidgetId(), $id);
598 $operationDisagled = '';
599 if ($defCount > 0) $operationDisagled = 'disabled';
604 'ope_disabled' => $operationDisagled, // 選択可能かどうか
605 'name' => $this->convertToDispString($name), // 名前
606 'email_receiver' => $this->convertToDispString($emailReceiver), // 受信メールアドレス
607 'def_count' => $defCount // 使用数
609 $this->tmpl->addVars('itemlist', $row);
610 $this->tmpl->parseTemplate('itemlist', 'a');
613 $this->serialArray[] = $id;
621 function createTypeMenu1()
623 for ($i = 0; $i < count($this->typeArray); $i++){
624 $value = $this->typeArray[$i]['value'];
625 $name = $this->typeArray[$i]['name'];
628 'value' => $value, // タイプ値
629 'name' => $this->convertToDispString($name), // タイプ名
630 'selected' => $selected // 選択中かどうか
632 $this->tmpl->addVars('type_list1', $row);
633 $this->tmpl->parseTemplate('type_list1', 'a');
637 * テンプレートデータ作成処理コールバック
639 * @param object $tmpl テンプレートオブジェクト
642 function makeBaseTemplate($tmpl)
644 $tmpl->addVar("_tmpl", "widget_url", $this->gEnv->getCurrentWidgetRootUrl()); // ウィジェットのURL
645 $tmpl->addVar("_tmpl", "confirm_button_id", $this->confirmButtonId); // 確認用ボタンのタグID
646 $tmpl->addVar("_tmpl", "send_button_id", $this->sendButtonId); // 送信用ボタンのタグID
647 $tmpl->addVar("_tmpl", "cancel_button_id", $this->cancelButtonId); // 送信キャンセル用ボタンのタグID
648 $tmpl->addVar("_tmpl", "reset_button_id", $this->resetButtonId); // エリアリセットボタンのタグID
653 * @param object $tmpl テンプレートオブジェクト
656 function makeCss($tmpl)
660 * inputタグID用のヘッダ文字列を作成
664 function createTagIdHead()
666 return $this->gEnv->getCurrentWidgetId() . '_' . $this->getTempConfigId($this->paramObj);