00001 <?php
00002
00021
00022
00023
00024 import('form.Form');
00025
00026 class AuthSourceSettingsForm extends Form {
00027
00029 var $authId;
00030
00032 var $plugin;
00033
00038 function AuthSourceSettingsForm($authId) {
00039 parent::Form('admin/auth/sourceSettings.tpl');
00040 $this->addCheck(new FormValidatorPost($this));
00041 $this->authId = $authId;
00042 }
00043
00047 function display() {
00048 $templateMgr = &TemplateManager::getManager();
00049 $templateMgr->assign('authId', $this->authId);
00050 $templateMgr->assign('helpTopicId', 'site.siteManagement');
00051
00052 if (isset($this->plugin)) {
00053 $this->plugin->addLocaleData();
00054 $templateMgr->assign('pluginTemplate', $this->plugin->getSettingsTemplate());
00055 }
00056
00057 parent::display();
00058 }
00059
00063 function initData() {
00064 $authDao = &DAORegistry::getDAO('AuthSourceDAO');
00065 $auth = &$authDao->getSource($this->authId);
00066
00067 if ($auth != null) {
00068 $this->_data = array(
00069 'plugin' => $auth->getPlugin(),
00070 'title' => $auth->getTitle(),
00071 'settings' => $auth->getSettings()
00072 );
00073 $this->plugin = &$auth->getPluginClass();
00074 }
00075 }
00076
00080 function readInputData() {
00081 $this->readUserVars(array('title', 'settings'));
00082 }
00083
00087 function execute() {
00088 $authDao = &DAORegistry::getDAO('AuthSourceDAO');
00089
00090 $auth = &new AuthSource();
00091 $auth->setAuthId($this->authId);
00092 $auth->setTitle($this->getData('title'));
00093 $auth->setSettings($this->getData('settings'));
00094
00095 $authDao->updateSource($auth);
00096 }
00097
00098 }
00099
00100 ?>