phpLDAPadmin

# Class: Template

Source Location: /templates/3rdParty/pla/lib/Template.php

### Class Overview

    xmlTemplate
       |
       --Template

Template Class

#### Author(s):

### Variables

- $container
- $description
- $structural_oclass
- $title

### Methods

- __construct
- accept
- copy
- getAttrbyLdapType
- getAttributes
- getAttributesInternal
- getAttributesShown
- getAvailAttrs
- getContainer
- getContainerEncode
- getContext
- getDescription
- getDN
- getDNEncode
- getForceDeleteAttrs
- getIcon
- getLDAPadd
- getLDAPmodify
- getObjectClasses
- getRDN
- getRDNAttributeName
- getRDNAttrs
- getRegExp
- hasDefaultTemplate
- isAdminDisabled
- isAttrType
- isInValid
- isNoLeaf
- isReadOnly
- isVisible
- OnChangeAdd
- readTemplates
- setContainer
- setDN
- setInvalid
- setInvisible
- setRDNAttributes
- setVisible
- storeTemplate
- __clone

### Inherited Variables

#### Class: xmlTemplate

xmlTemplate::$attributes
xmlTemplate::$filename
xmlTemplate::$id
xmlTemplate::$name
xmlTemplate::$readtime
xmlTemplate::$server_id
xmlTemplate::$type

### Inherited Methods

#### Class: xmlTemplate

xmlTemplate::__construct()
xmlTemplate::addAttribute()
  Add another attribute to this template
xmlTemplate::getAttribute()
  Get a specific Attribute
xmlTemplate::getAttributeNames()
  Get the attribute names
xmlTemplate::getAttrID()
  Get an attribute ID
xmlTemplate::getFileName()
  Get the Template filename.
xmlTemplate::getID()
  Return the template by ID
xmlTemplate::getName()
  Return the template name
xmlTemplate::getReadTime()
  Get the Template read time.
xmlTemplate::getServer()
  Return this LDAP Server object
xmlTemplate::getServerID()
  Return the LDAP server ID
xmlTemplate::getTitle()
  Get template title
xmlTemplate::getType()
  Return the template type
xmlTemplate::isAdminDisabled()
  May be overloaded in other classes
xmlTemplate::isType()
  Test if a template is of a type

### Class Details

[line 31]
Template Class

#### Tags:

todo: | RDN attributes should be treated as MUST attributes even though the schema marks them as MAY
todo: | RDN attributes need to be checked that are included in the schema, otherwise mark it is invalid
todo: | askcontainer is no longer used?

[ Top ]

### Class Variables

#### $container =

[line 47]

#### Tags:

access: | protected

Type: | mixed

[ Top ]

#### $description = ''

[line 40]

#### Tags:

access: | protected

Type: | mixed

[ Top ]

#### $structural_oclass = array()

[line 39]

#### Tags:

access: | protected

Type: | mixed

[ Top ]

#### $title =

[line 53]

#### Tags:

access: | public

Type: | mixed

[ Top ]

### Class Methods

### constructor __construct [line 59]

`Template __construct( $server_id, [ $name = null], [ $filename = null], [ $type = null], [ $id = null])`

#### Tags:

access: | public

Overrides xmlTemplate::__construct() (parent method not documented)

#### Parameters:

| $server_id |
| $name |
| $filename |
| $type |
| $id |

[ Top ]

### method accept [line 261]

`void accept( [ $makeVisible = false])`

This function will perform the following intialisation steps:

- If a DN is set, query the ldap and load the object
- Read our $_REQUEST variable and set the values

After this action, the template should self describe as to whether it is an update, create or delete. (OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)

#### Tags:

access: | public

#### Parameters:

| $makeVisible |

[ Top ]

### method copy [line 687]

`void copy( $template, $rdn, [ $asnew = false])`

Copy a DN

#### Tags:

access: | public

#### Parameters:

| $template |
| $rdn |
| $asnew |

[ Top ]

### method getAttrbyLdapType [line 757]

`array getAttrbyLdapType( $type)`

Get Attributes by LDAP type This function will return a list of attributes by LDAP type (MUST,MAY).

#### Tags:

return: | Array of attributes.

#### Parameters:

| $type |

[ Top ]

### method getAttributes [line 950]

`array getAttributes( [boolean $optional = false])`

Get the attribute entries

#### Tags:

return: | Array of attributes
access: | public

#### Parameters:

boolean | $optional | Include the optional attributes

[ Top ]

### method getAttributesInternal [line 987]

`void getAttributesInternal( )`

Return a list of the internal attributes

#### Tags:

access: | public

[ Top ]

### method getAttributesShown [line 971]

`void getAttributesShown( )`

Return a list of attributes that should be shown

#### Tags:

access: | public

[ Top ]

### method getAvailAttrs [line 1527]

`void getAvailAttrs( )`

Get available attributes

#### Tags:

access: | public

[ Top ]

### method getContainer [line 669]

`dn getContainer( )`

Get the DN of the container for this entry

#### Tags:

return: | DN of the container
access: | public

[ Top ]

### method getContainerEncode [line 676]

`void getContainerEncode( [ $url = true])`

#### Tags:

access: | public

#### Parameters:

| $url |

[ Top ]

### method getContext [line 890]

`void getContext( )`

Determine the type of template this is

#### Tags:

access: | public

[ Top ]

### method getDescription [line 1031]

`string getDescription( )`

Return the template description

#### Tags:

return: | Description
access: | public

[ Top ]

### method getDN [line 621]

`dn getDN( )`

Display the DN for this template entry. If the DN is not set (creating a new entry), then a generated DN will be produced, taken from the RDN and the CONTAINER details.

#### Tags:

access: | public

[ Top ]

### method getDNEncode [line 637]

`void getDNEncode( [ $url = true])`

#### Tags:

access: | public

#### Parameters:

| $url |

[ Top ]

### method getForceDeleteAttrs [line 1508]

`void getForceDeleteAttrs( )`

Get the attributes that are marked as force delete We'll cache this result in the event of multiple calls.

#### Tags:

access: | public

[ Top ]

### method getIcon [line 1019]

`void getIcon( )`

Get template icon

#### Tags:

access: | public

[ Top ]

### method getLDAPadd [line 1392]

`void getLDAPadd( [ $attrsOnly = false])`

Return an array, that can be passed to ldap_add().

Attributes with empty values will be excluded.

#### Tags:

access: | public

#### Parameters:

| $attrsOnly |

[ Top ]

### method getLDAPmodify [line 1427]

`void getLDAPmodify( [boolean $attrsOnly = false], [ $index = 0])`

Return an array, that can be passed to ldap_mod_replace().

Only attributes that have changed their value will be returned.

This function will cache its results, so that it can be called with count() to see if there are changes, and if they are, the 2nd call will just return the results

#### Tags:

access: | public

#### Parameters:

boolean | $attrsOnly | Return the attribute objects (useful for a confirmation process), or the modification array for ldap_modify()
| $index |

[ Top ]

### method getObjectClasses [line 1005]

`array getObjectClasses( )`

Return the objectclasses defined in this template

#### Tags:

return: | Array of Objects
access: | public

[ Top ]

### method getRDN [line 837]

`rdn getRDN( )`

Return the RDN for this template. If the DN is already defined, then the RDN will be calculated from it.

If the DN is not set, then the RDN will be calcuated from the template attribute definitions

#### Tags:

return: | RDN for this template
access: | public

[ Top ]

### method getRDNAttributeName [line 865]

`void getRDNAttributeName( )`

Return the attribute name part of the RDN

#### Tags:

access: | public

[ Top ]

### method getRDNAttrs [line 808]

`array getRDNAttrs( )`

Get all the RDNs for this template, in RDN order.

#### Tags:

return: | RDNs in order.
access: | public

[ Top ]

### method getRegExp [line 924]

`void getRegExp( )`

#### Tags:

access: | public

[ Top ]

### method hasDefaultTemplate [line 229]

`boolean hasDefaultTemplate( )`

Is default templates enabled? This will disable the default template from the engine.

#### Tags:

access: | protected

[ Top ]

### method isAdminDisabled [line 1067]

`void isAdminDisabled( )`

#### Tags:

access: | public

Overrides xmlTemplate::isAdminDisabled() (May be overloaded in other classes)
[ Top ]

### method isAttrType [line 774]

`void isAttrType( $attr, $type)`

Return true if this is a MUST,MAY attribute

#### Parameters:

| $attr |
| $type |

[ Top ]

### method isInValid [line 1057]

`string isInValid( )`

Get the template validity or the reason it is invalid

#### Tags:

return: | Invalid reason, or false if not invalid
access: | public

[ Top ]

### method isNoLeaf [line 1563]

`void isNoLeaf( )`

#### Tags:

access: | public

[ Top ]

### method isReadOnly [line 934]

`void isReadOnly( )`

Test if this template has been marked as a read-only template

#### Tags:

access: | public

[ Top ]

### method isVisible [line 909]

`boolean isVisible( )`

Test if the template is visible

#### Tags:

access: | public

[ Top ]

### method OnChangeAdd [line 1111]

`void OnChangeAdd( $origin, $value)`

OnChangeAdd javascript processing

#### Tags:

access: | public

#### Parameters:

| $origin |
| $value |

[ Top ]

### method readTemplates [line 245]

`array readTemplates( $string $type)`

Return the templates of type (creation/modification)

#### Tags:

return: | - Array of templates of that type
access: | protected

#### Parameters:

$string | $type | type - creation/modification

[ Top ]

### method setContainer [line 651]

`void setContainer( dn $container)`

Set the container for this template, if we are creating entries

#### Tags:

todo: | Trigger a query to the LDAP server and generate an error if the container doesnt exist
access: | public

#### Parameters:

dn | $container | The DN of the container

[ Top ]

### method setDN [line 573]

`void setDN( dn $dn)`

Set the DN for this template, if we are editing entries

#### Tags:

access: | public

#### Parameters:

dn | $dn | The DN of the entry

[ Top ]

### method setInvalid [line 1043]

`void setInvalid( string $msg, [ $admin = false])`

Set a template as invalid

#### Tags:

access: | public

#### Parameters:

string | $msg | Message indicating the reason the template has been invalidated
| $admin |

[ Top ]

### method setInvisible [line 920]

`void setInvisible( )`

#### Tags:

access: | public

[ Top ]

### method setRDNAttributes [line 594]

`RDN setRDNAttributes( RDN $rdn)`

Set the RDN attributes Given an RDN, mark the attributes as RDN attributes. If there is no defined attribute, then the remaining RDNs will be returned.

#### Tags:

return: | attributes not processed
access: | public

#### Parameters:

RDN | $rdn |

[ Top ]

### method setVisible [line 916]

`void setVisible( )`

#### Tags:

access: | public

[ Top ]

### method storeTemplate [line 81]

`void storeTemplate( xmldata $xmldata)`

Main processing to store the template.

#### Tags:

access: | protected

#### Parameters:

xmldata | $xmldata | Parsed xmldata from xml2array object

[ Top ]

### method __clone [line 67]

`void __clone( )`

#### Tags:

access: | public

[ Top ]

Documentation generated on Tue, 22 Nov 2011 16:30:13 +0100 by phpDocumentor 1.4.1