Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
MastheadForm.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.tab.settings.form.ContextSettingsForm');
17 
19 
23  function MastheadForm($wizardMode = false) {
24  $settings = array(
25  'name' => 'string',
26  'acronym' => 'string',
27  'description' => 'string',
28  'mailingAddress' => 'string',
29  'pressEnabled' => 'bool',
30  'customAboutItems' => 'object',
31  'masthead' => 'string'
32  );
33 
34  parent::ContextSettingsForm($settings, 'controllers/tab/settings/masthead/form/mastheadForm.tpl', $wizardMode);
35 
36  $this->addCheck(new FormValidatorLocale($this, 'name', 'required', 'manager.setup.form.pressNameRequired'));
37  $this->addCheck(new FormValidatorLocale($this, 'acronym', 'required', 'manager.setup.form.pressInitialsRequired'));
38  }
39 
40  //
41  // Implement template methods from Form.
42  //
46  function getLocaleFieldNames() {
47  return array('name', 'acronym', 'description', 'customAboutItems', 'masthead');
48  }
49 
50  //
51  // Overridden methods from ContextSettingsForm.
52  //
57  function initData($request) {
58  parent::initData($request);
59 
60  $press = $request->getPress();
61  $this->setData('enabled', (int)$press->getEnabled());
62  if ($this->getData('acronym') == null) {
63  $acronym = array();
64  foreach (array_keys($this->supportedLocales) as $locale) {
65  $acronym[$locale] = $press->getPath();
66  }
67  $this->setData('acronym', $acronym);
68  }
69  }
70 
75  function execute($request) {
76  $press = $request->getPress();
77 
78  if ($press->getEnabled() !== $this->getData('pressEnabled')) {
79  $pressDao = DAORegistry::getDAO('PressDAO');
80  $press->setEnabled($this->getData('pressEnabled'));
81  $pressDao->updateObject($press);
82  }
83 
84  parent::execute($request);
85  }
86 }
87 
88 ?>
Form to edit masthead settings.
static & getDAO($name, $dbconn=null)
addCheck($formValidator)
Definition: Form.inc.php:396
setData($key, $value)
Definition: Form.inc.php:219
MastheadForm($wizardMode=false)
getData($key)
Definition: Form.inc.php:210
Class to represent a form validation check for localized fields.
Base class for forms that manage context settings data.
execute($request)
initData($request)