OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / c / updateinfo / include / container / c_updateinfoWidgetContainer.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-2009 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: c_updateinfoWidgetContainer.php 2692 2009-12-15 09:42:40Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getContainerPath()           . '/baseWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath()     . '/updateinfoDb.php');
18
19 class c_updateinfoWidgetContainer extends BaseWidgetContainer
20 {
21         private $db;    // DB接続オブジェクト
22                         
23         /**
24          * コンストラクタ
25          */
26         function __construct()
27         {
28                 // 親クラスを呼び出す
29                 parent::__construct();
30                 
31                 // DB接続オブジェクト作成
32                 $this->db = new updateinfoDb();
33         }
34         /**
35          * テンプレートファイルを設定
36          *
37          * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
38          * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
39          *
40          * @param RequestManager $request               HTTPリクエスト処理クラス
41          * @param object         $param                 任意使用パラメータ。そのまま_assign()に渡る
42          * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
43          */
44         function _setTemplate($request, &$param)
45         {       
46                 return '';              // テンプレートは使用しない
47         }
48         /**
49          * テンプレートにデータ埋め込む
50          *
51          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
52          *
53          * @param RequestManager $request               HTTPリクエスト処理クラス
54          * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
55          * @param                                                               なし
56          */
57         function _assign($request, &$param)
58         {
59                 $retValue = '0';                // 実行結果
60                 $act = $request->trimValueOf('act');
61                 $type = $request->trimValueOf('content_type');
62                 $serverId = $request->trimValueOf('server_id');         // サーバID
63                 $registDt = $request->trimValueOf('regist_dt');         // 登録情報を有効にする日時
64                 $name = $request->trimValueOf('content_name');          // コンテンツ名
65                 $link = $request->trimValueOf('content_link');          // コンテンツへのリンク
66                 $contentDt = $request->trimValueOf('content_dt');       // コンテンツ更新日時
67                 $message = $request->trimValueOf('message');            // 表示メッセージ
68                 $siteName = $request->trimValueOf('site_name');         // サイト名
69                 $siteLink = $request->trimValueOf('site_link');         // サイトリンク
70                 if ($act == 'regist'){                  // データ登録のとき
71                         $ret = $this->db->addNews($type, $serverId, $registDt, $name, $link, $contentDt, $message, $siteName, $siteLink);
72                         if ($ret) $retValue = '1';/*正常終了*/
73                 }
74                 
75                 // 実行結果を返す
76                 $xmlstr = $this->gPage->getDefaultXmlDeclaration() . '<root></root>';
77                 $sxe = new SimpleXMLElement($xmlstr);
78                 $status = $sxe->addChild('status', $retValue);
79                 echo $sxe->asXML();
80         }
81 }
82 ?>