Index
The root of data based modules
This class mainly adds a data management infrastructure to TIP_Module, allowing for a full interaction between TIP_Template and TIP_Data throught the use of TIP_Data_View instances.
Contains a reference to the binded TIP_Data object
The file to run on view actions
The file to run on browse actions
The file to run at the beginning of a 'pager' tag
This template must reside in the application directory.
The file to run for every row on the 'pager' tag
The file to run on empty result set
This template must reside in the application directory.
The file to run at the end of a 'pager' tag
This template must reside in the application directory.
The file to run to generate the atom feed
The magic field id containing the creation datetime
The magic field id containing to owner user id
The magic field id to use by default on browse actions
The magic field id containing the last edit datetime
The magic field id containing the user id of the last editor
The magic field id containing the counter of edits performed a row
The magic field id containing the counter of actionView
The magic field id specifying the title for rendering operations
The magic field id specifying the tooltip for rendering operations
The magic field containing the date of the last actionView
The search field(s) to be scanned
Statistic user fields
An associative array of field ids in TIP_User to increment whenever a callback action in this module has been called.
Default browse conditions
A default filter, specified as string, or an array of "field id" => values to be applied on any browse action.
Default order field
Browsable fields
An array of field ids enabled in the 'browse' action, specified for each privilege.
Explicit options to pass to the form
The type of the id field: any valid settype() type is allowed
Enable expiration time for row ownership
If set, the isOwner() and related methods will return true only if the request is done before this time is elapsed after the creation of the row. Obviously, this means the "creation_field" property must be set and work properly.
Any value accepted by the strtotime() function is valid.
Constructor
Initializes a TIP_Content instance.
Get the active TIP_Data instance
Get the current view
Get a field value
Gets a field from the current row of the current view.
Get a summary value
Gets a summary value from the current view.
Return the value of a generic item
Gets the value of a generic item. This implementation adds the field feature to the TIP_Module::getItem() method.
Getting an item performs some search operations with this priority:
that is their values are not built from real data fields.
* Summary value of the current view throught getSummary().
* Chain-up the parent method TIP_Module::getItem().
The first succesful search operation will stop the sequence.
Form management
Generates a form with the specified $options and executes $action on it.
The default values of the form (that usually must be present in $options['defaults']) can also be specified by providing a row $id. If both are provided, the two arrays are merged, with the one in $options['defaults'] with higher priority. Before merging, if $action is TIP_FORM_ACTION_ADD, the primary key on the read row is stripped.
If $action is not TIP_FORM_ACTION_ADD and either $id or $options['defaults'] are not provided, the current row is assumed as default values. If there is not current row, an error is raised.
Push a view
Pushes a view object in the stack of this module. You can restore the previous view calling pop().
Pop a view
Pops a view object from the stack of this module. This operation restores the previously active view.
Start a generic view
Starts a view trying to instantiate the class named "TIP_{$type}_View".
Furthermore, some options are automatically set to the following defaults if not explicitely specified in the $options array: * $options['data'] = the TIP_Data object of this module
Start a data view
Creates a TIP_Data_View instance, providing also an easy way to specify the filter instead of setting $options['filter'].
The main difference between this function and using startView() directly is that here "default_conditions" and "default_order" properties are automatically applied on global queries (that is, whenever $filter is empty). In this case, the model used by the rendering operations is populated too.
See startView() for further details.
Ends a view
Ends the current view. Ending a view means the previously active view in the internal stack is made current.
Usually, you always have to close all views. Anyway, in some situations, is useful to have the base view ever active (so called default view) where all tags of a TIP_Content refers if no views were started. In any case, you can't have more endView() than start[Data]View().
Get a specific GET value
If $id is not specified, it defaults to the primary key of the binded data.
This is an high level method that notify errors to the user if $id is not found.
Get a specific GET or POST value
If $id is not specified, it defaults to the primary key of the binded data.
This is an high level method that notify errors to the user if $id is not found.
Get a specific row
Gets a reference to a specific row. If $id is not specified, the current row is assumed.
This is an high level method that notify errors to the user if the row is not found.
The method starts (and ends) a view to find a row, so every further requests will be cached.
Check if a row is owned by the current user
Checks if the owner field in the row identified by $id is equal to the current user id, that is if $id is owned by the current user.
This is an high level method that raises errors and notify them to the user on any errors: use it only when error notify is needed.
If there are no errors but the row is not owned by the current user, the 'denied' error is notified.
Check if a row is not owned by the current user
Similar to isOwner(), but works in the reverse way: check if the row identified by $id is NOT owned by the current user.
Shortcut to build a filter on the owned field
Update the magic fields
Fills the magic fields (if found and not set) with their magic values.
Render to XHTML
Render to rows
Builds an array of rows from this content data. Useful to automatically define the options of a <select> item for a TIP_Form instance.
Render specific rows
Works in the same way of toRows(), but rendering only the rows with the id specified in the $ids array.
Htmlize the first defined request
Overrides the default tagHtml() providing highlighting on requests of search fields.
Fields to use in the next queries
Changes the field subset in SELECT queries. $params must be a comma separated list of field ids. If $params is empty the default fieldset will be used.
Wikize the field specified in $params
The value of the field with $params id is parsed and rendered by the Text_Wiki renderer accordling to the wiki rules defined in the widget args of this field.
Get a partial content of a wiki field
$params must be a string in the form "field_id[,len[,wordlen]]", where id is the id of a wiki field, len is the number of characters to be echoed and wordlen is the maximum length of a single word. len defaults to 100 while wordlen defaults to 25.
Return a link to the atom feeder
In $params you can specify a query to perform, a date field or leave it blank to use the default behavior (that is use the $creation_field).
The default behaviour is to keep the last three days or (for empty result set) the last ten records.
Browse the content throught a chronology interface
Renders the whole data content in a chronology tree. The options must be specified in the $params argument as a comma-separated list of field ids in the following sequence:
date_field,title_field,tooltip_field,count_field,base_action
All the fields are optionals, in which case the TIP_Chronology default value is used.
Perform the browse query throught a pager
$params is a string in the form "quanto,query_adds".
The quanto is the number of rows per page: leave it undefined to disable the pager. In query_adds you can specify additional SQL commands to append to the query, such as ORDER clauses.
This function checks if there is a row more than what specified in the quanto: this provides a simple way to know whether the 'NEXT' button must be rendered or not.
Echo the rendered XHTML
Renders the whole TIP_Content rows in XHTML. In $params there should be the template action string to use to build the links.
View the current row content
Shows the current row using a standard frozen form. If $params is specified, the row with $params as primary key is shown instead.
Perform an add action
Generates and executes a TIP_Form instance to add a new row. The $id argument can be used to duplicate an existing row. If left null, an empty row is used as default.
If no $options are specified, the default behaviour is to render the form in the page and to try to call actionView() on the result when the form is validated.
Notice also that $options['on_process'], if not specified, will be set to the _onAdd() default callback.
Perform an edit action
Generates and executes a TIP_Form instance to edit a row.
If no $options are specified, the default behaviour is to render both valid and invalid form in the page.
Notice also that $options['on_process'], if not specified, will be set to the _onEdit() default callback.
Perform a delete action
Generates and executes a TIP_Form instance to delete a row.
If no $options are specified, the default behaviour is to render both valid and invalid form in the page.
Notice also that $options['on_process'], if not specified, will be set to the _onDelete() default callback.
Perform a view action
Runs the file identified by the 'view_template' property for the specified row. The rendered result is appended to the page.
Perform a browse action
In $conditions, you must specify an associative array of 'field_id' => 'value' to impose for this browse action. Only equal conditions are allowed.
Perform a search action
TIP_Contentwas last modified by TiP on Mon 25 May 2009 06:22:25 PM CEST