Index
Base class for modules
The template engine: required for TIP_Application instances
Contains a reference to the template engine to use when parsing a file. See the TIP_Template class for details on what is a template engine. If not configured, it defaults to the one of the main module (that obviously MUST be configured).
The locale prefix
A string to be prepended while looking for locale strings. If not specified, it defaults to getType().
The anonymous privilege level for this module
If not specified, it defaults to the anonymous privilege of the main application module, that must be configured.
The default privilege level for this module
If not specified, it defaults to the default privilege of the main application module, that must be configured.
The current privilege descriptor
Custom keys
Every TIP_Module object can have a bounch of key => value pairs. These properties are mantained in this array and are used, for instance, by the getItem() method. Also, remember an object inherits the keys from its parents, in a hierarchy order.
Check the options
Overridable static method that checks $options for missing or invalid values and eventually corrects its content.
Constructor
Initializes a TIP_Module instance.
Overridable post construction method
Called after the construction happened. This can be overriden to do some other post costruction operation.
In TIP_Module, the postConstructor() method initializes the privilege stuff. This cannot be done in the constructor itsself, because the privilege level needs the TIP_User and TIP_Privilege modules to be instantiated, so it will lead to a mutual recursion if this operation is done directly in TIP_Module().
Refresh the privileges
Refreshes the privileges of this module. If $privilege is not defined, gets the proper privilege using the default TIP_Privilege instance.
Get a localized text
Gets the localized text for a specified module. $id is prefixed by the 'locale_prefix' property.
This method always returns a valid string: if the localized text can't be retrieved, a string containing prefix.$id is returned and a warning message is logged.
See the TIP_Locale::get() method for technical details on how the text is localized.
Localize an id
Similar to getLocale() but the result is stored in $dst instead of returned. Also, it provides a way to prepend a prefix and append a suffix on $id before calling getLocale() by specifing them in the $modifiers array.
Useful as callback in array_walk arguments.
Return the value of a generic item
Gets the value of a generic item. The item is the basic form of dynamic data in TIP: it is a generic pair of key => value data with a dynamic value. Examples of items are keys fields.
This method can be overriden by the children to provide a more sophisticated interface, such as the fields management in the TIP_Content objects.
Get the value of a pair throught a "request" interface
This method is usually used by the template engine interface methods (the tag... functions) to access any pair information available in the TIP system.
A request can get the value of an item, a get, a post or a localized text: the type of the request is obtained parsing the $request token. Specify
item[...]
for items,
get[...]
for gets,
post[...]
for posts and
locale[...]
for localized text, specifying the id in place of the ellipsize.
If no type is specified (that is, $request is directly an identifier), the system will expand it in
item[...]
. This means
getRequest('name')
is logically equivalent to
getRequest('item[name]')
.
Get the first valid request
Given an array of requests, gets the first request in this array that has a not-null value.
Try to execute a template file
Parses and executes the specified file. Similar to run(), but it does not raise any warning/error if $path is not found.
Execute a template file
Parses and executes the specified file. If $path is a string, the module id is prepended to the real path.
Prepend a template file to the page
Runs the $path template using the current template engine and puts the result at the beginning of the page.
Append a template file to the page
Runs the $path template using the current template engine and puts the result at the end of the page.
Execute a tag
Executes the specified tag, using $params as arguments. This function prepend 'tag' to $name and try to call the so formed method. If you, for instance, runs getTag('Test', ''), a tagTest('') call will be performed.
A tag is a request from the template engine to echoes something. It can be tought as the dinamic primitive of the TIP system: every dinamic tag parsed by the template engine runs a tag.
The tags - as everything else - are inherited from the module parents, so every TIP_Module tags are available to the TIP_Module children.
Execute an action
Executes the Action action. This function tries to run Action by calling the following protected methods in this order:
The first method called depends on the current privilege, get throught a TIP::getPrivilege() call. The first method that returns true (meaning the requested action is executed) stops the chain.
Usually the actions are called adding variables to the URI. An example of an action call is the following: http://www.example.org/?module=news&action=view&id=23
This URI will call the "view" action on the "news" module, setting "id" to 23 (it is request to view a news and its comments). You must check the documentation of every module to see which actions are available and what variables they require.
Check if a string is not empty
Check if a request is set
$params is a string in the form "request,request,...".
Expand to 'true' if the current request is an AHAH request
Output the first defined request
$params is a string in the form "request,request,...".
This tag will perform a serie of request and will echo the first value found.
Try to output the first defined request
$params is a string in the form "request,request,...".
Equal to tagRaw(), but do not log any warning if the request is not found.
Htmlize the first defined request
$params is a string in the form "request,request,...".
Equals to tagRaw(), but the result is converted throught TIP::toHtml() before the output.
Try to htmlize the first defined request
$params is a string in the form "request,request,...".
Equals to tagTryRaw(), but the result is converted throught TIP::toHtml() before the output.
Localized label
$params is the id of the string to localize. If there are no dots, the current module id and '.label.' are prepended to $params.
Output a properly localized string.
Get the property value specified in $params
Get the raw property value specified in $params
Change a property value
$params must be a string in the format 'property,value'.
Append a string to a property
$params must be a string in the format 'property,string'.
Build a relative URI: $params must be referred to the site root
Build a relative URI: $params must be referred to the template root
If the URI does not point to a readable file, the fallback URI is used.
Build a relative URI: $params must be referred to the module data root
Build a relative URI: $params must be referred to the module data root
Build a relative URI: $params must be referred to the module template root
Build an icon URI
Build a relative action URI
$params is a string in the form "action[,id[,param1=value1,param2=value2,...]]" The module name can be overriden specifying it as module=...
Check if $params is the current user id
Expands to true if the current logged-in user id equals to $params or false otherwise.
Execute a template
Executes the template file $params found in the current module template path, using the current template engine.
Check if a value is in a list
$params is a string in the form "needle,value1,value2,...".
Outputs true if needle is present in the comma separated list of values. Useful to check if a value is contained (that is, if it is selected) in a "set" or "enum" field.
Format a datetime
Converts a datetime (in SQL format) to a specified format.
$params must be a string in the format '[date][,format]', where format is any format allowed by the TIP::formatDate() method. If the date is not specified, the current date is assumed. If the format is not specified, it defaults to 'date'.
Check if a module exists
Expands to true if the module module exists or to false otherwise. This tag only checks if the logic file for the $params module exists, does not load the module itsself nor change the default module.
Useful to provide conditional links between different modules.
Executes a management action
Executes an action that requires the 'manager' privilege.
Executes an administrator action
Executes an action that requires at least the 'admin' privilege.
Executes a trusted action
Executes an action that requires at least the 'trusted' privilege.
Executes an untrusted action
Executes an action that requires at least the 'untrusted' privilege.
Executes an unprivileged action
Executes an action that does not require any privileges.
TIP_Modulewas last modified by TiP on Mon 25 May 2009 06:22:25 PM CEST