00001 <?php
00002
00015
00016
00017
00018 import('form.Form');
00019
00020 class ThesisSettingsForm extends Form {
00021
00023 var $journalId;
00024
00026 var $plugin;
00027
00029 var $validOrder;
00030
00036 function ThesisSettingsForm(&$plugin, $journalId) {
00037 $this->journalId = $journalId;
00038 $this->plugin = &$plugin;
00039
00040 $this->validOrder = array (
00041 THESIS_ORDER_SUBMISSION_DATE_ASC => Locale::translate('plugins.generic.thesis.settings.order.submissionDateAsc'),
00042 THESIS_ORDER_SUBMISSION_DATE_DESC => Locale::translate('plugins.generic.thesis.settings.order.submissionDateDesc'),
00043 THESIS_ORDER_APPROVAL_DATE_ASC => Locale::translate('plugins.generic.thesis.settings.order.approvalDateAsc'),
00044 THESIS_ORDER_APPROVAL_DATE_DESC => Locale::translate('plugins.generic.thesis.settings.order.approvalDateDesc'),
00045 THESIS_ORDER_LASTNAME_ASC => Locale::translate('plugins.generic.thesis.settings.order.lastNameAsc'),
00046 THESIS_ORDER_LASTNAME_DESC => Locale::translate('plugins.generic.thesis.settings.order.lastNameDesc'),
00047 THESIS_ORDER_TITLE_ASC => Locale::translate('plugins.generic.thesis.settings.order.titleAsc'),
00048 THESIS_ORDER_TITLE_DESC => Locale::translate('plugins.generic.thesis.settings.order.titleDesc')
00049 );
00050
00051 parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
00052
00053 $this->addCheck(new FormValidator($this, 'thesisName', 'required', 'plugins.generic.thesis.settings.thesisNameRequired'));
00054 $this->addCheck(new FormValidatorEmail($this, 'thesisEmail', 'required', 'plugins.generic.thesis.settings.thesisEmailRequired'));
00055
00056 $this->addCheck(new FormValidatorInSet($this, 'thesisOrder', 'required', 'plugins.generic.thesis.settings.thesisOrderValid', array_keys($this->validOrder)));
00057
00058 $this->addCheck(new FormValidatorPost($this));
00059 }
00060
00064 function display() {
00065 $templateMgr = &TemplateManager::getManager();
00066 $templateMgr->assign('validOrder', $this->validOrder);
00067 parent::display();
00068 }
00069
00073 function initData() {
00074 $journalId = $this->journalId;
00075 $plugin = &$this->plugin;
00076
00077 $this->_data = array(
00078 'enableUploadCode' => $plugin->getSetting($journalId, 'enableUploadCode'),
00079 'uploadCode' => $plugin->getSetting($journalId, 'uploadCode'),
00080 'validOrder' => $this->validOrder,
00081 'thesisOrder' => $plugin->getSetting($journalId, 'thesisOrder'),
00082 'thesisName' => $plugin->getSetting($journalId, 'thesisName'),
00083 'thesisEmail' => $plugin->getSetting($journalId, 'thesisEmail'),
00084 'thesisPhone' => $plugin->getSetting($journalId, 'thesisPhone'),
00085 'thesisFax' => $plugin->getSetting($journalId, 'thesisFax'),
00086 'thesisMailingAddress' => $plugin->getSetting($journalId, 'thesisMailingAddress'),
00087 'thesisIntroduction' => $plugin->getSetting($journalId, 'thesisIntroduction')
00088 );
00089 }
00090
00094 function readInputData() {
00095 $this->readUserVars(array('enableUploadCode', 'uploadCode', 'thesisOrder', 'thesisName', 'thesisEmail', 'thesisPhone', 'thesisFax', 'thesisMailingAddress', 'thesisIntroduction'));
00096
00097 if (!empty($this->_data['enableUploadCode'])) {
00098 $this->addCheck(new FormValidator($this, 'uploadCode', 'required', 'plugins.generic.thesis.settings.uploadCodeRequired'));
00099 }
00100 }
00101
00105 function execute() {
00106 $plugin = &$this->plugin;
00107 $journalId = $this->journalId;
00108
00109 $plugin->updateSetting($journalId, 'enableUploadCode', $this->getData('enableUploadCode'), 'bool');
00110 $plugin->updateSetting($journalId, 'uploadCode', $this->getData('uploadCode'), 'string');
00111 $plugin->updateSetting($journalId, 'thesisOrder', $this->getData('thesisOrder'), 'int');
00112 $plugin->updateSetting($journalId, 'thesisName', $this->getData('thesisName'), 'string');
00113 $plugin->updateSetting($journalId, 'thesisEmail', $this->getData('thesisEmail'), 'string');
00114 $plugin->updateSetting($journalId, 'thesisPhone', $this->getData('thesisPhone'), 'string');
00115 $plugin->updateSetting($journalId, 'thesisFax', $this->getData('thesisFax'), 'string');
00116 $plugin->updateSetting($journalId, 'thesisMailingAddress', $this->getData('thesisMailingAddress'), 'string');
00117 $plugin->updateSetting($journalId, 'thesisIntroduction', $this->getData('thesisIntroduction'), 'string');
00118 }
00119
00120 }
00121
00122 ?>