OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / event_main / include / container / event_mainBaseWidgetContainer.php
1 <?php
2 /**
3  * index.php用コンテナクラス
4  *
5  * PHP versions 5
6  *
7  * LICENSE: This source file is licensed under the terms of the GNU General Public License.
8  *
9  * @package    Magic3 Framework
10  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11  * @copyright  Copyright 2006-2011 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: event_mainBaseWidgetContainer.php 5230 2012-09-20 00:50:16Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getContainerPath() . '/baseWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/event_mainDb.php');
18
19 class event_mainBaseWidgetContainer extends BaseWidgetContainer
20 {
21         protected static $_localDb;                     // DB接続オブジェクト
22         protected static $_configArray;         // イベント定義値
23         protected static $_paramObj;            // ウィジェットパラメータオブジェクト
24         protected static $_canEditEntry;        // 記事が編集可能かどうか
25         protected $_currentPageUrl;     // 現在のページのURL
26         const CF_RECEIVE_COMMENT                = 'receive_comment';            // コメントを受け付けるかどうか
27         const CF_ENTRY_VIEW_COUNT               = 'entry_view_count';                   // 記事表示数
28         const CF_ENTRY_VIEW_ORDER               = 'entry_view_order';                   // 記事表示方向
29         const CF_MAX_COMMENT_LENGTH             = 'comment_max_length';         // コメント最大文字数
30         const CF_TOP_CONTENTS                   = 'top_contents';               // トップコンテンツ
31         const DEFAULT_COMMENT_LENGTH    = 300;                          // デフォルトのコメント最大文字数
32         const DEFAULT_CATEGORY_COUNT    = 2;                            // デフォルトのカテゴリ数
33         const DATE_RANGE_DELIMITER              = '~';                                // 日時範囲用デリミター
34         
35         // 画面
36         const TASK_TOP                  = 'top';                        // トップ画面
37         const TASK_CALENDAR             = 'calendar';           // カレンダー画面
38         const DEFAULT_TASK              = 'top';
39         
40         // カレンダー用スクリプト
41         const CALENDAR_SCRIPT_FILE = '/jscalendar-1.0/calendar.js';             // カレンダースクリプトファイル
42         const CALENDAR_LANG_FILE = '/jscalendar-1.0/lang/calendar-ja.js';       // カレンダー言語ファイル
43         const CALENDAR_SETUP_FILE = '/jscalendar-1.0/calendar-setup.js';        // カレンダーセットアップファイル
44         const CALENDAR_CSS_FILE = '/jscalendar-1.0/calendar-win2k-1.css';               // カレンダー用CSSファイル
45         
46         // リンク部CSS
47         const CSS_LINK_STYLE_TOP = 'margin:0 10px;text-align:right;';   // 上のリンク部のスタイル
48                 
49         /**
50          * コンストラクタ
51          */
52         function __construct()
53         {
54                 // 親クラスを呼び出す
55                 parent::__construct();
56
57                 // 初期値設定
58                 $this->_currentPageUrl = $this->gEnv->createCurrentPageUrl();   // 現在のページのURL
59                 
60                 // DBオブジェクト作成
61                 if (!isset(self::$_localDb)) self::$_localDb = new event_mainDb();
62                         
63                 // イベント定義を読み込む
64                 if (!isset(self::$_configArray)) $this->_loadConfig();
65         }
66         /**
67          * テンプレートにデータ埋め込む
68          *
69          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
70          *
71          * @param RequestManager $request               HTTPリクエスト処理クラス
72          * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
73          * @return                                                              なし
74          */
75         function _postAssign($request, &$param)
76         {
77                 $this->tmpl->addVar("top_link_area", "link_style_top", self::CSS_LINK_STYLE_TOP);// 上下のリンク部のスタイル
78         }
79         /**
80          * イベント定義値をDBから取得
81          *
82          * @return bool                 true=取得成功、false=取得失敗
83          */
84         function _loadConfig()
85         {
86                 self::$_configArray = array();
87
88                 // イベント定義を読み込み
89                 $ret = self::$_localDb->getAllConfig($rows);
90                 if ($ret){
91                         // 取得データを連想配列にする
92                         $configCount = count($rows);
93                         for ($i = 0; $i < $configCount; $i++){
94                                 $key = $rows[$i]['eg_id'];
95                                 $value = $rows[$i]['eg_value'];
96                                 self::$_configArray[$key] = $value;
97                         }
98                 }
99                 return $ret;
100         }
101 }
102 ?>