pages/admin/AdminSettingsHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00017 import('pages.admin.AdminHandler');
00018 
00019 class AdminSettingsHandler extends AdminHandler {
00023    function AdminSettingsHandler() {
00024       parent::AdminHandler();
00025    }
00026 
00030    function settings() {
00031       $this->validate();
00032       $this->setupTemplate(true);
00033 
00034       import('admin.form.SiteSettingsForm');
00035 
00036       $settingsForm = new SiteSettingsForm();
00037       if ($settingsForm->isLocaleResubmit()) {
00038          $settingsForm->readInputData();
00039       } else {
00040          $settingsForm->initData();
00041       }
00042       $settingsForm->display();
00043    }
00044 
00050    function saveSettings($args, &$request) {
00051       $this->validate();
00052       $this->setupTemplate(true);
00053       $site =& $request->getSite();
00054 
00055       import('admin.form.SiteSettingsForm');
00056 
00057       $settingsForm = new SiteSettingsForm();
00058       $settingsForm->readInputData();
00059 
00060       if ($request->getUserVar('uploadSiteStyleSheet')) {
00061          if (!$settingsForm->uploadSiteStyleSheet()) {
00062             $settingsForm->addError('siteStyleSheet', __('admin.settings.siteStyleSheetInvalid'));
00063          }
00064       } elseif ($request->getUserVar('deleteSiteStyleSheet')) {
00065          $publicFileManager = new PublicFileManager();
00066          $publicFileManager->removeSiteFile($site->getSiteStyleFilename());
00067       } elseif ($request->getUserVar('uploadPageHeaderTitleImage')) {
00068          if (!$settingsForm->uploadPageHeaderTitleImage($settingsForm->getFormLocale())) {
00069             $settingsForm->addError('pageHeaderTitleImage', __('admin.settings.homeHeaderImageInvalid'));
00070          }
00071       } elseif ($request->getUserVar('deletePageHeaderTitleImage')) {
00072          $publicFileManager = new PublicFileManager();
00073          $setting = $site->getSetting('pageHeaderTitleImage');
00074          $formLocale = $settingsForm->getFormLocale();
00075          if (isset($setting[$formLocale])) {
00076             $publicFileManager->removeSiteFile($setting[$formLocale]['uploadName']);
00077             $setting[$formLocale] = array();
00078             $site->updateSetting('pageHeaderTitleImage', $setting, 'object', true);
00079 
00080             // Refresh site header
00081             $templateMgr =& TemplateManager::getManager();
00082             $templateMgr->assign('displaySitePageHeaderTitle', $site->getLocalizedPageHeaderTitle());
00083          }
00084       } elseif ($settingsForm->validate()) {
00085          $settingsForm->execute();
00086          import('notification.NotificationManager');
00087          $notificationManager = new NotificationManager();
00088          $notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
00089          $request->redirect(null, null, null, 'index');
00090       }
00091       $settingsForm->display();
00092    }
00093 }
00094 
00095 ?>

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