pluf/src/Pluf/Shortcuts.php File Reference


Functions

 Pluf_Shortcuts_GetObjectOr404 ($object, $id)
 Pluf_Shortcuts_GetOneOr404 ($object, $bsql, $psql)
 Pluf_Shortcuts_RenderToResponse ($tplfile, $params, $request=null)
 Pluf_Shortcuts_GetFormForModel ($model, $data=null, $extra=array(), $label_suffix=null)

Function Documentation

Pluf_Shortcuts_GetFormForModel ( model,
data = null,
extra = array(),
label_suffix = null 
)

Get a given form from a model.

Parameters:
Object The model.
array Data to bound the form (null)
array Extra parameters (array())
string Label suffix (null)
Returns:
Object Form for this model.

Pluf_Shortcuts_GetObjectOr404 ( object,
id 
)

Shortcut methods to perform some operations.

Modelled on the django.shortcuts. Get an object by id or raise a 404 error.

Parameters:
string Model
int Id of the model to get
Returns:
Object The found object.

Pluf_Shortcuts_GetOneOr404 ( object,
bsql,
psql 
)

Get an object by SQL or raise a 404 error.

Usage:

 $obj = Pluf_Shortcuts_GetOneOr404('MyApp_Model',
                                   'path=s AND status=s',
                                    array('welcome', 1));
 

Parameters:
string Model
string Base SQL request
string Parameters for the base SQL
Returns:
Object The found object

Pluf_Shortcuts_RenderToResponse ( tplfile,
params,
request = null 
)

Render a template file and an array as a reponse.

If a none null request object is given, the context used will automatically be a Pluf_Template_Context_Request context and thus the context will be populated using the 'template_context_processors' functions.

Parameters:
string Template file name
array Associative array for the context
Pluf_HTTP_Request Request object (null)
Returns:
Pluf_HTTP_Response The response with the rendered template


Generated on Wed Feb 3 15:44:51 2010 for Pluf by  doxygen