ocs  2.3.6
About: OCS (Open Conference System) is a Web publishing tool that will create a complete Web presence for your scholarly conference.
  Fossies Dox: ocs-2.3.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

StaticPagesDAO.inc.php
Go to the documentation of this file.
1 <?php
14 import('db.DAO');
15 
16 class StaticPagesDAO extends DAO {
17 
18  function getStaticPage($staticPageId) {
19  $result =& $this->retrieve(
20  'SELECT * FROM static_pages WHERE static_page_id = ?', $staticPageId
21  );
22 
23  $returner = null;
24  if ($result->RecordCount() != 0) {
25  $returner =& $this->_returnStaticPageFromRow($result->GetRowAssoc(false));
26  }
27  $result->Close();
28  return $returner;
29  }
30 
31  function &getStaticPagesByConferenceId($conferenceId, $rangeInfo = null) {
32  $result =& $this->retrieveRange(
33  'SELECT * FROM static_pages WHERE conference_id = ?', $conferenceId, $rangeInfo
34  );
35 
36  $returner = new DAOResultFactory($result, $this, '_returnStaticPageFromRow');
37  return $returner;
38  }
39 
40  function getStaticPageByPath($conferenceId, $path) {
41  $result =& $this->retrieve(
42  'SELECT * FROM static_pages WHERE conference_id = ? AND path = ?', array($conferenceId, $path)
43  );
44 
45  $returner = null;
46  if ($result->RecordCount() != 0) {
47  $returner =& $this->_returnStaticPageFromRow($result->GetRowAssoc(false));
48  }
49  $result->Close();
50  return $returner;
51  }
52 
53  function insertStaticPage(&$staticPage) {
54  $this->update(
55  'INSERT INTO static_pages
56  (conference_id, path)
57  VALUES
58  (?, ?)',
59  array(
60  $staticPage->getConferenceId(),
61  $staticPage->getPath()
62  )
63  );
64 
65  $staticPage->setId($this->getInsertStaticPageId());
66  $this->updateLocaleFields($staticPage);
67 
68  return $staticPage->getId();
69  }
70 
71  function updateStaticPage(&$staticPage) {
72  $returner = $this->update(
73  'UPDATE static_pages
74  SET
75  conference_id = ?,
76  path = ?
77  WHERE static_page_id = ?',
78  array(
79  $staticPage->getConferenceId(),
80  $staticPage->getPath(),
81  $staticPage->getId()
82  )
83  );
84  $this->updateLocaleFields($staticPage);
85  return $returner;
86  }
87 
88  function deleteStaticPageById($staticPageId) {
89  $returner = $this->update(
90  'DELETE FROM static_pages WHERE static_page_id = ?', $staticPageId
91  );
92  return $this->update(
93  'DELETE FROM static_page_settings WHERE static_page_id = ?', $staticPageId
94  );
95  }
96 
97  function &_returnStaticPageFromRow(&$row) {
98  $staticPagesPlugin =& PluginRegistry::getPlugin('generic', 'StaticPagesPlugin');
99  $staticPagesPlugin->import('StaticPage');
100 
101  $staticPage = new StaticPage();
102  $staticPage->setId($row['static_page_id']);
103  $staticPage->setPath($row['path']);
104  $staticPage->setConferenceId($row['conference_id']);
105 
106  $this->getDataObjectSettings('static_page_settings', 'static_page_id', $row['static_page_id'], $staticPage);
107  return $staticPage;
108  }
109 
111  return $this->getInsertId('static_pages', 'static_page_id');
112  }
113 
118  function getLocaleFieldNames() {
119  return array('title', 'content');
120  }
121 
126  function updateLocaleFields(&$staticPage) {
127  $this->updateDataObjectSettings('static_page_settings', $staticPage, array(
128  'static_page_id' => $staticPage->getId()
129  ));
130  }
131 
139  function duplicatePathExists ($path, $conferenceId, $staticPageId = null) {
140  $params = array(
141  $conferenceId,
142  $path
143  );
144  if (isset($staticPageId)) $params[] = $staticPageId;
145 
146  $result = $this->retrieve(
147  'SELECT *
148  FROM static_pages
149  WHERE conference_id = ?
150  AND path = ?' .
151  (isset($staticPageId)?' AND NOT (static_page_id = ?)':''),
152  $params
153  );
154 
155  if($result->RecordCount() == 0) {
156  // no duplicate exists
157  $returner = false;
158  } else {
159  $returner = true;
160  }
161  return $returner;
162  }
163 }
164 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
updateLocaleFields(&$staticPage)
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
& getPlugin($category, $name)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
getStaticPageByPath($conferenceId, $path)
getStaticPage($staticPageId)
getInsertId($table='', $id='', $callHooks=true)
Definition: DAO.inc.php:225
updateDataObjectSettings($tableName, &$dataObject, $idArray)
Definition: DAO.inc.php:412
& _returnStaticPageFromRow(&$row)
& getStaticPagesByConferenceId($conferenceId, $rangeInfo=null)
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:152
updateStaticPage(&$staticPage)
duplicatePathExists($path, $conferenceId, $staticPageId=null)
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
getDataObjectSettings($tableName, $idFieldName, $idFieldValue, &$dataObject)
Definition: DAO.inc.php:498
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186
insertStaticPage(&$staticPage)
deleteStaticPageById($staticPageId)