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) | |
| Pluf_Shortcuts_GetFormForModel | ( | $ | model, | |
| $ | data = null, |
|||
| $ | extra = array(), |
|||
| $ | label_suffix = null | |||
| ) |
Get a given form from a model.
| Object | The model. | |
| array | Data to bound the form (null) | |
| array | Extra parameters (array()) | |
| string | Label suffix (null) |
| 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.
| string | Model | |
| int | Id of the model to get |
| 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));
| string | Model | |
| string | Base SQL request | |
| string | Parameters for the base SQL |
| 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.
| string | Template file name | |
| array | Associative array for the context | |
| Pluf_HTTP_Request | Request object (null) |