forked from netcommons/NetCommons2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAction.class.php
More file actions
85 lines (80 loc) · 2.05 KB
/
Action.class.php
File metadata and controls
85 lines (80 loc) · 2.05 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
<?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_Action
{
/**
* @var DBオブジェクトを保持
*
* @access private
*/
var $_db = null;
/**
* コンストラクター
*
* @access public
*/
function Rss_Components_Action()
{
$container =& DIContainerFactory::getContainer();
$this->_db =& $container->getComponent("DbObject");
}
/**
* RSS用ブロックデータを登録する
*
* @param array $params 登録するRSS用ブロックデータ配列
* @return boolean true or false
* @access public
*/
function insert($params = array())
{
$params = $this->_serializeXml($params);
$result = $this->_db->insertExecute("rss_block", $params, true);
if (!$result) {
$this->_db->addError();
return false;
}
return true;
}
/**
* RSS用ブロックデータを更新する
*
* @param array $params 変更するRSS用ブロックデータ配列
* @return boolean true or false
* @access public
*/
function update($params = array())
{
$key = "block_id";
$params = $this->_serializeXml($params);
$result = $this->_db->updateExecute("rss_block", $params, $key, true);
if($result === false) {
return false;
}
return true;
}
/**
* xml配列をserializeする
*
* @param array $params RSS用ブロックデータ配列
* @return boolean xml配列をserializeしたRSS用ブロックデータ配列
* @access private
*/
function _serializeXml($params = array())
{
if (is_array($params["xml"])) {
$params["xml"] = serialize($params["xml"]);
}
return $params;
}
}
?>