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)  

SiteDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
16 // $Id$
17 
18 
19 import('site.Site');
20 
21 class SiteDAO extends DAO {
26  function &getSite() {
27  $site = null;
28  $result =& $this->retrieve(
29  'SELECT * FROM site'
30  );
31 
32  if ($result->RecordCount() != 0) {
33  $site =& $this->_returnSiteFromRow($result->GetRowAssoc(false));
34  }
35 
36  $result->Close();
37  unset($result);
38 
39  return $site;
40  }
41 
48  function &_returnSiteFromRow(&$row, $callHook = true) {
49  $site = new Site();
50  $site->setRedirect($row['redirect']);
51  $site->setMinPasswordLength($row['min_password_length']);
52  $site->setPrimaryLocale($row['primary_locale']);
53  $site->setOriginalStyleFilename($row['original_style_file_name']);
54  $site->setInstalledLocales(isset($row['installed_locales']) && !empty($row['installed_locales']) ? explode(':', $row['installed_locales']) : array());
55  $site->setSupportedLocales(isset($row['supported_locales']) && !empty($row['supported_locales']) ? explode(':', $row['supported_locales']) : array());
56 
57  if ($callHook) HookRegistry::call('SiteDAO::_returnSiteFromRow', array(&$site, &$row));
58 
59  return $site;
60  }
61 
66  function insertSite(&$site) {
67  $returner = $this->update(
68  'INSERT INTO site
69  (redirect, min_password_length, primary_locale, installed_locales, supported_locales, original_style_file_name)
70  VALUES
71  (?, ?, ?, ?, ?, ?)',
72  array(
73  $site->getRedirect(),
74  (int) $site->getMinPasswordLength(),
75  $site->getPrimaryLocale(),
76  join(':', $site->getInstalledLocales()),
77  join(':', $site->getSupportedLocales()),
78  $site->getOriginalStyleFilename()
79  )
80  );
81  return $returner;
82  }
83 
88  function updateObject(&$site) {
89  return $this->update(
90  'UPDATE site
91  SET
92  redirect = ?,
93  min_password_length = ?,
94  primary_locale = ?,
95  installed_locales = ?,
96  supported_locales = ?,
97  original_style_file_name = ?',
98  array(
99  $site->getRedirect(),
100  (int) $site->getMinPasswordLength(),
101  $site->getPrimaryLocale(),
102  join(':', $site->getInstalledLocales()),
103  join(':', $site->getSupportedLocales()),
104  $site->getOriginalStyleFilename()
105  )
106  );
107  }
108 
109  function updateSite(&$site) {
110  if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
111  return $this->updateObject($site);
112  }
113 }
114 
115 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
& _returnSiteFromRow(&$row, $callHook=true)
Definition: SiteDAO.inc.php:48
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
& getSite()
Definition: SiteDAO.inc.php:26
updateSite(&$site)
updateObject(&$site)
Definition: SiteDAO.inc.php:88
Operations for retrieving and modifying the Site object.
Definition: SiteDAO.inc.php:21
getVar($section, $key, $default=null)
Definition: Config.inc.php:35
call($hookName, $args=null)
Describes system-wide site properties.
Definition: Site.inc.php:23
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186
insertSite(&$site)
Definition: SiteDAO.inc.php:66