current_page = 0; // reset subpage counter $this->subpage = ''; // Get local copy of name of account_container in session $this->base = $base; } // Variables // This variable stores the number of the current displayed page var $current_page; // This variable os set to the pagename of a subpage if it should be displayed var $subpage; // name of accountContainer so we can read other classes in accuontArray var $base; function get_alias() { return _('main'); } /* This function returns a list with all required modules */ function get_dependencies($scope) { return array('require' => array(), 'conflict' => array() ); } function module_ready() { return true; } /* This function returns a list of all html-pages in module * This is usefull for mass upload and pdf-files * because lam can walk trough all pages itself and do some * error checkings */ function pages() { return array('attributes', 'finish'); } // Dummy functions to make module compatible function get_attributes() { return array(); } // Dummy functions to make module compatible function load_attributes($attr) { return 0; } // Dummy functions to make module compatible function save_attributes() { return array(); } function delete_attributes($post) { $return = array(); return $return; } /* Write variables into object and do some regexp checks */ function proccess_attributes($post) { // change dn if ($post['suffix']!='') $_SESSION[$this->base]->dn = $post['suffix']; // load profile if ($post['selectLoadProfile'] && $post['loadProfile']) { // *** fixme load*Profile must return array in the same way ldap_get_attributes does. $function = '$newattributes = load'.ucfirst($scope).'Profile($post[\'selectLoadProfile\']);'; eval($function); // pass newattributes to each module $modules = array_keys($_SESSION[$this->base]->module); foreach ($modules as $module) $_SESSION[$this->base]->module[$module]->load_attributes($newattributes); return 0; } // save account if ($post['create']) { $success = $_SESSION[$this->base]->save_account(); if (is_array($success)) return array($success); // return name of subpage return 'finish'; } // save profile if ($post['saveProfile']) { if ($post['selectSaveProfile']=='') $errors[] = array('ERROR', _('Save profile'), _('No profilename given.')); else { $function = 'save'.ucfirst($scope).'Profile();'; eval($function); if ($function) $errors[] = array('INFO', _('Save profile'), _('New profile created.')); else $errors[] = array('ERROR', _('Save profile'), _('Wrong profilename given.')); } if (is_array($errors)) return $errors; else return 0; } return 0; } /* Write variables into object and do some regexp checks */ function proccess_finish($post) { if ($post['createagain']) { // Reset objects $modules = array_keys($_SESSION[$this->base]->module); foreach ($modules as $module) if ($module!='main') unset($_SESSION[$this->base]->module[$module]); // Reset accountContainer $_SESSION[$this->base]->dn = ''; $_SESSION[$this->base]->dn_orig = ''; $_SESSION[$this->base]->attributes = array(); $_SESSION[$this->base]->order = array(); $this->current_page = 0; $this->subpage = ''; // Add all required objects etc. $_SESSION[$this->base]->new_account(); return 0; } if ($post['backmain']) { // Return to *-list // *** fixme unset accountContainer in session metaRefresh("../lists/list".$_SESSION[$this->base]->type."s.php"); exit; } if ($post['outputpdf']) { // Create / display PDf-file $function = 'create'.ucfirst($_SESSION[$this->base]->type).'PDF(array($_SESSION[$this->base]));'; eval($function); exit; } } function display_html_attributes($post) { // Get list of profiles $function = '$profilelist = get'.ucfirst($_SESSION[$this->base]->type).'Profiles();'; eval($function); $modules = $_SESSION[$this->base]->check_attributes(); if (count($modules)!=0) { $disabled = 'disabled'; // Show reason why module is disabled for ($i=0; $ibase]->module[$modules[$i]]->alias)); } else $disabled = ''; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; // Show fieldset with list of all user profiles if (count($profilelist)!=0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
" . _('Suffix') . "" . _('Help') . "
" . _("Load profile") . "\n"; echo "" . _('Help') . "
" . _("Save profile") . "\n"; echo "" . _('Help') . "
base]->dn_orig!='') echo _('Modify Account'); else echo _('Create Account'); echo "\" $disabled >
\n"; return 0; } function display_html_delete($post) { return 0; } /* This page will be shown if an account * has been saved */ function display_html_finish($post) { // Show success message if ($_SESSION[$this->base]->dn_orig=='') $kind = _('created'); else $kind = _('modified'); $text = sprintf(_('%s has been %s.'), ucfirst($_SESSION[$this->base]->type), $kind); StatusMessage('INFO', _('LDAP operation successful.'), $text); // Show rest of page echo "\n"; echo "\n"; if ($_SESSION[$this->base]->dn_orig=='') { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "
base]->type); echo "\">base]->type); echo "\">
\n"; return 0; } } ?>