forked from netcommons/NetCommons2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathView.class.php
More file actions
96 lines (87 loc) · 2.17 KB
/
View.class.php
File metadata and controls
96 lines (87 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* RSSデータ取得コンポーネントクラス
*
* @package NetCommons Components
* @author Noriko Arai,Ryuji Masukawa
* @copyright 2006-2007 NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @project NetCommons Project, supported by National Institute of Informatics
* @access public
*/
class Rss_Components_View
{
/**
* @var DBオブジェクトを保持
*
* @access private
*/
var $_db = null;
/**
* @var Requestオブジェクトを保持
*
* @access private
*/
var $_request = null;
/**
* コンストラクター
*
* @access public
*/
function Rss_Components_View()
{
$container =& DIContainerFactory::getContainer();
$this->_db =& $container->getComponent("DbObject");
$this->_request =& $container->getComponent("Request");
}
/**
*
* RSS用データを取得し配列として返す
*
* @return array RSS用ブロックデータ配列
* @access public
*/
function &getRss()
{
$params = array($this->_request->getParameter("block_id"));
$sql = "SELECT site_name, url, encoding, cache_time, visible_row, imagine, xml, update_time_sec ".
"FROM {rss_block} ".
"WHERE block_id = ?";
$rsses = $this->_db->execute($sql, $params);
if ($rsses === false) {
return $rsses;
}
if (count($rsses) > 0) {
$rss = $rsses[0];
}
if (!empty($rss["xml"])) {
$rss["xml"] = unserialize($rss["xml"]);
}
return $rss;
}
/**
*
* RSS用ブロックデータが存在するかチェック
*
* @return boolean true:存在する,false:存在しない
* @access public
*/
function rssExists()
{
$params = array($this->_request->getParameter("block_id"));
$sql = "SELECT block_id ".
"FROM {rss_block} ".
"WHERE block_id = ?";
$result = $this->_db->execute($sql, $params, 1);
if($result === false) {
$this->_db->addError();
return $result;
}
if (count($result) > 0) {
return true;
}
return false;
}
}
?>