array(), 'conflicts' => array('inetOrgPerson')); // available PDF fields $return['PDF_fields'] = array('description'); // help Entries $return['help'] = array ( 'description' => array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Host description. If left empty host name will be used."))); return $return; } // Constructor function init($base) { // call parent init parent::init($base); // load attribtues which are used in account objectClass $this->orig = $_SESSION[$this->base]->get_module_attributes('account'); $this->attributes = $_SESSION[$this->base]->get_module_attributes('account'); // Add objectClass to attributes $this->attributes['objectClass'][0] = 'account'; } // Variables // This variable contains all account attributes var $attributes; /* If an account was loaded all attributes are kept in this array * to compare it with new changed attributes */ var $orig; /* This function returns true if all required attributes from other * modules are set. This is required to prevent undefined states */ function module_ready() { return true; } /* This functions return true * if all needed settings are done */ function module_complete() { if (!$this->module_ready()) return false; 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'); } /* */ function get_help($id) { switch ($id) { case "description": return array ("ext" => "FALSE", "Headline" => _("Gecos"), "Text" => _("Host description. If left empty host name will be used.")); break; } return false; } /* This function returns all ldap attributes * which are part of account and returns * also their values. */ function get_attributes() { return $this->attributes; } /* This function loads all attributes into the object * $attr is an array as it's retured from ldap_get_attributes */ function load_attributes($attr) { // Load attributes which are displayed // unset count entries unset ($attr['count']); $attributes = array_keys($attr); foreach ($attributes as $attribute) unset ($attr[$attribute]['count']); // unset double entries for ($i=0; $iattributes[$attribute])) { // decode as unicode $this->attributes[$attribute] = $attr[$attribute]; for ($i=0; $iattributes[$attribute]); $i++) { $this->attributes[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); $this->orig[$attribute][$i] = utf8_decode ($this->attributes[$attribute][$i]); } } } // Add objectClass to orig because we don't want to add objectClass if it's already set $this->orig['objectClass'][0] = 'account'; return 0; } /* This function returns an array with 4 entries: * array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr), 'lamdaemon' => array(cmds)), DN2 .... ) * DN is the DN to change. It may be possible to change several DNs, * e.g. create a new user and add him to some groups via attribute memberUid * add are attributes which have to be added to ldap entry * remove are attributes which have to be removed from ldap entry * lamdaemon are lamdaemon commands to modify homedir, quotas, ... */ function save_attributes() { // Get easy attributes $return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); // Return attributes return $return; } function delete_attributes($post) { return 0; } /* Write variables into object and do some regexp checks */ function proccess_attributes($post, $profile=false) { // Load attributes $this->attributes['description'][0] = $post['description']; return 0; } /* This function will create the html-page * to show a page with all attributes. * It will output a complete html-table */ function display_html_attributes($post, $profile=false) { $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ), 1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0] ), 2 => array ('kind' => 'help', 'value' => 'description')); return $return; } function display_html_delete($post, $profile=false) { return 0; } /* * (non-PHPDoc) * @see baseModule#get_pdfEntries */ function get_pdfEntries($account_type = "user") { return array('account_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); } } ?>