forked from PREreview/api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrereviewPluginDAO.inc.php
87 lines (76 loc) · 1.83 KB
/
PrereviewPluginDAO.inc.php
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
<?php
/**
* @file plugins/generic/prereview/PrereviewPluginDAO.inc.php
*
* @class PrereviewPluginDAO
* @ingroup plugins.generic.prereview
*
* @brief Operations to add save settings for each item.
*/
class PrereviewPluginDAO extends DAO
{
/** @var $_result ADORecordSet */
public $_result;
/** @var $_loadId string */
public $_loadId;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->_result = false;
$this->_loadId = null;
}
public function insert($id, $name, $value)
{
$this->update(
'INSERT INTO prereview_settings
(publication_id, setting_name, setting_value)
VALUES
(?, ?, ?)',
array(
$id,
$name,
$value,
)
);
return true;
}
public function updateObject($id, $name, $value)
{
$this->update(
'UPDATE prereview_settings
SET setting_value = ?
WHERE publication_id = ? AND setting_name = ?',
array(
$value,
$id,
$name,
)
);
return true;
}
public function _getPrereviewData($id, $name)
{
$result = $this->retrieve(
'SELECT setting_value
FROM prereview_settings WHERE publication_id = ? AND setting_name = ?
GROUP BY setting_value',
array((int) $id, $name)
);
$returner = $result->fields[0];
$result->Close();
return $returner;
}
public function getDataPrereview($id)
{
$result = $this->retrieve(
'SELECT setting_value
FROM prereview_settings WHERE publication_id = ?',
array((int) $id)
);
$returner = $result->current();
return $returner;
}
}