00001 <?php
00002
00020
00021
00022
00023 class Site extends DataObject {
00027 function Site() {
00028 parent::DataObject();
00029 }
00030
00036 function &getSupportedLocaleNames() {
00037 static $supportedLocales;
00038
00039 if (!isset($supportedLocales)) {
00040 $supportedLocales = array();
00041 $localeNames = &Locale::getAllLocales();
00042
00043 $locales = $this->getSupportedLocales();
00044 foreach ($locales as $localeKey) {
00045 $supportedLocales[$localeKey] = $localeNames[$localeKey];
00046 }
00047
00048 asort($supportedLocales);
00049 }
00050
00051 return $supportedLocales;
00052 }
00053
00054
00055
00056
00057
00061 function getSiteTitle() {
00062 return $this->getLocalizedData('title');
00063 }
00064
00070 function getTitle($locale) {
00071 return $this->getData('title', $locale);
00072 }
00073
00079 function setTitle($title, $locale) {
00080 return $this->setData('title', $title, $locale);
00081 }
00082
00087 function getSitePageHeaderTitle() {
00088 $typeArray = $this->getData('pageHeaderTitleType');
00089 $imageArray = $this->getData('pageHeaderTitleImage');
00090 $titleArray = $this->getData('title');
00091
00092 $title = null;
00093
00094 foreach (array(Locale::getLocale(), Locale::getPrimaryLocale()) as $locale) {
00095 if (isset($typeArray[$locale]) && $typeArray[$locale]) {
00096 if (isset($imageArray[$locale])) $title = $imageArray[$locale];
00097 }
00098 if (empty($title) && isset($titleArray[$locale])) $title = $titleArray[$locale];
00099 if (!empty($title)) return $title;
00100 }
00101 return null;
00102 }
00103
00108 function getSitePageHeaderTitleType() {
00109 return $this->getLocalizedData('pageHeaderTitleType');
00110 }
00111
00117 function getPageHeaderTitleType($locale) {
00118 return $this->getData('pageHeaderTitleType');
00119 }
00120
00126 function setPageHeaderTitleType($pageHeaderTitleType, $locale) {
00127 $this->setData('pageHeaderTitleType', $pageHeaderTitleType, $locale);
00128 }
00129
00134 function getOriginalStyleFilename() {
00135 return $this->getData('originalStyleFilename');
00136 }
00137
00142 function setOriginalStyleFilename($originalStyleFilename) {
00143 return $this->setData('originalStyleFilename', $originalStyleFilename);
00144 }
00145
00149 function getSiteIntro() {
00150 return $this->getLocalizedData('intro');
00151 }
00152
00158 function getIntro($locale) {
00159 return $this->getData('intro', $locale);
00160 }
00161
00167 function setIntro($intro, $locale) {
00168 return $this->setData('intro', $intro, $locale);
00169 }
00170
00175 function getJournalRedirect() {
00176 return $this->getData('journalRedirect');
00177 }
00178
00183 function setJournalRedirect($journalRedirect) {
00184 return $this->setData('journalRedirect', (int)$journalRedirect);
00185 }
00186
00190 function getSiteAbout() {
00191 return $this->getLocalizedData('about');
00192 }
00193
00199 function getAbout($locale) {
00200 return $this->getData('about', $locale);
00201 }
00202
00208 function setAbout($about, $locale) {
00209 return $this->setData('about', $about, $locale);
00210 }
00211
00215 function getSiteContactName() {
00216 return $this->getLocalizedData('contactName');
00217 }
00218
00224 function getContactName($locale) {
00225 return $this->getData('contactName', $locale);
00226 }
00227
00233 function setContactName($contactName, $locale) {
00234 return $this->setData('contactName', $contactName, $locale);
00235 }
00236
00240 function getSiteContactEmail() {
00241 return $this->getLocalizedData('contactEmail');
00242 }
00243
00249 function getContactEmail($locale) {
00250 return $this->getData('contactEmail', $locale);
00251 }
00252
00258 function setContactEmail($contactEmail, $locale) {
00259 return $this->setData('contactEmail', $contactEmail, $locale);
00260 }
00261
00266 function getMinPasswordLength() {
00267 return $this->getData('minPasswordLength');
00268 }
00269
00274 function setMinPasswordLength($minPasswordLength) {
00275 return $this->setData('minPasswordLength', $minPasswordLength);
00276 }
00277
00282 function getPrimaryLocale() {
00283 return $this->getData('primaryLocale');
00284 }
00285
00290 function setPrimaryLocale($primaryLocale) {
00291 return $this->setData('primaryLocale', $primaryLocale);
00292 }
00293
00298 function getInstalledLocales() {
00299 $locales = $this->getData('installedLocales');
00300 return isset($locales) ? $locales : array();
00301 }
00302
00307 function setInstalledLocales($installedLocales) {
00308 return $this->setData('installedLocales', $installedLocales);
00309 }
00310
00315 function getSupportedLocales() {
00316 $locales = $this->getData('supportedLocales');
00317 return isset($locales) ? $locales : array();
00318 }
00319
00324 function setSupportedLocales($supportedLocales) {
00325 return $this->setData('supportedLocales', $supportedLocales);
00326 }
00327
00332 function getSiteStyleFilename() {
00333 return 'sitestyle.css';
00334 }
00335
00342 function &getSetting($name, $locale = null) {
00343 $siteSettingsDao = &DAORegistry::getDAO('SiteSettingsDAO');
00344 $setting = &$siteSettingsDao->getSetting($name, $locale);
00345 return $setting;
00346 }
00347
00355 function updateSetting($name, $value, $type = null, $isLocalized = false) {
00356 $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
00357 return $siteSettingsDao->updateSetting($name, $value, $type, $isLocalized);
00358 }
00359 }
00360
00361 ?>