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('displayItems', $plugin->getSetting($journalId, 'displayItems'));
00050 $this->setData('recentItems', $plugin->getSetting($journalId, 'recentItems'));
00051 }
00052
00056 function readInputData() {
00057 $this->readUserVars(array('displayPage','displayItems','recentItems'));
00058
00059
00060 if ((int) $this->getData('recentItems') <= 0) $this->setData('recentItems', '');
00061
00062
00063 if ($this->getData('displayItems') == "recent") {
00064 $this->addCheck(new FormValidator($this, 'recentItems', 'required', 'plugins.generic.webfeed.settings.recentItemsRequired'));
00065 }
00066
00067 }
00068
00072 function execute() {
00073 $plugin = &$this->plugin;
00074 $journalId = $this->journalId;
00075
00076 $plugin->updateSetting($journalId, 'displayPage', $this->getData('displayPage'));
00077 $plugin->updateSetting($journalId, 'displayItems', $this->getData('displayItems'));
00078 $plugin->updateSetting($journalId, 'recentItems', $this->getData('recentItems'));
00079 }
00080
00081 }
00082
00083 ?>