7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
9 * @package Magic3 Framework
10 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11 * @copyright Copyright 2006-2010 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: admin_m_blogConfigWidgetContainer.php 3836 2010-11-17 06:05:07Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getCurrentWidgetContainerPath() . '/admin_m_blogBaseWidgetContainer.php');
18 class admin_m_blogConfigWidgetContainer extends admin_m_blogBaseWidgetContainer
20 const DEFAULT_VIEW_COUNT = 3; // デフォルトの表示記事数
25 function __construct()
28 parent::__construct();
33 * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
34 * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
36 * @param RequestManager $request HTTPリクエスト処理クラス
37 * @param object $param 任意使用パラメータ。そのまま_assign()に渡る
38 * @return string テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
40 function _setTemplate($request, &$param)
42 return 'admin_config.tmpl.html';
47 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
49 * @param RequestManager $request HTTPリクエスト処理クラス
50 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
53 function _assign($request, &$param)
55 $defaultLang = $this->gEnv->getDefaultLanguage();
57 $act = $request->trimValueOf('act');
58 $entryViewCount = $request->trimValueOf('item_entry_view_count'); // 記事表示数
59 $entryViewOrder = $request->trimValueOf('item_entry_view_order'); // 記事表示順
60 $titleColor = $request->trimValueOf('item_title_color'); // タイトルの背景色
62 $reloadData = false; // データの再読み込み
63 if ($act == 'update'){ // 設定更新のとき
65 $this->checkNumeric($entryViewCount, '記事表示順');
67 if ($this->getMsgCount() == 0){ // エラーのないとき
71 if (!$this->_db->updateConfig(self::CF_ENTRY_VIEW_COUNT, $entryViewCount)) $isErr = true;// 記事表示数
74 if (!$this->_db->updateConfig(self::CF_ENTRY_VIEW_ORDER, $entryViewOrder)) $isErr = true;// 記事表示順
77 if (!$this->_db->updateConfig(self::CF_TITLE_COLOR, $titleColor)) $isErr = true;// タイトルの背景色
81 $this->setMsg(self::MSG_APP_ERR, 'データ更新に失敗しました');
83 $this->setMsg(self::MSG_GUIDANCE, 'データを更新しました');
86 $this->_loadConfig($this->_blogId);
87 $reloadData = true; // データの再読み込み
91 $reloadData = true; // データの再読み込み
95 $entryViewCount = $this->_configArray[self::CF_ENTRY_VIEW_COUNT];// 記事表示数
96 $entryViewOrder = $this->_configArray[self::CF_ENTRY_VIEW_ORDER];// 記事表示順
97 $titleColor = $this->_configArray[self::CF_TITLE_COLOR]; // タイトルの背景色
100 $this->tmpl->addVar("_widget", "view_count", $entryViewCount);// 記事表示数
101 if (empty($entryViewOrder)){ // 順方向
102 $this->tmpl->addVar("_widget", "view_order_inc_selected", 'selected');// 記事表示順
104 $this->tmpl->addVar("_widget", "view_order_dec_selected", 'selected');// 記事表示順
106 $this->tmpl->addVar("_widget", "title_color", $titleColor);// タイトルの背景色