lib/modules/asteriskExtension.inc

Properties

Description

Manages Asterisk extensions.

Classes

asteriskExtension

Properties

 
 
modules  
No 
No 

Description

Manages Asterisk extensions.
It implements the complete module interface and uses meta-data provided by the account modules for its functions.

Location and naming of modules
All LAM modules are placed in lib/modules/ and are named ".inc". E.g. if you create a new module and its class name is "qmail" then the filename would be "qmail.inc". The class name of a module must contain only a-z, A-Z, 0-9, -, and _.

You can avoid to override many functions by using {@link get_metaData()}.

All module classes should extend the baseModule class.

Methods

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

array_sort( array   $array, String   $on, String   $order = 'SORT_ASC', ) : n/a

Description

Sorts an array of arrays by the given key.

Arguments

Name Type Description Default
$array array

array

$on String

key

$order String

order (SORT_ASC or SORT_DESC)

'SORT_ASC'

Return value

Type Description
n/a n/a

build_uploadAccounts( array   $rawAccounts, array   $ids, array   $partialAccounts, array   $selectedModules, ) : array

Description

In this function the LDAP account is built up.

Arguments

Name Type Description Default
$rawAccounts array

list of hash arrays (name => value) from user input

$ids array

list of IDs for column position (e.g. "posixAccount_uid" => 5)

$partialAccounts array

list of hash arrays (name => value) which are later added to LDAP

$selectedModules array

list of selected account modules

Return value

Type Description
array list of error messages if any

display_html_attributes( ) : \htmlElement

Description

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

Return value

Type Description
\htmlElement HTML meta data

display_html_user( ) : \htmlElement

Description

Displays a list of possible owners of this extension.

Return value

Type Description
\htmlElement HTML meta data

generateNextExtensionName( ) : String

Description

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.

Return value

Type Description
String suggested extension name

getDefaultExtensionOwner( ) : String

Description

Returns the default extension owner.

Return value

Type Description
String owner

get_metaData( ) : array

Description

Returns meta data that is interpreted by parent class

Return value

Type Description
array array with meta data

get_pdfEntries( ) : n/a

Description

Returns a list of PDF entries

Return value

Type Description
n/a n/a

isExtensionOwnerSet( ) : boolean

Description

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

Return value

Type Description
boolean true if one or more owners

isMoveToNewSuffix( ) : boolean

Description

Returns if the extension was moved to another OU.

Return value

Type Description
boolean true if moved

isThisExtensionPresented( String   $extension, ) : boolean

Description

Search by extension name and retun true if fields with this extension name exists and false otherwise.
Equal extension names are allowed in different OUs.

Arguments

Name Type Description Default
$extension String

extension name

Return value

Type Description
boolean true if there are entries with this extension name.

load_Messages( ) : n/a

Description

This function fills the error message array with messages

Return value

Type Description
n/a n/a

load_extension_parts( String   $extension, ) : n/a

Description

Loads all related extension entries.

Arguments

Name Type Description Default
$extension String

extension name

Return value

Type Description
n/a n/a

moveExtentionToNewSuffix( array   $rowOrig, ) : array

Description

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

Arguments

Name Type Description Default
$rowOrig array

attributes of original extension

Return value

Type Description
array list of error messages

postDeleteActions( ) : array

Description

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

Return value

Type Description
array error messages

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

Description

Processes the rule data.

Arguments

Name Type Description Default
$extensionName String

extension name

$extensionContext String

extension context

Return value

Type Description
array error messages

processPriorityChange( ) : n/a

Description

Reorders the rules if the user clicked on a move button.

Return value

Type Description
n/a n/a

processSingleExtension( array   $extRow, String   $extensionName, String   $extensionContext, int   $entryCounter, int   $extensionPriorityCntr, ) : n/a

Description

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.

Arguments

Name Type Description Default
$extRow array
  • hash array to store single extension properties;
$extensionName String

extension name

$extensionContext String

extension context

$entryCounter int
  • counter to distinguish single extensuion properties from $_POST
$extensionPriorityCntr int
  • it is the variable where actual number of extension rules wuld be aggregated

Return value

Type Description
n/a n/a

process_attributes( ) : array

Description

Writes variables into object and does some regex checks.

Return value

Type Description
array error messages

process_user( ) : array

Description

Processes user input of the user selection page.
It checks if all input values are correct and updates the associated LDAP attributes.

Return value

Type Description
array list of info/error messages

render_exten_owners_set_controls(   $renderContainer, ) : n/a

Description

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

Arguments

Name Type Description Default
$renderContainer n/a

Return value

Type Description
n/a n/a

render_extension( array   $extensLine, int   $placeInList, \htmlTable   $renderContainer, ) : n/a

Description

Generates the meta HTML for a single rule.

Arguments

Name Type Description Default
$extensLine array

attributes of rule

$placeInList int

rule position

$renderContainer \htmlTable

container

Return value

Type Description
n/a n/a

render_extensions_by_priority( String   $extension, \htmlTable   $renderContainer, ) : n/a

Description

Generates the meta HTML for the rules.

Arguments

Name Type Description Default
$extension String

extension name

$renderContainer \htmlTable

container

Return value

Type Description
n/a n/a

save_attributes( ) : array

Description

Returns a list of modifications which have to be made to the LDAP account.
Calling this method requires the existence of an enclosing {@link 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.

Return value

Type Description
array list of modifications

setDefaultExtensionOwner( ) : n/a

Description

Set extension owner as current logged in user.

Return value

Type Description
n/a n/a

Properties

$addRuleFlag, $extensionOwners, $extensionRows, $extensionRowsOrig, $filterOwnerForAsteriskAccounts, $searchOwnersInTreeSuffix,

  private  $addRuleFlag = false

flag if new rule should be added


  private  $extensionOwners = array()

extension owners


  private  $extensionRows = array()

Contains all attributes information for set of accounts


  private  $extensionRowsOrig = array()

Contains all original attributes information for set of accounts


  private  $filterOwnerForAsteriskAccounts = true

if true then only Asterisk accounts are shown as possible owners


  private  $searchOwnersInTreeSuffix = false

if true then the tree suffix will be used to search potential owners


Documentation was generated by phpDocumentor 2.0.1 .

Namespaces

  • global

    Packages