\SuperTenant_Views_Configuration

Configurations of Tenant

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.

Summary

Methods
Properties
Constants
redirectTo()
simpleContent()
loadTemplate()
findObject()
findManyToOne()
clearManyToOne()
getObject()
getManyToOne()
createObject()
createManyToOne()
updateObject()
updateManyToOne()
deleteObject()
deleteManyToOne()
getSchema()
downloadObjectBinary()
updateObjectBinary()
get()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
CRUD_getModelInstance()
CRUD_getModel()
CRUD_getParentModel()
CRUD_response()
CRUD_checkPreconditions()
CRUD_assertManyToOneRelation()
internalGet()
No private properties found
N/A

Methods

redirectTo()

redirectTo(  $request,   $match,   $url) 

Simple redirection view.

Parameters

$request
$match
$url

simpleContent()

simpleContent(  $request,   $match,   $content) 

Simple content view.

Parameters

$request
$match
$content

loadTemplate()

loadTemplate(\Pluf_HTTP_Request  $request, array  $match) : \Pluf_HTTP_Response

Creates a template and returns as result

در بسیاری از کاربردها نرم‌افزار کاربردی به صفحه‌های متفاوتی شکسته می‌شود و بر اساس حالت کاربر یکی از صفحه‌ها نمایش داده می‌شود. به این ترتیب حجم دانلود برای هر صفحه کم شده و توسعه هر صفحه نیز راحتر می‌شود.

این فراخوانی این امکان را ایجاد می‌کند که در لایه نمایش به سادگی یکی از الگوها را فراخوانی کرده و آن را به عنوان نتیجه برای کاربران نمایش دهید.

Parameters

\Pluf_HTTP_Request $request
array $match

Returns

\Pluf_HTTP_Response

findObject()

findObject(\Pluf_HTTP_Request  $request, array  $match,   $p = array()) : \Pluf_Paginator

List objects (Part of the CRUD series).

Parameters

\Pluf_HTTP_Request $request
array $match
$p

Returns

\Pluf_Paginator

findManyToOne()

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.

Parameters

\Pluf_HTTP_Request $request
array $match
$p

Returns

\Pluf_Paginator

clearManyToOne()

clearManyToOne(\Pluf_HTTP_Request  $request, array  $match = array(), array  $p = array()) : NULL

Clear Many to on relations

Parameters

\Pluf_HTTP_Request $request
array $match
array $p

Returns

NULL

getObject()

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

Parameters

$request
$match
$p

Returns

\Pluf_HTTP_Response

Response object (can be a redirect)

getManyToOne()

getManyToOne(\Pluf_HTTP_Request  $request, array  $match, array  $p) : \Pluf_Model

Get children

Parameters

\Pluf_HTTP_Request $request
array $match
array $p

Returns

\Pluf_Model

createObject()

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')

Parameters

$request
$match
$p

Returns

\Pluf_HTTP_Response

Response object (can be a redirect)

createManyToOne()

createManyToOne(\Pluf_HTTP_Request  $request, array  $match, array  $p) : \Pluf_HTTP_Response

Createy a many to one object

Parameters

\Pluf_HTTP_Request $request
array $match
array $p

Returns

\Pluf_HTTP_Response

updateObject()

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')

Parameters

\Pluf_HTTP_Request $request

object

array $match
array $p

parameters

Returns

\Pluf_HTTP_Response

Response object (can be a redirect)

updateManyToOne()

updateManyToOne(\Pluf_HTTP_Request  $request, array  $match, array  $p) : \Pluf_HTTP_Response

Update many to one

Parameters

\Pluf_HTTP_Request $request
array $match
array $p

Returns

\Pluf_HTTP_Response

deleteObject()

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

Parameters

\Pluf_HTTP_Request $request

object

array $match
array $p

parameters

Returns

\Pluf_HTTP_Response

Response object (can be a redirect)

deleteManyToOne()

deleteManyToOne(\Pluf_HTTP_Request  $request, array  $match, array  $p) : \Pluf_HTTP_Response

Delete many to one

Parameters

\Pluf_HTTP_Request $request
array $match
array $p

Returns

\Pluf_HTTP_Response

getSchema()

getSchema(  $request,   $match,   $p) 

Parameters

$request
$match
$p

downloadObjectBinary()

downloadObjectBinary(\Pluf_HTTP_Request  $request, array  $match,   $p) : \Pluf_HTTP_Response_File

Download a content of a ModelBinary object

Parameters

\Pluf_HTTP_Request $request
array $match
$p

Returns

\Pluf_HTTP_Response_File

updateObjectBinary()

updateObjectBinary(\Pluf_HTTP_Request  $request, array  $match,   $p) : \Pluf_ModelBinary

Upload a file as content

Parameters

\Pluf_HTTP_Request $request
array $match
$p

Returns

\Pluf_ModelBinary

get()

get(\Pluf_HTTP_Request  $request, array  $match) 

Getting system configuration

Get configuration properties from the system.

Parameters

\Pluf_HTTP_Request $request
array $match

CRUD_getModelInstance()

CRUD_getModelInstance(  $p) 

Parameters

$p

CRUD_getModel()

CRUD_getModel(  $p) 

Parameters

$p

CRUD_getParentModel()

CRUD_getParentModel(  $p) 

Parameters

$p

CRUD_response()

CRUD_response(  $request,   $p,   $object,   $child = null) 

Parameters

$request
$p
$object
$child

CRUD_checkPreconditions()

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:

  • $request: Pluf_HTTp_Request
  • $object: Pluf_Model
  • $parent: Pluf_Model, which is a parent of $object model

Parameters

\Pluf_HTTP_Request $request
array $p
\Pluf_Model $object
\Pluf_Model $parent

Throws

\Pluf\Exception

CRUD_assertManyToOneRelation()

CRUD_assertManyToOneRelation(\Pluf_Model  $parent, \Pluf_Model  $object, array  $p) 

Checks if one to many relation exist between two entity

Parameters

\Pluf_Model $parent
\Pluf_Model $object
array $p

parameters

Throws

\Pluf_HTTP_Error404

if relation does not exist

internalGet()

internalGet(\Pluf_HTTP_Request  $request, array  $match) : \SuperTenant_Configuration|NULL

Returns configuration with given key in the $match array. Returns null if such configuration does not exist.

Parameters

\Pluf_HTTP_Request $request
array $match

Returns

\SuperTenant_Configuration|NULL