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

controllers/tab/settings/masthead/form/MastheadForm.inc.php

00001 <?php
00002 
00015 // Import the base Form.
00016 import('controllers.tab.settings.form.PressSettingsForm');
00017 
00018 class MastheadForm extends PressSettingsForm {
00019 
00023    function MastheadForm($wizardMode = false) {
00024       $settings = array(
00025          'name' => 'string',
00026          'initials' => 'string',
00027          'description' => 'string',
00028          'mailingAddress' => 'string',
00029          'pressEnabled' => 'bool',
00030          'customAboutItems' => 'object',
00031          'masthead' => 'string'
00032       );
00033 
00034       parent::PressSettingsForm($settings, 'controllers/tab/settings/masthead/form/mastheadForm.tpl', $wizardMode);
00035 
00036       $this->addCheck(new FormValidatorLocale($this, 'name', 'required', 'manager.setup.form.pressNameRequired'));
00037       $this->addCheck(new FormValidatorLocale($this, 'initials', 'required', 'manager.setup.form.pressInitialsRequired'));
00038    }
00039 
00040    //
00041    // Implement template methods from Form.
00042    //
00046    function getLocaleFieldNames() {
00047       return array('name', 'initials', 'description', 'customAboutItems', 'masthead');
00048    }
00049 
00050    //
00051    // Overridden methods from PressSettingsForm.
00052    //
00057    function initData(&$request) {
00058       parent::initData($request);
00059 
00060       $press =& $request->getPress();
00061       $this->setData('enabled', (int)$press->getEnabled());
00062       if ($this->getData('initials') == null) {
00063          $initials = array();
00064          foreach (array_keys($this->supportedLocales) as $locale) {
00065             $initials[$locale] = $press->getPath();
00066          }
00067          $this->setData('initials', $initials);
00068       }
00069    }
00070 
00075    function execute(&$request) {
00076       $press =& $request->getPress();
00077 
00078       if ($press->getEnabled() !== $this->getData('pressEnabled')) {
00079          $pressDao =& DAORegistry::getDAO('PressDAO');
00080          $press->setEnabled($this->getData('pressEnabled'));
00081          $pressDao->updateObject($press);
00082       }
00083 
00084       parent::execute($request);
00085    }
00086 }
00087 
00088 ?>

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