00001 <?php
00002
00019
00020
00021 import('form.Form');
00022
00023 class AuthSourceSettingsForm extends Form {
00024
00026 var $authId;
00027
00029 var $plugin;
00030
00035 function AuthSourceSettingsForm($authId) {
00036 parent::Form('admin/auth/sourceSettings.tpl');
00037 $this->authId = $authId;
00038 $this->addCheck(new FormValidatorPost($this));
00039 }
00040
00044 function display() {
00045 $templateMgr =& TemplateManager::getManager();
00046 $templateMgr->assign('authId', $this->authId);
00047 $templateMgr->assign('helpTopicId', 'site.siteManagement');
00048
00049 if (isset($this->plugin)) {
00050 $this->plugin->addLocaleData();
00051 $templateMgr->assign('pluginTemplate', $this->plugin->getSettingsTemplate());
00052 }
00053
00054 parent::display();
00055 }
00056
00060 function initData() {
00061 $authDao =& DAORegistry::getDAO('AuthSourceDAO');
00062 $auth =& $authDao->getSource($this->authId);
00063
00064 if ($auth != null) {
00065 $this->_data = array(
00066 'plugin' => $auth->getPlugin(),
00067 'title' => $auth->getTitle(),
00068 'settings' => $auth->getSettings()
00069 );
00070 $this->plugin =& $auth->getPluginClass();
00071 }
00072 }
00073
00077 function readInputData() {
00078 $this->readUserVars(array('title', 'settings'));
00079 }
00080
00084 function execute() {
00085 $authDao =& DAORegistry::getDAO('AuthSourceDAO');
00086
00087 $auth = new AuthSource();
00088 $auth->setAuthId($this->authId);
00089 $auth->setTitle($this->getData('title'));
00090 $auth->setSettings($this->getData('settings'));
00091
00092 $authDao->updateObject($auth);
00093 }
00094 }
00095
00096 ?>