BEdita API doc | 4-cactus
  • Class
  • Tree
  • Deprecated
  • Download

Classes

  • Addon
  • AddressbookController
  • AddressbookShell
  • AdminController
  • Alias
  • Annotation
  • ApiAuthComponent
  • ApiBaseController
  • ApiFormatterComponent
  • ApiUploadComponent
  • ApiValidatorComponent
  • AppController
  • AppError
  • AppHelper
  • Application
  • AppModel
  • Area
  • AreasController
  • Audio
  • AuthenticationsController
  • BannedIp
  • BEAppModel
  • BEAppObjectModel
  • BeAuthComponent
  • BeAuthFacebookComponent
  • BeAuthGoogleComponent
  • BeAuthTwitterComponent
  • BeCallbackManager
  • BeConfigure
  • BeCustomPropertyComponent
  • BeditaAnnotationModel
  • BeditaBaseShell
  • BeditaCollectionModel
  • BeditaContentModel
  • BeditaExportFilter
  • BeditaImportFilter
  • BeditaObjectModel
  • BeditaProductModel
  • BeditaShell
  • BeditaSimpleObjectModel
  • BeditaSimpleStreamModel
  • BeditaStreamModel
  • BeEmbedFlashHelper
  • BeEmbedHtml5Helper
  • BeEmbedMediaHelper
  • BeErrorCode
  • BeExceptionHandler
  • BEFile
  • BeFileHandlerComponent
  • BeFormHelper
  • BeFrontHelper
  • BeHashComponent
  • BeHtmlHelper
  • BeLangTextComponent
  • BeLib
  • BeMailComponent
  • BEObject
  • BeObjectCache
  • BePaginatorToolbarHelper
  • BeSchema
  • BeSecurityComponent
  • BeSystem
  • BeSystemComponent
  • BeThumb
  • BeTimeHelper
  • BeToolbarHelper
  • BeTreeComponent
  • BeTreeHelper
  • BeUploadToObjComponent
  • BeurlHelper
  • BeVimeoComponent
  • BeYoutubeComponent
  • BuildFilterBehavior
  • CacheableBehavior
  • CacheShell
  • CallbackBehavior
  • CaptchaComponent
  • Caption
  • CaptionsBehavior
  • Card
  • CardsImportFilter
  • Category
  • CleanupDataTask
  • CleanupTask
  • Comment
  • CommentsController
  • CompactResultBehavior
  • Content
  • CreateIndexFieldsBehavior
  • DataShell
  • DataTransfer
  • DateItem
  • DbadminShell
  • DeleteDependentObjectBehavior
  • DeleteObjectBehavior
  • DeployShell
  • Document
  • DocumentsController
  • DumpModel
  • EditorialContentsShell
  • EditorNote
  • Event
  • EventLog
  • EventsController
  • FilesController
  • ForeignDependenceSaveBehavior
  • FrontendController
  • FrontendShell
  • GalleriesController
  • Gallery
  • GeoTag
  • GettextShell
  • Git
  • GravatarHelper
  • Group
  • HashJob
  • History
  • HomeController
  • Image
  • ImageInfoHelper
  • JsonExportFilter
  • JsonImportFilter
  • JsonView
  • LangText
  • Link
  • MailGroup
  • MailGroupCard
  • MailJob
  • MailLog
  • MailMessage
  • MailShell
  • MailTemplate
  • Mask
  • MediaShell
  • MigrateDumpModel
  • MigrateShell
  • Migration
  • MigrationBase
  • MigrationDateItemsShell
  • Module
  • ModulesController
  • ModuleShell
  • MultimediaController
  • NewsController
  • NewsletterController
  • NewsletterShell
  • NotifyBehavior
  • ObjectEditor
  • ObjectProperty
  • ObjectRelation
  • ObjectType
  • ObjectUser
  • PagesController
  • Permission
  • PermissionModule
  • PermsHelper
  • Product
  • Property
  • PropertyOption
  • PublicationShell
  • RedisShell
  • RelationCheck
  • RelationRepair
  • RelationShell
  • RelationStats
  • RemoveDummyNameBehavior
  • ResponseHandlerComponent
  • RestClientModel
  • Revision
  • RevisionObjectBehavior
  • SearchText
  • SearchTextSaveBehavior
  • Section
  • SectionDummy
  • SessionFilterComponent
  • SessionFilterHelper
  • ShortNews
  • SmartyView
  • SoapClientModel
  • SplitterSql
  • StatisticsController
  • Stream
  • StreamLog
  • StreamsController
  • Svn
  • TagsController
  • ThemeSmartyView
  • ThumbnailHelper
  • ThumbShell
  • TransactionComponent
  • TransactionFS
  • TranslationsController
  • Tree
  • TrHelper
  • User
  • UserProperty
  • UsersController
  • Utility
  • Version
  • Video
  • VimeoHelper
  • WebmarksController
  • XmlExportFilter
  • XmlImportFilter
  • XmlJsonConverter
  • XmlView
  • YoutubeHelper

Interfaces

  • ApiAuthInterface
  • MediaProviderInterface
  • UploadableInterface

Exceptions

  • BeditaAjaxException
  • BEditaAllowURLException
  • BeditaBadRequestException
  • BeditaConflictException
  • BEditaDeleteStreamObjException
  • BeditaException
  • BEditaFileExistException
  • BeditaForbiddenException
  • BeditaFrontAccessException
  • BeditaHashException
  • BEditaInfoException
  • BeditaInternalErrorException
  • BEditaIOException
  • BeditaLengthRequiredException
  • BeditaMailException
  • BEditaMediaProviderException
  • BeditaMethodNotAllowedException
  • BEditaMIMEException
  • BeditaNotFoundException
  • BeditaNotImplementedException
  • BeditaPublicationException
  • BeditaRuntimeException
  • BEditaSaveStreamObjException
  • BeditaServiceUnavailableException
  • BeditaUnauthorizedException
  • BEditaUploadPHPException
  • BEditaURLException

Class BuildFilterBehavior

BuildFilter Class build custom sql statements used in BEAppModel::findObjects() method to filter list of BEdita objects

It can be extended with custom behavior classes to refine query according to your needs

Example:

App::import('Behavior', 'BuildFilter');

ClassNameFilterBehavior extends BuildFilterBehavior {

 public function myFilterMethod($data) {

 }

}

to call that method you have to build your filter to pass at BEAppModel::findObjects() as

$filter['ClassNameFilter.myFilterMethod'] = $yourData;

$yourData item will be passed to myFilterMethod as first argument

methods of your custom filter class should be return an array that can have the following keys: - "fields" => string of fields to add to query - "fromStart" => string of FROM statement to insert at the begin of the string (LEFT, RIGHT and INNER JOIN statements) - "fromEnd" => string of FROM statement to insert at the end of the string (list of tables and aliases) - "conditions" => array of conditions to add at WHERE statement - "group" => string to add at GROUP statement - "order" => string to add at ORDER statement

ModelBehavior
Extended by BuildFilterBehavior
Version: $Revision$
Modifiedby: $LastChangedBy$
Lastmodified:

$LastChangedDate$

$Id$


Located at models/behaviors/build_filter.php

Methods summary

public
# setup( & $model, $settings = array() )
public array
# prepareAfterFilter( array & $filter, string $order )

Prepare and return $afterFilter array built from $filter

Prepare and return $afterFilter array built from $filter

Parameters

$filter
The filter to apply
$order
The order string

Returns

array
public
# prepareCountPermissionFilter( array & $filter, string $order )

Check $filter['count_permission'] and remove it if necessary. It is removed if:

Check $filter['count_permission'] and remove it if necessary. It is removed if:

  • it's not empty and it doesn't appear in $order as 'num_of_permission' string

Parameters

$filter
The array of filters to apply
$order
The order string
public
# prepareCountAnnotationFilter( array & $filter, string $order )

Check $filter['count_annotation'] and remove it if necessary. It is removed if:

Check $filter['count_annotation'] and remove it if necessary. It is removed if:

  • it is empty
  • it doesn't appear in $order as 'num_of_object' string (for example 'num_of_comment', etc...)

Parameters

$filter
The array of filters to apply
$order
The order string
public
# prepareObjectTypeFilter( array & $filter )

Prepare object type filter transforming object type string in object type id

Prepare object type filter transforming object type string in object type id

Parameters

$filter
The array of filters to apply
public
# prepareSearchFilter( array & $filter, array $options,… )

Prepare 'query' search filter

Prepare 'query' search filter

Parameters

$filter
The filter to apply
$options,…
[description]
public array|boolean
# searchEngineResult( string $engine, array $options )

Get results using a search engine

Get results using a search engine

For example it could use Elasticsearch.

Return false if no search engine is found or if $options['filter']['query'] is empty. Return an array as

array(
    'result' => array(), // the array of results found by search engine
    'count' => 12, // the number of results
    'order' => array() // an array with object ids as key and the rank as value
)

Parameters

$engine
The engine Model name i.e. 'ElasticSearch'
$options

An array of options. At least $options['filter']['query'] must be populated

Returns

array|boolean
public array
# getSqlItems( array & $model, $filter )

set conditions, from, fields, group and order from $filter

set conditions, from, fields, group and order from $filter

Parameters

$model
$filter
$filter

Returns

array
private
# initVars( array $filter )

initialize sql items and some filter

initialize sql items and some filter

Parameters

$filter
protected
# addJoins( array $joins )

Add joins statements

Add joins statements

$joins must be an array as

array(
    array(
        'table' => 'table_name',
        'alias' => 'TableName',
        'type' => 'INNER',
        'conditions' => array(
            'TableName.key_one = JoinToTable.key_two'
        )
    ),
    array(
        ...
    ),
)

where every internal array describe the join in CakePHP way

Parameters

$joins
protected
# object_userFilter( string $s, string $e, mixed $value = null )

filter to get user_id (as obj_userid) joined to an object through object_users table

filter to get user_id (as obj_userid) joined to an object through object_users table

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, if not empty to get user_id joined to an object with $value relation (object_users.swicth)
protected
# exclude_branchFilter( string $s, string $e, mixed $value = null )

filter to exclude tree branches for specified ids

filter to exclude tree branches for specified ids

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, if not empty to exclude object with $value id and its descendants
protected
# count_annotationFilter( string $s, string $e, mixed $value )

add a count of Annotation objects as Comment, EditoreNote, etc... If 'object_type_id' specified in BuildFilter::filter then get annotations for that object type/s

add a count of Annotation objects as Comment, EditoreNote, etc... If 'object_type_id' specified in BuildFilter::filter then get annotations for that object type/s

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value

$value, annotation model or an array of annotation models Example:

     $value = "Comment" => add count of comment as 'num_of_comment'
     $value = array("Comment", "EditorNote") => add count of comments as 'num_of_comment'
                                                and count of editor notes as 'num_of_editor_note'
protected
# mediatypeFilter( string $s, string $e )

get a category of an object naming it mediatype (used in Multimedia module)

get a category of an object naming it mediatype (used in Multimedia module)

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
protected
# queryFilter( string $s, string $e, mixed $value )

search text filter using fulltext or sql-like

search text filter using fulltext or sql-like

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value

$value, the string to search for (default $defaultConf['searchType'] used) array( 'searchType' => 'like' or 'fulltext' 'searchString' => 'the string to search' )

protected
# categoryFilter( string $s, string $e, mixed $value )

filter objects by categories

filter objects by categories

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, id/name or array of ids/names
protected
# categoriesFilter( string $s, string $e, mixed $value )

Alias for self::categoryFilter()

Alias for self::categoryFilter()

Parameters

$s
start quote sql
$e
end quote sql
$value
id/name or array of ids/names
protected
# tagFilter( string $s, string $e, mixed $value )

filter objects by tags

filter objects by tags

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
or array of ids/names
protected
# tagsFilter( string $s, string $e, mixed $value )

Alias for self::tagFilter()

Alias for self::tagFilter()

Parameters

$s
start quote sql
$e
end quote sql
$value
id/name or array of ids/names
protected
# rel_detailFilter( string $s, string $e, type $value )

get RelatedObject fields

get RelatedObject fields

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
[unused?? To verify]
protected
# ref_object_detailsFilter( string $s, string $e, string $value )

get the object referenced from an Annotation object as Comment, EditorNote

get the object referenced from an Annotation object as Comment, EditorNote

Example: getting a list of comment you can take also the object commented with

$filter['object_type_id'] = Configure::read('objectTypes.comment.id'); // to filter comments $filter['ref_object_details'] = 'Comment'; // to get also the object commented

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, the Annotation Model as Comment, EditorNote, ...
protected
# ref_object_typesFilter( string $s, string $e, string $value )

Filter Reference object types (used with ref_object_details filter for Annotations)

Filter Reference object types (used with ref_object_details filter for Annotations)

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, id or array id of of reference object types
protected
# mail_groupFilter( string $s, string $e, integer $value )

filter the cards joined at a mail group (used in Newsletter module)

filter the cards joined at a mail group (used in Newsletter module)

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, mail_group_id
protected
# user_createdFilter( string $s, string $e, string|null $value )

get userid (username) and real name of user that has created the object

get userid (username) and real name of user that has created the object

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
The value of field
protected
# count_permissionFilter( string $s, string $e, mixed $value )

count objects' permissions as num_of_permission

count objects' permissions as num_of_permission

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
$value, if it's integer then count $value permission
protected
# custom_propertyFilter( string $s, string $e, mixed $value )

custom property filter get object_properties fields as ObjectProperty

custom property filter get object_properties fields as ObjectProperty

filter rules: - default join used is INNER JOIN. It can be overriden with 'join' key in $value - if $value is a string or a number set condition respectively to property_value or property_id

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
can be a string/number or an array with keys equal to object_properties table field
protected
# date_itemFilter( string $s, string $e, mixed $value )

date item filter get date_items fields as DateItem

date item filter get date_items fields as DateItem

filter rules: - default join used is INNER JOIN. It can be overriden with 'join' key in $value - if $value is a number set condition start_date

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value
can be a number or an array with keys equal to date_items table field
protected
# count_relationsFilter( string $s, string $e, mixed $value )

count relation filter If 'object_type_id' specified in BuildFilter::filter then get relations for that object type/s

count relation filter If 'object_type_id' specified in BuildFilter::filter then get relations for that object type/s

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$value

$value, relation name or array of relations (object_relations.switch field)

 Example:

     $value = "seealso" => add count of seealso relation as 'num_of_relations_seealso'
     $value = array("seealso", "download") => add count of seealso relation as 'num_of_relations_seealso'
                                              and count of download relation as 'num_of_relations_download'
protected
# allowed_to_userFilter( string $s, string $e, string $userid )

filter objects allowed to user

filter objects allowed to user

Parameters

$s
$s, start quote sql
$e
$e, end quote sql
$userid
userid (users.userid field)
protected
# editorialFilter( string $s, string $e, string $value )

Filter editorial contents.

Filter editorial contents.

If $value is true it filters by objects.publisher not null and not empty If $value is false it filters by objects.publisher null or empty

Parameters

$s
Start quote sql
$e
End quote sql
$value
The filter

Properties summary

private string $fields

string of query fields

string of query fields

# ""
private string $from

sql FROM statement it hasn't to contain the "FROM" string

sql FROM statement it hasn't to contain the "FROM" string

# ''
private string $joins

sql JOINS built using CakePHP

sql JOINS built using CakePHP

# ''
private array $conditions

sql conditions

sql conditions

# array()
private string $group

sql GROUP statement it hasn't to contain the "GROUP" string

sql GROUP statement it hasn't to contain the "GROUP" string

# ""
private string $order

sql ORDER BY statement it hasn't to contain the "ORDER BY" string

sql ORDER BY statement it hasn't to contain the "ORDER BY" string

# ""
protected array $filter

filter parameters used to build the sql statements

filter parameters used to build the sql statements

# array()
protected string $startQuote

sql start quote

sql start quote

# ""
protected string $endQuote

sql end quote

sql end quote

# ""
protected BEAppModel $model

model

model

# ""
private string $driver

sql driver

sql driver

# ""
private array $map

translate some filter shortcut to extended version

translate some filter shortcut to extended version

# array( 'relation' => 'ObjectRelation.switch', 'rel_object_id' => 'ObjectRelation.object_id', 'comment_object_id' => 'Comment.object_id' )
private $dataSource
# null
private boolean $useGroupBy

Force BEAppModel::findObjects() to use 'GROUP BY' clausole its value is returned in self::getSqlItems()

Force BEAppModel::findObjects() to use 'GROUP BY' clausole its value is returned in self::getSqlItems()

# false
BEdita API doc | 4-cactus API documentation generated by ApiGen