modules

# Class: asteriskExtension

Source Location: /lib/modules/asteriskExtension.inc

### Class Overview

    baseModule
       |
       --asteriskExtension

Manages Asterisk extensions.

#### Author(s):

- Roland Gruber

### Methods

- array_sort
- build_uploadAccounts
- display_html_attributes
- display_html_user
- generateNextExtensionName
- getDefaultExtensionOwner
- get_metaData
- get_pdfEntries
- isExtensionOwnerSet
- isMoveToNewSuffix
- isThisExtensionPresented
- load_extension_parts
- load_Messages
- moveExtentionToNewSuffix
- postDeleteActions
- processExtensionRows
- processPriorityChange
- processSingleExtension
- process_attributes
- process_user
- render_extension
- render_extensions_by_priority
- render_exten_owners_set_controls
- save_attributes
- setDefaultExtensionOwner

### Inherited Variables

#### Class: baseModule

baseModule::$attributes
baseModule::$autoAddObjectClasses
baseModule::$messages
baseModule::$meta
baseModule::$moduleSettings
baseModule::$orig
baseModule::$selfServiceSettings

### Inherited Methods

#### Class: baseModule

baseModule::__construct()
  Creates a new base module class
baseModule::build_uploadAccounts()
  In this function the LDAP accounts are built.
baseModule::can_manage()
  Returns true if this module can manage accounts of the current type, otherwise false.
baseModule::checkSelfServiceOptions()
  Checks if all input values are correct and returns the LDAP attributes which should be changed.
baseModule::checkSelfServiceSettings()
  Checks if the self service settings are valid.
baseModule::check_configOptions()
  Checks input values of module settings.
baseModule::check_profileOptions()
  Checks input values of account profiles.
baseModule::delete_attributes()
  This function returns an array with the same syntax as save_attributes().
baseModule::displaySpecialSelfServicePage()
  This function creates meta HTML code to display the module specific page for the self service.
baseModule::display_html_attributes()
  This function creates meta HTML code to display the module page.
baseModule::display_html_delete()
  This function creates meta HTML code which will be displayed when an account should be deleted.
baseModule::doUploadPostActions()
  This function is responsible to do additional tasks after the account has been created in LDAP (e.g. modifying group memberships, adding Quota etc..).
baseModule::getAccountContainer()
  Returns the accountContainer object.
baseModule::getAttributes()
  Returns the LDAP attributes which are managed in this module.
baseModule::getButtonStatus()
  Controls if the module button the account page is visible and activated.
baseModule::getIcon()
  Returns the path to the module icon.
baseModule::getLDAPAliases()
  Returns a list of aliases for LDAP attributes.
baseModule::getLinkToSpecialSelfServicePage()
  This allows modules to create a link to a module specific page for the self service.
baseModule::getManagedAttributes()
  Returns a list of LDAP attributes which are managed by this module.
baseModule::getManagedObjectClasses()
  Returns a list of managed object classes for this module.
baseModule::getOriginalAttributes()
  Returns the LDAP attributes which are managed in this module (with unchanged values).
baseModule::getRequiredExtensions()
  This function returns a list of PHP extensions (e.g. hash) which are needed by this module.
baseModule::getSelfServiceFields()
  Returns a list of possible input fields and their descriptions.
baseModule::getSelfServiceOptions()
  Returns the meta HTML code for each input field.
baseModule::getSelfServiceSearchAttributes()
  This function returns a list of possible LDAP attributes (e.g. uid, cn, ...) which can be used to search for LDAP objects.
baseModule::getSelfServiceSettings()
  Returns a list of self service configuration settings.
baseModule::get_alias()
  Returns an alias name for the module.
baseModule::get_configOptions()
  Returns a list of configuration options.
baseModule::get_dependencies()
  This function returns a list with all depending and conflicting modules.
baseModule::get_help()
  This function returns the help entry array for a specific help id.
baseModule::get_ldap_filter()
  Returns an LDAP filter for the account lists
baseModule::get_metaData()
  This function provides meta data which is interpreted by baseModule.
baseModule::get_pdfEntries()
  Returns the PDF entries for this module.
baseModule::get_pdfFields()
  Returns a hashtable with all entries that may be printed out in the PDF.
baseModule::get_profileOptions()
  This function defines what attributes will be used in the account profiles and their appearance in the profile editor.
baseModule::get_RDNAttributes()
  Returns a hash array containing a list of possible LDAP attributes that can be used to form the RDN (Relative Distinguished Name).
baseModule::get_scope()
  Returns the account type of this module (user, group, host)
baseModule::get_uploadColumns()
  Returns an array containing all input columns for the file upload.
baseModule::get_uploadPreDepends()
  Returns a list of module names which must be processed in building the account befor this module.
baseModule::handleAjaxRequest()
  Manages AJAX requests.
baseModule::init()
  Initializes the module after it became part of an accountContainer
baseModule::isBooleanConfigOptionSet()
  Returns if the given configuration option is set.
baseModule::is_base_module()
  Returns true if your module is a base module and otherwise false.
baseModule::load_attributes()
  This function loads the LDAP attributes when an account should be loaded.
baseModule::load_Messages()
  This function fills the $messages variable with output messages from this module.
baseModule::load_profile()
  This function loads the values from an account profile to the module's internal data structures.
baseModule::module_complete()
  This function is used to check if all settings for this module have been made.
baseModule::module_ready()
  This function is used to check if this module page can be displayed.
baseModule::postDeleteActions()
  Allows the module to run commands after the LDAP entry is deleted.
baseModule::postModifyActions()
  Allows the module to run commands after the LDAP entry is changed or created.
baseModule::postModifySelfService()
  Allows the module to run commands after the LDAP entry is changed or created.
baseModule::preDeleteActions()
  Allows the module to run commands before the LDAP entry is deleted.
baseModule::preModifyActions()
  Allows the module to run commands before the LDAP entry is changed or created.
baseModule::preModifySelfService()
  Allows the module to run commands before the LDAP entry is changed or created.
baseModule::process_attributes()
  This function processes user input.
baseModule::save_attributes()
  Returns a list of modifications which have to be made to the LDAP account.

### Class Details

[line 41]
Manages Asterisk extensions.

#### Tags:

author: | Roland Gruber

[ Top ]

### Class Methods

### method array_sort [line 371]

`void array_sort( $array, $on, [ $order = 'SORT_ASC'])`

#### Parameters:

| $array |
| $on |
| $order |

[ Top ]

### method build_uploadAccounts [line 837]

`array build_uploadAccounts( array $rawAccounts, array $ids, &$partialAccounts, array $selectedModules, array $partialAccounts)`

In this function the LDAP account is built up.

#### Tags:

return: | list of error messages if any

Overrides baseModule::build_uploadAccounts() (In this function the LDAP accounts are built.)

#### Parameters:

array | $rawAccounts | list of hash arrays (name => value) from user input
array | $partialAccounts | list of hash arrays (name => value) which are later added to LDAP
array | $ids | list of IDs for column position (e.g. "posixAccount_uid" => 5)
array | $selectedModules | list of selected account modules
| &$partialAccounts |

[ Top ]

### method display_html_attributes [line 194]

`htmlElement display_html_attributes( )`

This function will create the meta HTML code to show a page with all attributes.

#### Tags:

return: | HTML meta data

Overrides baseModule::display_html_attributes() (This function creates meta HTML code to display the module page.)
[ Top ]

### method display_html_user [line 409]

`htmlElement display_html_user( )`

Displays a list of possible owners of this extension.

#### Tags:

return: | HTML meta data

[ Top ]

### method generateNextExtensionName [line 745]

`String generateNextExtensionName( )`

This function searches in the base subtree and finds all extensions names within.

The generation algorithm is the naive one, so only work when extension is numbers. All extension name is sorted and new extension name will be greates on + 1.

#### Tags:

return: | suggested extension name

[ Top ]

### method getDefaultExtensionOwner [line 647]

`String getDefaultExtensionOwner( )`

Returns the default extension owner.

#### Tags:

return: | owner

[ Top ]

### method get_metaData [line 61]

`array get_metaData( )`

Returns meta data that is interpreted by parent class

#### Tags:

return: | array with meta data

Overrides baseModule::get_metaData() (This function provides meta data which is interpreted by baseModule.)
[ Top ]

### method get_pdfEntries [line 780]

`void get_pdfEntries( )`

Returns a list of PDF entries
Overrides baseModule::get_pdfEntries() (Returns the PDF entries for this module.)
[ Top ]

### method isExtensionOwnerSet [line 529]

`boolean isExtensionOwnerSet( )`

Returns true if at least one owner is set and false otherwise

#### Tags:

return: | true if one or more owners

[ Top ]

### method isMoveToNewSuffix [line 514]

`boolean isMoveToNewSuffix( )`

Returns if the extension was moved to another OU.

#### Tags:

return: | true if moved

[ Top ]

### method isThisExtensionPresented [line 724]

`boolean isThisExtensionPresented( $extension)`

Search by extension name and retun true if fields with this extension name is presented and false otherwise.

#### Tags:

return: | true if there are entries with this extension name.

#### Parameters:

| $extension |

[ Top ]

### method load_extension_parts [line 249]

`void load_extension_parts( String $extension)`

Loads all related extension entries.

#### Parameters:

String | $extension | extension name

[ Top ]

### method load_Messages [line 176]

`void load_Messages( )`

This function fills the error message array with messages
Overrides baseModule::load_Messages() (This function fills the $messages variable with output messages from this module.)
[ Top ]

### method moveExtentionToNewSuffix [line 888]

`array moveExtentionToNewSuffix( $rowOrig)`

Get list of all applications for given extension and move it into new suffix.

#### Tags:

return: | list of error messages

#### Parameters:

| $rowOrig |

[ Top ]

### method postDeleteActions [line 981]

`array postDeleteActions( )`

Runs ufter main deltete procedure was done and do postmorten for other parts of extension wtith priority > 1.

#### Tags:

return: | error messages

Overrides baseModule::postDeleteActions() (Allows the module to run commands after the LDAP entry is deleted.)
[ Top ]

### method processExtensionRows [line 595]

`array processExtensionRows( String $extensionName, String $extensionContext)`

Processes the rule data.

#### Tags:

return: | error messages

#### Parameters:

String | $extensionName | extension name
String | $extensionContext | extension context

[ Top ]

### method processPriorityChange [line 705]

`void processPriorityChange( )`

Reorders the rules if the user clicked on a move button.
[ Top ]

### method processSingleExtension [line 664]

`void processSingleExtension( &$extRow, String $extensionName, String $extensionContext, int $entryCounter, int $extensionPriorityCntr, array $extRow)`

Fills the fileds of a single extension row.

In Asterisk it would only be an extension name,a priority,an application, but LDAP spicific add to processing context field.

#### Parameters:

array | $extRow | - hash array to store single extension properties;
String | $extensionName | extension name
String | $extensionContext | extension context
int | $entryCounter | - counter to distinguish single extensuion properties from $_POST
int | $extensionPriorityCntr | - it is the variable where actual number of extension rules wuld be aggregated
| &$extRow |

[ Top ]

### method process_attributes [line 541]

`array process_attributes( )`

Writes variables into object and does some regex checks.

#### Tags:

return: | error messages

Overrides baseModule::process_attributes() (This function processes user input.)
[ Top ]

### method process_user [line 481]

`array process_user( )`

Processes user input of the user selection page.

It checks if all input values are correct and updates the associated LDAP attributes.

#### Tags:

return: | list of info/error messages

[ Top ]

### method render_extension [line 352]

`void render_extension( array $extensLine, int $placeInList, htmlTable $renderContainer)`

Generates the meta HTML for a single rule.

#### Parameters:

array | $extensLine | attributes of rule
int | $placeInList | rule position
htmlTable | $renderContainer | container

[ Top ]

### method render_extensions_by_priority [line 272]

`void render_extensions_by_priority( String $extension, htmlTable $renderContainer)`

Generates the meta HTML for the rules.

#### Parameters:

String | $extension | extension name
htmlTable | $renderContainer | container

[ Top ]

### method render_exten_owners_set_controls [line 223]

`void render_exten_owners_set_controls( htmlTable $renderContainer)`

This function prints management elements to manipulate owners of an extension.

#### Parameters:

htmlTable | $renderContainer | container

[ Top ]

### method save_attributes [line 922]

`array save_attributes( )`

Returns a list of modifications which have to be made to the LDAP account.

Calling this method requires the existence of an enclosing accountContainer.

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 is 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 the LDAP entry
"remove" are attributes which have to be removed from the LDAP entry
"modify" are attributes which have to be modified in the LDAP entry
"notchanged" are attributes which stay unchanged
"info" values with informational value (e.g. to be used later by pre/postModify actions)
This builds the required comands from $this-attributes and $this->orig.

#### Tags:

return: | list of modifications

Overrides baseModule::save_attributes() (Returns a list of modifications which have to be made to the LDAP account.)
[ Top ]

### method setDefaultExtensionOwner [line 636]

`void setDefaultExtensionOwner( )`

Set extension owner as current logged in user.
[ Top ]

Documentation generated on Sun, 25 Mar 2012 19:35:23 +0200 by phpDocumentor 1.4.1