updated to new profile functions

This commit is contained in:
Roland Gruber 2004-10-10 11:40:31 +00:00
parent 5afddd33a9
commit ff16dd9ed0
1 changed files with 4 additions and 10 deletions

View File

@ -554,9 +554,7 @@ class accountContainer {
// load profile // load profile
if ($post['selectLoadProfile'] && $post['loadProfile']) { if ($post['selectLoadProfile'] && $post['loadProfile']) {
// *** fixme load*Profile must return array in the same way ldap_get_attributes does. // *** fixme load*Profile must return array in the same way ldap_get_attributes does.
$function = '$newattributes = load'.ucfirst($scope).'Profile($post[\'selectLoadProfile\']);'; $newattributes = loadAccountProfile($post['selectLoadProfile'], $scope);
//eval($function);
$newattributes = call_user_func('load'.ucfirst($scope).'Profile', $post['selectLoadProfile']);
// pass newattributes to each module // pass newattributes to each module
$modules = array_keys($this->module); $modules = array_keys($this->module);
foreach ($modules as $module) $this->module[$module]->load_attributes($newattributes); foreach ($modules as $module) $this->module[$module]->load_attributes($newattributes);
@ -573,9 +571,7 @@ class accountContainer {
if ($post['saveProfile']) { if ($post['saveProfile']) {
if ($post['selectSaveProfile']=='') $errors['saveProfile'][] = array('ERROR', _('Save profile'), _('No profilename given.')); if ($post['selectSaveProfile']=='') $errors['saveProfile'][] = array('ERROR', _('Save profile'), _('No profilename given.'));
else { else {
$function = 'save'.ucfirst($scope).'Profile();'; //saveAccountProfile($scope); // TODO missing parameters, remove?
//eval($function);
call_user_func('save'.ucfirst($scope).'Profile');
if ($function) $errors['saveProfile'][] = array('INFO', _('Save profile'), _('New profile created.')); if ($function) $errors['saveProfile'][] = array('INFO', _('Save profile'), _('New profile created.'));
else $errors['saveProfile'][] = array('ERROR', _('Save profile'), _('Wrong profilename given.')); else $errors['saveProfile'][] = array('ERROR', _('Save profile'), _('Wrong profilename given.'));
} }
@ -707,9 +703,7 @@ class accountContainer {
if (!$profile) { if (!$profile) {
// Get list of profiles // Get list of profiles
$function = '$profilelist = get'.ucfirst($this->type).'Profiles();'; $profilelist = getAccountProfiles($this->type);
//eval($function);
$profilelist = call_user_func('get'.ucfirst($this->type).'Profiles');
if (count($profilelist)!=0) { if (count($profilelist)!=0) {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Load profile") ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Load profile") ),
1 => array ( 'kind' => 'select', 'name' => 'selectLoadProfile', 'options' => $profilelist ), 1 => array ( 'kind' => 'select', 'name' => 'selectLoadProfile', 'options' => $profilelist ),
@ -1271,7 +1265,7 @@ class accountContainer {
// Write Module-Order in variable // Write Module-Order in variable
$this->order = array_merge ('main' ,$order); $this->order = array_merge ('main' ,$order);
// *** fixme load*Profile must return array in the same way ldap_get_attributes does. // *** fixme load*Profile must return array in the same way ldap_get_attributes does.
$function = '$newattributes = load'.ucfirst($this->type).'Profile(\'default\');'; $function = '$newattributes = load'.ucfirst($this->type).'Profile(\'default\');'; // TODO function is called loadAccountProfile()
//eval($function); //eval($function);
return 0; return 0;
} }