Cell width: allows an attribute "width" to set the cell width (e.g. | or | ).
* Line breaks: Line breaks can be specified by adding a < > tag. The new line will start at the left border of the PDF document.
*
*
* Examples:
*
* Simple name+value lines:
* In most cases you will just want to display a single line per attribute with its name and value.
*
* 'myAttribute' => 'AttrName12345'
*
* This will give the following PDF output:
*
* Attribute name: 12345
*
*
* Multiline values:
* Sometimes you have multivalued attributes where it is not applicable to write all values in one line but
* where you want to list your values one below the other or show a table. This can be done by using the | tag.
*
* This example only uses one column but you can just use more | tags per tag to display more columns.
*
* 'myAttribute' => 'AttrName123 | 456 | 789 | '
*
* @param string $scope account type
* @return array PDF entries
*
* @see baseModule::get_metaData()
*/
function get_pdf_entries($scope = 'user') {
return ((isset($this->meta['PDF_entries'])) ? $this->meta['PDF_entries'] : array());
}
/**
* Returns an array containing all input columns for the file upload.
*
* Syntax:
*
* array(
* string: name, // fixed non-translated name which is used as column name (should be of format: _)
* string: description, // short descriptive name
* string: help, // help ID
* string: example, // example value
* boolean: required // true, if user must set a value for this column
* )
*
* @return array column list
*/
function get_uploadColumns() {
if (isset($this->meta['upload_columns'])) return $this->meta['upload_columns'];
else return array();
}
/**
* Returns a list of module names which must be processed in building the account befor this module.
*
* @return array list of module names
*/
function get_uploadPreDepends() {
if (isset($this->meta['upload_preDepends'])) return $this->meta['upload_preDepends'];
else return array();
}
/**
* In this function the LDAP account is built up.
*
* @param array $rawAccounts list of hash arrays (name => value) from user input
* @param array $partialAccounts list of hash arrays (name => value) which are later added to LDAP
* @param array $ids list of IDs for column position (e.g. "posixAccount_uid" => 5)
* @return array list of error messages if any
*/
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts) {
// must be implemented in sub modules
return array();
}
/**
* This function returns the help entry array for a specific help id.
* The result is an hashtable with the following keys:
*
* - Headline (required)
* The headline of this help entry. Can consist of any alpha-numeric characters. No HTML/CSS elements are allowed.
* - Text (required)
* The text of the help entry which may contain any alpha-numeric characters.
* - SeeAlso (optional)
* A reference to anonther related web site. It must be an array containing a field called "text" with the link text
* that should be displayed and a field called "link" which is the link target.
*
*
* Example:
*
* array('Headline' => 'This is the head line', 'Text' => 'Help content', 'SeeAlso' => array('text' => 'LAM homepage', 'link' => 'http://lam.sf.net'))
*
* @param string $id The id string for the help entry needed.
* @return array The desired help entry.
*
* @see baseModule::get_metaData()
*/
function get_help($id) {
if(isset($this->meta['help'][$id])) {
return $this->meta['help'][$id];
}
elseif(isset($this->meta['help'][$this->scope][$id])) {
return $this->meta['help'][$this->scope][$id];
}
else {
return false;
}
}
/**
* This function is used to check if this module page can be displayed.
* It returns false if a module depends on data from other modules which was not yet entered.
*
* @return boolean true, if page can be displayed
*/
function module_ready() {
return true;
}
/**
* This functions is used to check if all settings for this module have been made.
*
* @return boolean true, if settings are complete
*/
function module_complete() {
return true;
}
/**
* Controls if the module button the account page is visible and activated.
*
* @return string status ("enabled", "disabled", "hidden")
*/
function getButtonStatus() {
return "enabled";
}
/**
* This function executes one post upload action.
*
* @param array $data array containing one account in each element
* @param array $ids array( => )
* @param array $failed list of accounts which were not created successfully
* @param array $temp variable to store temporary data between two post actions
* @return array current status
* array (
* 'status' => 'finished' | 'inProgress'
* 'progress' => 0..100
* 'errors' => array ()
* )
*/
function doUploadPostActions($data, $ids, $failed, &$temp) {
return array(
'status' => 'finished',
'progress' => 100,
'errors' => array()
);
}
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* This function returns an array with 3 entries:
* array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), 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
* "modify" are attributes which have to been modified in LDAP entry
*/
function save_attributes() {
return $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
}
/**
* Allows the module to run commands before the LDAP entry is changed or created.
* An error message should be printed if the function returns false.
*
* @param boolean $newAccount new account
* @return true, if no problems occured
*/
function preModifyActions($newAccount) {
return true;
}
/**
* Allows the module to run commands after the LDAP entry is changed or created.
*
* @param boolean $newAccount new account
*/
function postModifyActions($newAccount) {
return;
}
/**
* Allows the module to run commands before the LDAP entry is deleted.
* An error message should be printed if the function returns false.
*
* @return true, if no problems occured
*/
function preDeleteActions() {
return true;
}
/**
* Allows the module to run commands after the LDAP entry is deleted.
*/
function postDeleteActions() {
return;
}
/**
* Dummy function for modules which use no special options on account deletion.
*
* @return List of LDAP operations, same as for save_attributes()
*/
function delete_attributes() {
return 0;
}
/**
* Dummy function for modules which do not print extra HTML code on account deletion.
*
* @return meta HTML code
*/
function display_html_delete() {
return 0;
}
/**
* Returns a list of managed object classes for this module.
* This is used to fix incorrect spelled object class names.
*
* @return array list of object classes
*/
function getManagedObjectClasses() {
if (isset($this->meta['objectClasses']) && is_array($this->meta['objectClasses'])) return $this->meta['objectClasses'];
else return array();
}
/**
* Returns a list of aliases for LDAP attributes.
* All alias attributes will be renamed to the given attribute names.
*
* @return array list of aliases (alias name => attribute name)
*/
function getLDAPAliases() {
if (isset($this->meta['LDAPaliases']) && is_array($this->meta['LDAPaliases'])) return $this->meta['LDAPaliases'];
else return array();
}
/**
* Returns a list of LDAP attributes which are managed by this module.
* All attribute names will be renamed to match the given spelling.
*
* @return array list of attributes
*/
function getManagedAttributes() {
if (isset($this->meta['attributes']) && is_array($this->meta['attributes'])) return $this->meta['attributes'];
else return array();
}
/**
* Returns a list of required PHP extensions.
*
* @return array extensions
*/
function getRequiredExtensions() {
if (isset($this->meta['extensions']) && is_array($this->meta['extensions'])) return $this->meta['extensions'];
else return array();
}
/**
* Returns a list of possible search attributes for the self service.
*
* @return array attributes
*/
function getSelfServiceSearchAttributes() {
if (isset($this->meta['selfServiceSearchAttributes']) && is_array($this->meta['selfServiceSearchAttributes'])) return $this->meta['selfServiceSearchAttributes'];
else return array();
}
/**
* Returns a list of possible input fields and their descriptions
* Format: array( => )
*
* @return array fields
*/
function getSelfServiceFields() {
if (isset($this->meta['selfServiceFieldSettings']) && is_array($this->meta['selfServiceFieldSettings'])) return $this->meta['selfServiceFieldSettings'];
else return array();
}
/**
* Returns the meta HTML code for each input field.
* format: array( => array(), ...)
* It is not possible to display help links.
*
* @param array $fields list of active fields
* @param array $attributes attributes of LDAP account (attribute names in lower case)
* @return array meta HTML
*/
function getSelfServiceOptions($fields, $attributes) {
// this function must be overwritten by subclasses.
return array();
}
/**
* Checks if all input values are correct and returns the LDAP commands which should be executed.
*
* @param string $fields input fields
* @param array $attributes LDAP attributes
* @return array messages and LDAP commands (array('messages' => array(), 'add' => array(), 'del' => array(), 'mod' => array()))
*/
function checkSelfServiceOptions($fields, $attributes) {
$return = array('messages' => array(), 'add' => array(), 'del' => array(), 'mod' => array());
return $return;
}
/**
* Returns a list of self service configuration settings.
*
* @return array settings
*/
function getSelfServiceSettings() {
if (isset($this->meta['selfServiceSettings']) && is_array($this->meta['selfServiceSettings'])) return $this->meta['selfServiceSettings'];
else return array();
}
/**
* Checks if the self service settings are valid.
*
* @param array $options settings
* @return array error messages
*/
function checkSelfServiceSettings($options) {
// needs to be implemented by the subclasses, if needed
return array();
}
/**
* Returns the accountContainer object.
*
* @return accountContainer accountContainer object
*
*/
protected function getAccountContainer() {
if (isset($this->base) && isset($_SESSION[$this->base])) {
return $_SESSION[$this->base];
}
else {
return null;
}
}
/**
* Returns the LDAP attributes which are managed in this module.
*
* @return array attributes
*/
public function getAttributes() {
return $this->attributes;
}
/**
* Returns the LDAP attributes which are managed in this module (with unchanged values).
*
* @return array attributes
*/
public function getOriginalAttributes() {
return $this->orig;
}
/**
* Returns the path to the module icon.
* The path must be releative to graphics (e.g. key.png). You can also set $this->meta['icon'].
* The preferred size is 32x32px.
*
* @return unknown
*/
public function getIcon() {
if (isset($this->meta['icon'])) {
return $this->meta['icon'];
}
return null;
}
}
?> |