redirectTo()
redirectTo( $request, $match, $url)
Simple redirection view.
Parameters
$request | ||
$match | ||
$url |
Basic Pluf fices
To start a module as fast as possible, you need a basic views such as model CRUD and list. Here is a list of a basic views which are very common in your desing.
If you follow SEEN API guid line, the view is verry usefull in your implementation.
loadTemplate(\Pluf_HTTP_Request $request, array $match) : \Pluf_HTTP_Response
Creates a template and returns as result
در بسیاری از کاربردها نرمافزار کاربردی به صفحههای متفاوتی شکسته میشود و بر اساس حالت کاربر یکی از صفحهها نمایش داده میشود. به این ترتیب حجم دانلود برای هر صفحه کم شده و توسعه هر صفحه نیز راحتر میشود.
این فراخوانی این امکان را ایجاد میکند که در لایه نمایش به سادگی یکی از الگوها را فراخوانی کرده و آن را به عنوان نتیجه برای کاربران نمایش دهید.
\Pluf_HTTP_Request | $request | |
array | $match |
findObject(\Pluf_HTTP_Request $request, array $match, $p = array()) : \Pluf_Paginator
List objects (Part of the CRUD series).
\Pluf_HTTP_Request | $request | |
array | $match | |
$p |
findManyToOne(\Pluf_HTTP_Request $request, array $match, $p) : \Pluf_Paginator
Get list of Children
It there is a relation ( Many to one), you can list all child with this view. The relation must be implemented with forign key in child class.
\Pluf_HTTP_Request | $request | |
array | $match | |
$p |
getObject( $request, $match, $p) : \Pluf_HTTP_Response
Access an object (Part of the CRUD series).
کمترین پارامترهای اضافه که باید تعیین شود عبارتند از
'model' - Class name string, required.
در پارامترهای مسیر هم باید پارامترهای زیر باشد
'modelIdd' - Id of of the current model to update
$request | ||
$match | ||
$p |
Response object (can be a redirect)
getManyToOne(\Pluf_HTTP_Request $request, array $match, array $p) : \Pluf_Model
Get children
\Pluf_HTTP_Request | $request | |
array | $match | |
array | $p |
createObject( $request, $match, $p) : \Pluf_HTTP_Response
Create an object (Part of the CRUD series).
The minimal extra parameter is the model class name. The list of extra parameters is:
'model' - Class name string, required.
'extra_context' - Array of key/values to be added to the context (array())
'extra_form' - Array of key/values to be added to the form generation (array())
'template' - Template to use ('"model class"_create_form.html')
$request | ||
$match | ||
$p |
Response object (can be a redirect)
createManyToOne(\Pluf_HTTP_Request $request, array $match, array $p) : \Pluf_HTTP_Response
Createy a many to one object
\Pluf_HTTP_Request | $request | |
array | $match | |
array | $p |
updateObject(\Pluf_HTTP_Request $request, array $match, array $p) : \Pluf_HTTP_Response
Update an object (Part of the CRUD series).
The minimal extra parameter is the model class name. The list of extra parameters is:
'model' - Class name string, required.
'model_id' - Id of of the current model to update
'extra_context' - Array of key/values to be added to the context (array())
'extra_form' - Array of key/values to be added to the form generation (array())
'template' - Template to use ('"model class"_update_form.html')
\Pluf_HTTP_Request | $request | object |
array | $match | |
array | $p | parameters |
Response object (can be a redirect)
updateManyToOne(\Pluf_HTTP_Request $request, array $match, array $p) : \Pluf_HTTP_Response
Update many to one
\Pluf_HTTP_Request | $request | |
array | $match | |
array | $p |
deleteObject(\Pluf_HTTP_Request $request, array $match, array $p) : \Pluf_HTTP_Response
Delete an object (Part of the CRUD series).
The minimal extra parameter is the model class name. The list of extra parameters is:
'model' - Class name string, required.
'post_delete_redirect' - View to redirect after saving, required.
'id' - Index in the match to fin the id of the object to delete (1)
'login_required' - Do we require login (false)
'template' - Template to use ('"model class"_confirm_delete.html')
'post_delete_redirect_keys' - Which keys of the model to pass to the view (array())
'extra_context' - Array of key/values to be added to the context (array())
Other extra parameters may be as follow:
'permanently' - if is exist and its value is false the object will not be deleted permanently and
only the deleted
field of that will be set to true. Note that this option assumes that the removing
object has a feild named deleted
\Pluf_HTTP_Request | $request | object |
array | $match | |
array | $p | parameters |
Response object (can be a redirect)
deleteManyToOne(\Pluf_HTTP_Request $request, array $match, array $p) : \Pluf_HTTP_Response
Delete many to one
\Pluf_HTTP_Request | $request | |
array | $match | |
array | $p |
downloadObjectBinary(\Pluf_HTTP_Request $request, array $match, $p) : \Pluf_HTTP_Response_File
Download a content of a ModelBinary object
\Pluf_HTTP_Request | $request | |
array | $match | |
$p |
updateObjectBinary(\Pluf_HTTP_Request $request, array $match, $p) : \Pluf_ModelBinary
Upload a file as content
\Pluf_HTTP_Request | $request | |
array | $match | |
$p |
create(\Pluf_HTTP_Request $request, array $match) : \Pluf_HTTP_Response_Json
\Pluf_HTTP_Request | $request | |
array | $match |
update(\Pluf_HTTP_Request $request, array $match) : \Pluf_HTTP_Response_Json
\Pluf_HTTP_Request | $request | |
array | $match |
download(\Pluf_HTTP_Request $request, array $match) : \Pluf_HTTP_Response_File
\Pluf_HTTP_Request | $request | |
array | $match |
upload(\Pluf_HTTP_Request $request, array $match) : \Exchange_Comment
\Pluf_HTTP_Request | $request | |
array | $match |
CRUD_checkPreconditions(\Pluf_HTTP_Request $request, array $p, \Pluf_Model $object, \Pluf_Model $parent = null)
Call determined preconditions in the $p and check if preconditions are statisfied.
Preconditions could be determined in the $p array as 'precond' feild.
A precondition is a function which is called in some situations before some actions. Here is an example to define preconditions in $p:
$p = array( 'precond' => array( 'My_Precondition_Class::precondFunc', 'My_Precondition_Class::precondFunc2' ) );
Value of 'precond' could be array or a single item.
Each precondition function will be called with three argument respectively as following:
\Pluf_HTTP_Request | $request | |
array | $p | |
\Pluf_Model | $object | |
\Pluf_Model | $parent |
CRUD_assertManyToOneRelation(\Pluf_Model $parent, \Pluf_Model $object, array $p)
Checks if one to many relation exist between two entity
\Pluf_Model | $parent | |
\Pluf_Model | $object | |
array | $p | parameters |
if relation does not exist
canAccess(\Pluf_HTTP_Request $request, \Exchange_Comment $comment) : boolean
Checks if user sending request has access to given Exchange_Comment object returns true if current user is offere of the offer which comment is on it or advertiser of the advertisement which related offer of the comment is on it.
\Pluf_HTTP_Request | $request | |
\Exchange_Comment | $comment |
canAccessOffer(\Pluf_HTTP_Request $request, \Exchange_Offer $offer) : boolean
Checks if user sending request has access to given Exchange_Offer object.
returns true if current user is offerer of the offer or advertiser of the advertisement of the offer.
\Pluf_HTTP_Request | $request | |
\Exchange_Offer | $offer |