Skip to content

icms_view_block_position_Handler

Raimondas Rimkevičius edited this page Mar 9, 2020 · 1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!

icms_view_block_position_Handler

icms_view_block_position_Handler

This class is an abstract class of handler classes that are responsible for providing data access mechanisms to the data source of its corresponsing data objects

  • Class name: icms_view_block_position_Handler
  • Namespace:
  • Parent class: icms_ipf_Handler

Properties

$_loadedItems

protected array $_loadedItems = array()

Loaded items cache

  • Visibility: protected
  • This property is static.

$cached_fields

protected mixed $cached_fields = array()
  • Visibility: protected
  • This property is static.

$_itemname

public string $_itemname

The name of the IPF object

  • Visibility: public

$table

public string $table

Name of the table use to store objects linked with this handler

Note that the name of the table needs to be free of the database prefix. For example "smartsection_categories"

  • Visibility: public

$keyName

public string $keyName

Name of the table key that uniquely identify each object

For example : "categoryid"

  • Visibility: public

$className

public string $className

Name of the class derived from object and which this handler is handling

Note that this string needs to be lowercase

For example : "smartsectioncategory"

  • Visibility: public

$identifierName

public string $identifierName

Name of the field which properly identify the object

For example : "name" (this will be the category's name)

  • Visibility: public

$summaryName

public string $summaryName

Name of the field which will be use as a summary for the object

For example : "summary"

  • Visibility: public

$_page

public string $_page

Page name use to basically manage and display the object

This page needs to be the same in user side and admin side

For example category.php - we will deduct smartsection/category.php as well as smartsection/admin/category.php

  • Visibility: public

$_modulePath

public string $_modulePath

Full path of the module using this object

ICMS_URL . "/modules/smartsection/"

  • Visibility: public

$_moduleUrl

public string $_moduleUrl

Module URL

  • Visibility: public

$_moduleName

public string $_moduleName

The name of the module for the object

  • Visibility: public

$uploadEnabled

public bool $uploadEnabled = \false

Is upload enabled?

  • Visibility: public

$_uploadUrl

public string $_uploadUrl

Upload URL

  • Visibility: public

$_uploadPath

public string $_uploadPath

Upload Path

  • Visibility: public

$_allowedMimeTypes

public array $_allowedMimeTypes = []

Allowed mimetypes

  • Visibility: public

$_maxFileSize

public int $_maxFileSize = 1000000

Max allowed file size for upload

  • Visibility: public

$_maxWidth

public int $_maxWidth = 500

Max allowed width for file upload

  • Visibility: public

$_maxHeight

public int $_maxHeight = 500

Max file height for upload

  • Visibility: public

$highlightFields

public array $highlightFields = array()

What fields to highlight?

  • Visibility: public

$visibleColumns

public array $visibleColumns = array()

What columns should be viisble.

Empty array means all.

  • Visibility: public

$eventArray

public array $eventArray = array()

Array containing the events name and functions

  • Visibility: public

$permissionsArray

public array $permissionsArray = array()

Array containing the permissions that this handler will manage on the objects

  • Visibility: public

$generalSQL

public string $generalSQL

Some SQL that will be used as base for all operations for this handler

  • Visibility: public

$_eventHooks

public array $_eventHooks = array()

Events hooks

  • Visibility: public

$_disabledEvents

public array $_disabledEvents = array()

Disabled events

  • Visibility: public

$debugMode

public bool $debugMode = \false

Is debug mode?

  • Visibility: public

$db

public \icms_db_legacy_Database $db

holds referenced

  • Visibility: public

Methods

__construct

mixed icms_core_ObjectHandler::__construct(\icms_db_legacy_Database db)

called from child classes only

Arguments

  • db icms_db_legacy_Database - <p>reference to db</p>

insert

mixed icms_core_ObjectHandler::insert(object object)

insert/update object

Arguments

  • object object

addEventHook

mixed icms_ipf_Handler::addEventHook(\str event, \str method)

Arguments

  • event str
  • method str

addPermission

mixed icms_ipf_Handler::addPermission(string perm_name, string caption, string description)

Add a permission that this handler will manage for its objects

Example : $this->addPermission('view', _AM_SSHOP_CAT_PERM_READ, _AM_SSHOP_CAT_PERM_READ_DSC);

Arguments

  • perm_name string - <p>name of the permission</p>
  • caption string - <p>caption of the control that will be displayed in the form</p>
  • description string - <p>description of the control that will be displayed in the form</p>

setGrantedObjectsCriteria

mixed icms_ipf_Handler::setGrantedObjectsCriteria(\obj criteria, \str perm_name)

Arguments

  • criteria obj
  • perm_name str

getCalculatedInfo

array icms_ipf_Handler::getCalculatedInfo(array field_func, \icms_db_criteria_Element criteria, bool debug)

Runs precalculated info

Arguments

getObjectsD

array icms_ipf_Handler::getObjectsD(\icms_db_criteria_Element criteria, bool id_as_key, bool as_object, mixed sql)

retrieve objects with debug mode - so will show the query

Arguments

  • criteria icms_db_criteria_Element - <p>Criteria conditions to be met</p>
  • id_as_key bool - <p>use the ID as key for the array?</p>
  • as_object bool - <p>return an array of objects?</p>
  • sql mixed

getObjects

array icms_ipf_Handler::getObjects(\icms_db_criteria_Element criteria, bool id_as_key, bool as_object, mixed sql, mixed debug)

retrieve objects from the database

Arguments

  • criteria icms_db_criteria_Element - <p>Criteria conditions to be met</p>
  • id_as_key bool - <p>use the ID as key for the array?</p>
  • as_object bool - <p>return an array of objects?</p>
  • sql mixed
  • debug mixed

getFields

string icms_ipf_Handler::getFields(bool getcurrent, bool forSQL)

Gets all fields for SQL

Arguments

  • getcurrent bool - <p>Get current fields</p>
  • forSQL bool - <p>Returns fields result as for SQL</p>

convertResultSet

array icms_ipf_Handler::convertResultSet(object result, bool id_as_key, bool as_object)

Convert a database resultset to a returnable array

Arguments

  • result object - <p>database resultset</p>
  • id_as_key bool - <ul> <li>should NOT be used with joint keys</li> </ul>
  • as_object bool

convertResultSet_RAWWithKey

mixed icms_ipf_Handler::convertResultSet_RAWWithKey(mixed result, mixed key)

Arguments

  • result mixed
  • key mixed

convertResultSet_RAW

mixed icms_ipf_Handler::convertResultSet_RAW(mixed result)

Arguments

  • result mixed

convertResultSet_ObjectWithKey

mixed icms_ipf_Handler::convertResultSet_ObjectWithKey(mixed result, mixed key, mixed as_object)

Arguments

  • result mixed
  • key mixed
  • as_object mixed

getSkipKeys

array icms_ipf_Handler::getSkipKeys()

Get array with keys for skipping

getImageUrl

mixed icms_ipf_Handler::getImageUrl()

getImagePath

mixed icms_ipf_Handler::getImagePath()

convertResultSet_Object

mixed icms_ipf_Handler::convertResultSet_Object(mixed result, mixed as_object)

Arguments

  • result mixed
  • as_object mixed

getD

\icms_ipf_Object|bool icms_ipf_Handler::getD(string|float|int id, bool as_object)

retrieve object

Arguments

  • id string|float|int - <p>ID of the object - or array of ids for joint keys. Joint keys MUST be given in the same order as in the constructor</p>
  • as_object bool - <p>whether to return an object or an array</p>

get

mixed icms_core_ObjectHandler::get(int int_id)

gets a value object

Arguments

  • int_id int

create

mixed icms_core_ObjectHandler::create()

creates a new object

getListD

array icms_ipf_Handler::getListD(object criteria, int limit, int start)

Arguments

  • criteria object
  • limit int
  • start int

getList

array icms_ipf_Handler::getList(\icms_db_criteria_Element criteria, int limit, int start, mixed debug)

Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS

Arguments

  • criteria icms_db_criteria_Element - <p>Criteria conditions to be met</p>
  • limit int - <p>Max number of objects to fetch</p>
  • start int - <p>Which record to start at</p>
  • debug mixed

getCustomList

array icms_ipf_Handler::getCustomList(string keyName, string keyValue, \icms_db_criteria_Element criteria, int limit, int start, bool debug)

Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS

Arguments

  • keyName string - <p>Key name</p>
  • keyValue string - <p>Key value</p>
  • criteria icms_db_criteria_Element - <p>Criteria conditions to be met</p>
  • limit int - <p>Max number of objects to fetch</p>
  • start int - <p>Which record to start at</p>
  • debug bool - <p>Debug mode?</p>

getIdentifierName

mixed icms_ipf_Handler::getIdentifierName(bool withprefix)

Arguments

  • withprefix bool

insertD

mixed icms_ipf_Handler::insertD(\obj obj, bool force, bool checkObject, bool debug)

Arguments

  • obj obj
  • force bool
  • checkObject bool
  • debug bool

save

bool icms_ipf_Handler::save(mixed obj_instances, bool force)

Saves one or many items

Arguments

  • obj_instances mixed
  • force bool - <p>Force saving?</p>

executeEvent

mixed icms_ipf_Handler::executeEvent(string event, mixed executeEventObj)

Execute the function associated with an event This method will check if the function is available

Arguments

  • event string - <p>name of the event</p>
  • executeEventObj mixed

generateInsertSQL

string icms_ipf_Handler::generateInsertSQL(mixed data)

Generate insert SQL by data

Arguments

  • data mixed

generateUpdateSQL

string|null icms_ipf_Handler::generateUpdateSQL(mixed data)

Generates update SQL

Arguments

  • data mixed

getObjectsAsArray

mixed icms_ipf_Handler::getObjectsAsArray(\arr arrayObjects)

Arguments

  • arrayObjects arr

doFastChange

array icms_ipf_Handler::doFastChange(mixed id, string field, \numeric value, string math_func, bool force, bool debug)

Execute fast change with data

Arguments

  • id mixed
  • field string
  • value numeric
  • math_func string
  • force bool
  • debug bool

query

array icms_ipf_Handler::query(string sql, \icms_db_criteria_Element criteria, bool force, bool debug)

query the database with the constructed $criteria object

Arguments

  • sql string - <p>The SQL Query</p>
  • criteria icms_db_criteria_Element - <p>Criteria conditions to be met</p>
  • force bool - <p>Force the query?</p>
  • debug bool - <p>Turn Debug on?</p>

getCount

int icms_ipf_Handler::getCount(\icms_db_criteria_Element criteria)

count objects matching a condition

Arguments

disableEvent

mixed icms_ipf_Handler::disableEvent(\arr|\str event)

Arguments

  • event arr|str

getIdsFromObjectsAsArray

mixed icms_ipf_Handler::getIdsFromObjectsAsArray(array objectsAsArray)

Build an array containing all the ids of an array of objects as array

Arguments

  • objectsAsArray array - <p>array of icms_ipf_Object</p>

updateAll

bool icms_ipf_Handler::updateAll(string fieldname, string fieldvalue, \icms_db_criteria_Element criteria, mixed force)

Change a value for objects with a certain criteria

Arguments

  • fieldname string - <p>Name of the field</p>
  • fieldvalue string - <p>Value to write</p>
  • criteria icms_db_criteria_Element - <p>Criteria</p>
  • force mixed

deleteAll

bool icms_ipf_Handler::deleteAll(\icms_db_criteria_Element criteria, bool quick)

delete all objects meeting the conditions

Arguments

  • criteria icms_db_criteria_Element - <p>Criteria with conditions to meet</p>
  • quick bool - <p>Do not load object on deletion?</p>

delete

mixed icms_core_ObjectHandler::delete(object object)

delete object from database

Arguments

  • object object

deleteGrantedPermissions

bool icms_ipf_Handler::deleteGrantedPermissions(object obj)

delete granted permssions for an object

Arguments

  • obj object - <p>optional</p>

getPermissions

mixed icms_ipf_Handler::getPermissions()

Accessor for the permissions array property

getModuleInfo

mixed icms_ipf_Handler::getModuleInfo()

getModuleConfig

mixed icms_ipf_Handler::getModuleConfig()

getModuleItemString

mixed icms_ipf_Handler::getModuleItemString()

updateCounter

mixed icms_ipf_Handler::updateCounter(object)

Arguments

  • object mixed

enableUpload

mixed icms_ipf_Handler::enableUpload(\unknown_type allowedMimeTypes, \unknown_type maxFileSize, \unknown_type maxWidth, \unknown_type maxHeight)

Arguments

  • allowedMimeTypes unknown_type
  • maxFileSize unknown_type
  • maxWidth unknown_type
  • maxHeight unknown_type
Clone this wiki locally