classes/conference/Conference.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00020 //$Id$
00021 
00022 define('PAPER_ACCESS_OPEN',         0x00000000);
00023 define('PAPER_ACCESS_ACCOUNT_REQUIRED',      0x00000001);
00024 define('PAPER_ACCESS_REGISTRATION_REQUIRED', 0x00000002);
00025 
00026 class Conference extends DataObject {
00027    //
00028    // Conference functions: the following do not operate on data from the
00029    // ConferenceSettings table.
00030    //
00031 
00035    function Conference() {
00036       parent::DataObject();
00037    }
00038 
00043    function getUrl() {
00044       return Request::url($this->getPath());
00045    }
00046 
00051    function getConferenceTitle() {
00052       return $this->getLocalizedSetting('title');
00053    }
00054 
00060    function getTitle($locale) {
00061       return $this->getSetting('title', $locale);
00062    }
00063 
00068    function getConferenceDescription() {
00069       return $this->getLocalizedSetting('description');
00070    }
00071 
00077    function getDescription($locale) {
00078       return $this->getSetting('description', $locale);
00079    }
00080 
00085    function getEnabled() {
00086       return $this->getData('enabled');
00087    }
00088 
00093    function setEnabled($enabled) {
00094       return $this->setData('enabled',$enabled);
00095    }
00096 
00101    function getConferenceId() {
00102       if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
00103       return $this->getId();
00104    }
00105 
00110    function setConferenceId($conferenceId) {
00111       if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
00112       return $this->setId($conferenceId);
00113    }
00114 
00119    function getPath() {
00120       return $this->getData('path');
00121    }
00122 
00127    function setPath($path) {
00128       return $this->setData('path', $path);
00129    }
00130 
00135    function getSequence() {
00136       return $this->getData('sequence');
00137    }
00138 
00143    function setSequence($sequence) {
00144       return $this->setData('sequence', $sequence);
00145    }
00146 
00147    //
00148    // ConferenceSettings functions: the following make use of data in the
00149    // ConferenceSettings table.
00150    //
00151 
00156    function &getSettings() {
00157       $conferenceSettingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
00158       $settings =& $conferenceSettingsDao->getConferenceSettings($this->getId());
00159       return $settings;
00160    }
00161 
00162    function &getLocalizedSetting($name) {
00163       $returner = $this->getSetting($name, AppLocale::getLocale());
00164       if ($returner === null) {
00165          unset($returner);
00166          $returner = $this->getSetting($name, AppLocale::getPrimaryLocale());
00167       }
00168       return $returner;
00169    }
00170 
00177    function &getSetting($name, $locale = null) {
00178       $conferenceSettingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
00179       $setting =& $conferenceSettingsDao->getSetting($this->getId(), $name, $locale);
00180       return $setting;
00181    }
00182 
00190    function updateSetting($name, $value, $type = null, $isLocalized = false) {
00191       $conferenceSettingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
00192       return $conferenceSettingsDao->updateSetting($this->getConferenceId(), $name, $value, $type, $isLocalized);
00193    }
00194 
00199    function getPrimaryLocale() {
00200       return $this->getData('primaryLocale');
00201    }
00202 
00207    function setPrimaryLocale($primaryLocale) {
00208       $this->setData('primaryLocale', $primaryLocale);
00209    }
00210 
00216    function &getSupportedLocaleNames() {
00217       static $supportedLocales;
00218 
00219       if (!isset($supportedLocales)) {
00220          $supportedLocales = array();
00221          $localeNames =& AppLocale::getAllLocales();
00222 
00223          $locales = $this->getSetting('supportedLocales');
00224          if (!isset($locales) || !is_array($locales)) {
00225             $locales = array();
00226          }
00227 
00228          foreach ($locales as $localeKey) {
00229             $supportedLocales[$localeKey] = $localeNames[$localeKey];
00230          }
00231       }
00232 
00233       return $supportedLocales;
00234    }
00235 
00241    function &getSupportedFormLocaleNames() {
00242       $supportedLocales =& $this->getData('supportedFormLocales');
00243 
00244       if (!isset($supportedLocales)) {
00245          $supportedLocales = array();
00246          $localeNames =& AppLocale::getAllLocales();
00247 
00248          $locales = $this->getSetting('supportedFormLocales');
00249          if (!isset($locales) || !is_array($locales)) {
00250             $locales = array();
00251          }
00252 
00253          foreach ($locales as $localeKey) {
00254             $supportedLocales[$localeKey] = $localeNames[$localeKey];
00255          }
00256       }
00257 
00258       return $supportedLocales;
00259    }
00260 
00266    function getPageHeaderTitle($home = false) {
00267       $prefix = $home ? 'home' : 'page';
00268       $typeArray = $this->getSetting($prefix . 'HeaderTitleType');
00269       $imageArray = $this->getSetting($prefix . 'HeaderTitleImage');
00270       $titleArray = $this->getSetting($prefix . 'HeaderTitle');
00271 
00272       $title = null;
00273 
00274       foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) {
00275          if (isset($typeArray[$locale]) && $typeArray[$locale]) {
00276             if (isset($imageArray[$locale])) $title = $imageArray[$locale];
00277          }
00278          if (empty($title) && isset($titleArray[$locale])) $title = $titleArray[$locale];
00279          if (!empty($title)) return $title;
00280       }
00281       return null;
00282    }
00283 
00289    function getPageHeaderLogo($home = false) {
00290       $prefix = $home ? 'home' : 'page';
00291       $logoArray = $this->getSetting($prefix . 'HeaderLogoImage');
00292       foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) {
00293          if (isset($logoArray[$locale])) return $logoArray[$locale];
00294       }
00295       return null;
00296    }
00297    
00302    function getLocalizedFavicon() {
00303       $faviconArray = $this->getSetting('conferenceFavicon');
00304       foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) {
00305          if (isset($faviconArray[$locale])) return $faviconArray[$locale];
00306       }
00307    }
00308       
00309 }
00310 
00311 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7