00001 <?php
00002
00015
00016
00017
00018 import('form.Form');
00019
00020 class SettingsForm extends Form {
00021
00023 var $journalId;
00024
00026 var $plugin;
00027
00033 function SettingsForm(&$plugin, $journalId) {
00034 $this->journalId = $journalId;
00035 $this->plugin = &$plugin;
00036
00037 parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
00038 $this->addCheck(new FormValidatorPost($this));
00039 }
00040
00044 function initData() {
00045 $journalId = $this->journalId;
00046 $plugin = &$this->plugin;
00047
00048 $this->setData('displayPage', $plugin->getSetting($journalId, 'displayPage'));
00049 $this->setData('limitRecentItems', $plugin->getSetting($journalId, 'limitRecentItems'));
00050 $this->setData('recentItems', $plugin->getSetting($journalId, 'recentItems'));
00051 }
00052
00056 function readInputData() {
00057 $this->readUserVars(array('displayPage','limitRecentItems','recentItems'));
00058
00059
00060 if ((int) $this->getData('recentItems') <= 0) $this->setData('recentItems', '');
00061 }
00062
00066 function execute() {
00067 $plugin = &$this->plugin;
00068 $journalId = $this->journalId;
00069
00070 $plugin->updateSetting($journalId, 'displayPage', $this->getData('displayPage'));
00071 $plugin->updateSetting($journalId, 'limitRecentItems', $this->getData('limitRecentItems') ? $this->getData('limitRecentItems') : 0);
00072 $plugin->updateSetting($journalId, 'recentItems', $this->getData('recentItems'));
00073 }
00074
00075 }
00076
00077 ?>