redirectTo()
redirectTo( $request, $match, $url)
Simple redirection view.
Parameters
$request | ||
$match | ||
$url |
Manage emails of account
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) : \User_Email
Creates new email for account
\Pluf_HTTP_Request | $request | |
array | $match |
created account
get(\Pluf_HTTP_Request $request, array $match) : \User_Email
Returns specified email of an account
\Pluf_HTTP_Request | $request | |
array | $match |
find(\Pluf_HTTP_Request $request, array $match) : \Pluf_Paginator
Lists emails of an account
\Pluf_HTTP_Request | $request | |
array | $match |
update(\Pluf_HTTP_Request $request, array $match) : \User_Email
Updates information of the email of an account.
Note that the email address could not be changed by updating process.
\Pluf_HTTP_Request | $request | |
array | $match |
delete(\Pluf_HTTP_Request $request, array $match) : \User_Email
Delete specified email of an account
\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
checkAccess(\Pluf_HTTP_Request $request, array $match) : \User_Account
Checks permission to change emails and returns account which its email will be changed.
Checks the permission of the requester user to change emails of defined account in the request. The requester user have permission to change emails of an account if and only if he is tenant owner or he is owner of the account.
If user has not necessary permission this function will throw Pluf_Exception_Forbidden exception. If user is not defined this function wil throw Pluf_Exception_BadRequest exception.
\Pluf_HTTP_Request | $request | |
array | $match |
account which its emails will be changed.