• Main Page
  • Modules
  • Classes
  • Files
  • File List

classes/press/Press.inc.php

00001 <?php
00002 
00020 class Press extends DataObject {
00024    function Press() {
00025       parent::DataObject();
00026    }
00027 
00032    function getId() {
00033       return $this->getData('pressId');
00034    }
00035 
00040    function setId($pressId) {
00041       $this->setData('pressId', $pressId);
00042    }
00043 
00048    function getLocalizedName() {
00049       return $this->getLocalizedSetting('name');
00050    }
00051 
00056    function setName($name) {
00057       $this->setData('name', $name);
00058    }
00059 
00063    function getName($locale) {
00064       return $this->getSetting('name', $locale);
00065    }
00066 
00071    function getContactName() {
00072       return $this->getSetting('contactName');
00073    }
00074 
00079    function setContactName($contactName) {
00080       $this->setData('contactName', $contactName);
00081    }
00082 
00087    function getContactEmail() {
00088       return $this->getSetting('contactEmail');
00089    }
00090 
00095    function setContactEmail($contactEmail) {
00096       $this->setData('contactEmail', $contactEmail);
00097    }
00098 
00103    function getDescription() {
00104       return $this->getData('description');
00105    }
00106 
00112    function setDescription($description) {
00113       $this->setData('description', $description);
00114    }
00115 
00120    function getPath() {
00121       return $this->getData('path');
00122    }
00123 
00128    function setPath($path) {
00129       return $this->setData('path', $path);
00130    }
00131 
00136    function getEnabled() {
00137       return $this->getData('enabled');
00138    }
00139 
00144    function setEnabled($enabled) {
00145       return $this->setData('enabled',$enabled);
00146    }
00147 
00152    function getPrimaryLocale() {
00153       return $this->getData('primaryLocale');
00154    }
00155 
00160    function setPrimaryLocale($primaryLocale) {
00161       return $this->setData('primaryLocale', $primaryLocale);
00162    }
00167    function getSequence() {
00168       return $this->getData('sequence');
00169    }
00170 
00175    function setSequence($sequence) {
00176       return $this->setData('sequence', $sequence);
00177    }
00178 
00183    function getLocalizedDescription() {
00184       return $this->getLocalizedSetting('description');
00185    }
00186 
00191    function &getSettings() {
00192       $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
00193       $settings =& $pressSettingsDao->getPressSettings($this->getData('pressId'));
00194       return $settings;
00195    }
00196 
00203    function &getSetting($name, $locale = null) {
00204       $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
00205       $setting =& $pressSettingsDao->getSetting($this->getData('pressId'), $name, $locale);
00206       return $setting;
00207    }
00208 
00216    function updateSetting($name, $value, $type = null, $isLocalized = false) {
00217       $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
00218       return $pressSettingsDao->updateSetting($this->getId(), $name, $value, $type, $isLocalized);
00219    }
00220 
00221    function &getLocalizedSetting($name) {
00222       $returner = $this->getSetting($name, AppLocale::getLocale());
00223       if ($returner === null) {
00224          unset($returner);
00225          $returner = $this->getSetting($name, AppLocale::getPrimaryLocale());
00226       }
00227       return $returner;
00228    }
00234    function &getSupportedFormLocaleNames() {
00235       $supportedLocales =& $this->getData('supportedFormLocales');
00236 
00237       if (!isset($supportedLocales)) {
00238          $supportedLocales = array();
00239          $localeNames =& AppLocale::getAllLocales();
00240 
00241          $locales = $this->getSetting('supportedFormLocales');
00242          if (!isset($locales) || !is_array($locales)) {
00243             $locales = array();
00244          }
00245 
00246          foreach ($locales as $localeKey) {
00247             $supportedLocales[$localeKey] = $localeNames[$localeKey];
00248          }
00249       }
00250 
00251       return $supportedLocales;
00252    }
00253 
00259    function getPressPageHeaderTitle() {
00260       $typeArray = $this->getSetting('pageHeaderTitleType');
00261       $imageArray = $this->getSetting('pageHeaderTitleImage');
00262       $titleArray = $this->getSetting('pageHeaderTitle');
00263 
00264       $title = null;
00265 
00266       foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) {
00267          if (isset($typeArray[$locale]) && $typeArray[$locale]) {
00268             if (isset($imageArray[$locale])) $title = $imageArray[$locale];
00269          }
00270          if (empty($title) && isset($titleArray[$locale])) $title = $titleArray[$locale];
00271          if (!empty($title)) return $title;
00272       }
00273       return null;
00274    }
00275 
00280    function getPressPageHeaderLogo() {
00281       $logoArray = $this->getSetting('pageHeaderLogoImage');
00282       foreach (array(AppLocale::getLocale(), AppLocale::getPrimaryLocale()) as $locale) {
00283          if (isset($logoArray[$locale])) return $logoArray[$locale];
00284       }
00285       return null;
00286    }
00287 
00293    function &getSupportedLocaleNames() {
00294       $supportedLocales =& $this->getData('supportedLocales');
00295 
00296       if (!isset($supportedLocales)) {
00297          $supportedLocales = array();
00298          $localeNames =& AppLocale::getAllLocales();
00299 
00300          $locales = $this->getSetting('supportedLocales');
00301          if (!isset($locales) || !is_array($locales)) {
00302             $locales = array();
00303          }
00304 
00305          foreach ($locales as $localeKey) {
00306             $supportedLocales[$localeKey] = $localeNames[$localeKey];
00307          }
00308       }
00309 
00310       return $supportedLocales;
00311    }
00312 
00318    function hasRequiredOnixHeaderFields() {
00319       if ($this->getSetting('codeType') != '' && $this->getSetting('codeValue') != '') {
00320          return true;
00321       } else {
00322          return false;
00323       }
00324    }
00325 }
00326 
00327 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1