Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

BEAppModel Class Reference

Bedita model base class. More...

Inheritance diagram for BEAppModel:
AppModel Alias Annotation BannedIp BEAppObjectModel BeditaExportFilter BeditaImportFilter BEObject Category Content DataTransfer DateItem EventLog GeoTag Group HashJob History LangText MailGroup MailGroupCard MailJob MailLog Module ObjectEditor ObjectProperty ObjectRelation ObjectType ObjectUser Permission PermissionModule Product Property PropertyOption RestClientModel SearchText SectionDummy SoapClientModel Stream Tree User UserProperty Version

List of all members.

Public Member Functions

 am ($record, array $skipKeys=array())
 Merge record result array to top level, skipping specified keys.
 getStartQuote ()
 getEndQuote ()
 getDriver ()
 getDefaultDateFormat ($value=null, $throwOnError=false)
 Get SQL date format.
 toolbar ($page, $dimPage, $size)
 Object search Toolbar.
 containLevel ($level="minimum")
 getBindingsLevel ($level=null)
 Return self::modelBindings level.
 setBindingsLevel ($level, array $bindings=array())
 Set self::modelBindings level.
 fieldsString ($modelName, $alias=null, $excludeFields=array())
 findObjects ($id=null, $userid=null, $status=null, $filter=array(), $order=null, $dir=true, $page=1, $dim=null, $all=false, $excludeIds=array())
 perform an objects search

Public Attributes

 $actsAs = array()

Protected Member Functions

 setupDbParams ()
 checkDate ($key, $throwOnError=false)
 Check date field in $this->data[ModelName][$key] -> set to null if empty or call getDefaultDateFormat.
 checkFloat ($key)
 Check float/double field in $this->data[ModelName][$key] -> set to null if empty.
 checkNumber ($key)
 Check integer/generic number in $this->data[ModelName][$key] -> set to null if empty.
 checkDuration ($key)
 Check duration format in $this->data[ModelName][$key] -> set to null if empty/invalid.
 getLimitClausole ($dim, $page=1)
 SQL limit clausole.
 findObjectsAfterFilter (array &$items, array $params)
 callback called by BEAppModel::findObjects() to work on list of BEdita objects

Protected Attributes

 $modelBindings = array()
 $sQ = ''
 $eQ = ''
 $driver = ''

Detailed Description

Bedita model base class.

Definition at line 58 of file app_model.php.


Member Function Documentation

BEAppModel::am ( record,
array $  skipKeys = array() 
)

Merge record result array to top level, skipping specified keys.

Parameters:
array $record Record data.
array $skipKeys Keys to be skipped even if their value is an array.
Returns:
array Record merged to single array.

Definition at line 74 of file app_model.php.

Referenced by findObjects().

BEAppModel::checkDate ( key,
throwOnError = false 
) [protected]

Check date field in $this->data[ModelName][$key] -> set to null if empty or call getDefaultDateFormat.

Parameters:
string $key
bool $throwOnError, throw exception on error, default false

Definition at line 174 of file app_model.php.

References getDefaultDateFormat().

Referenced by BEAppObjectModel::validateContent().

BEAppModel::checkDuration ( key  )  [protected]

Check duration format in $this->data[ModelName][$key] -> set to null if empty/invalid.

Parameters:
string key

Definition at line 212 of file app_model.php.

Referenced by BEAppObjectModel::validateContent().

BEAppModel::checkFloat ( key  )  [protected]

Check float/double field in $this->data[ModelName][$key] -> set to null if empty.

Parameters:
string $key

Definition at line 188 of file app_model.php.

BEAppModel::checkNumber ( key  )  [protected]

Check integer/generic number in $this->data[ModelName][$key] -> set to null if empty.

Parameters:
string $key

Definition at line 200 of file app_model.php.

BEAppModel::findObjects ( id = null,
userid = null,
status = null,
filter = array(),
order = null,
dir = true,
page = 1,
dim = null,
all = false,
excludeIds = array() 
)

perform an objects search

Parameters:
integer $id root id, if it's set perform search on the tree
string $userid user: null (default) => no permission check. ' ' => guest/anonymous user,
string $status object status
array $filter example of filter: parent_id => used if $id is empty as root id "object_type_id" => array(21,22,...), "ModelName.fieldname => "value", "query" => "text to search" ....

reserved filter words: "category" => "val" search by category id or category name "relation" => "val" search by object_relations swicth "rel_object_id" => "val" search object relateds to a particular object (object_relation object_id) ... see all in BuildFilter behavior

"afterFilter" => array() define some operations executed after the objects search to spec on array params see BEAppModel::findObjectsAfterFilter()

Parameters:
string $order field to order result (id, status, modified..)
boolean $dir true (default), ascending, otherwise descending.
integer $page Page number (for pagination)
integer $dim Page dim (for pagination). Default get all
boolean $all true: all tree levels (discendents), false: only first level (children)
array $excludeIds Array of id's to exclude

Definition at line 419 of file app_model.php.

References am(), findObjectsAfterFilter(), getLimitClausole(), and toolbar().

Referenced by DataTransfer::export(), Tree::getAll(), Tree::getChildren(), and Tree::getDescendants().

BEAppModel::findObjectsAfterFilter ( array &$  items,
array $  params 
) [protected]

callback called by BEAppModel::findObjects() to work on list of BEdita objects

Parameters:
array $items list of BEdita objects filtered by BEAppModel::findObjects()
array $params it's an array of configurable parameters to launch callbacks on Models or Behaviors. Every callback has to return the array of BEdita objects passed to it.

It can be a plain array:

array( 'type' => 'Model' or 'Behavior' default to 'Model' 'className' => 'ClassName' for Behavior it's the class name without Behavior suffix 'methodName' => 'methodName' the method name of ClassName 'options' => array() array of options to pass to ClassName::methodName() )

or it can be a multidimensional array, for example

array( array( 'type' => 'Model', 'className' => 'ModelClassName', 'methodName' => 'modelMethodName', 'options' => array() ), array( 'type' => 'Behavior', 'className' => 'BehaviorClassName', 'methodName' => 'behaviorMethodName', 'options' => array() ) )

If type is 'Model' the 'modelMethodName' method of 'ModelClassName' should be defined as

public function modelMethodName($items, $options) { .... return $items; }

If type is 'Behavior' the 'behaviorMethodName' method 'BehaviorClassName' should be defined as

public function behaviorMethodName(&$model, $items, $options) { .... return $items; }

Definition at line 788 of file app_model.php.

Referenced by findObjects().

BEAppModel::getBindingsLevel ( level = null  ) 

Return self::modelBindings level.

Parameters:
string $level define the level to return. Leave empty to return all bindings level
Returns:
array|false return false if $level is not set

Definition at line 356 of file app_model.php.

BEAppModel::getDefaultDateFormat ( value = null,
throwOnError = false 
)

Get SQL date format.

Parameters:
unknown_type $value
Returns:
unknown

Definition at line 122 of file app_model.php.

References BeLib::sqlDateFormat().

Referenced by BEObject::beforeValidate(), and checkDate().

BEAppModel::getLimitClausole ( dim,
page = 1 
) [protected]

SQL limit clausole.

Parameters:
int $dim, global size/count
int $page, page num
Returns:
string

Definition at line 317 of file app_model.php.

Referenced by findObjects(), and LangText::findObjs().

BEAppModel::setBindingsLevel ( level,
array $  bindings = array() 
)

Set self::modelBindings level.

Parameters:
string $level the level name
array $bindings array of model bindings

Definition at line 372 of file app_model.php.

BEAppModel::toolbar ( page,
dimPage,
size 
)

Object search Toolbar.

Parameters:
integer $page
integer $dimPage page dimension (limit sql)
integer $size count of all records
Returns:
array for pagination "first" => first page; if there is only one page its value is 0 else 1 "prev" => previous page; 0 if there isn't previous page "next" => next page; 0 if there isn't next page "last" => last page; 0 if it's the last page "size" => number of all records "pages" => total number of pages "page" => number of current page "dim" => number of records per page "start" => number of the record with which the page begins counting from the first page "end" => number of the record with which the page ends counting from the first page

Definition at line 255 of file app_model.php.

Referenced by findObjects(), and LangText::findObjs().


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:46 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus