Skip to content

Latest commit

 

History

History
1627 lines (832 loc) · 35.6 KB

class.TabCore.md

File metadata and controls

1627 lines (832 loc) · 35.6 KB

Class TabCore

Contents

Properties

Methods

Properties

$_cache_tabs

public mixed $_cache_tabs = array()

Get tabs

$_getIdFromClassName

protected mixed $_getIdFromClassName = null

$active

public integer $active = true

$class_name

public string $class_name

$definition

public mixed $definition = array('table' => 'tab', 'primary' => 'id_tab', 'multilang' => true, 'fields' => array('id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'module' => array('type' => self::TYPE_STRING, 'validate' => 'isTabName', 'size' => 64), 'class_name' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 64), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 32)))

$id_parent

public integer $id_parent

$module

public mixed $module

$name

public string $name

$position

public integer $position

$def

protected array $def

$fieldsRequired

protected mixed $fieldsRequired = array()

$fieldsRequiredDatabase

protected mixed $fieldsRequiredDatabase = null

$fieldsRequiredLang

protected mixed $fieldsRequiredLang = array()

$fieldsSize

protected mixed $fieldsSize = array()

$fieldsSizeLang

protected mixed $fieldsSizeLang = array()

$fieldsValidate

protected mixed $fieldsValidate = array()

$fieldsValidateLang

protected mixed $fieldsValidateLang = array()

$id

public integer $id

$id_lang

protected integer $id_lang = null

$id_shop

protected mixed $id_shop = null

$identifier

protected mixed $identifier

$image_dir

protected string $image_dir = null

$image_format

protected string $image_format = 'jpg'

$table

protected mixed $table

$tables

protected mixed $tables = array()

$webserviceParameters

protected array $webserviceParameters = array()

Methods

__construct

mixed ObjectModelCore::__construct(integer $id, integer $id_lang, integer $id_shop)

Build object

Arguments

  • $id integer - Existing object id in order to load object (optional)
  • $id_lang integer - Required if object is multilingual (optional)
  • $id_shop integer - ID shop for objects with multishop on langs

add

integer TabCore::add(boolean $autodate, boolean $null_values)

additionnal treatments for Tab when creating new one :

  • generate a new position
  • add access for admin profile

Arguments

  • $autodate boolean
  • $null_values boolean

addFieldsRequiredDatabase

mixed ObjectModelCore::addFieldsRequiredDatabase($fields)

Arguments

  • $fields mixed

associateTo

boolean ObjectModelCore::associateTo(integer|array $id_shops, string $type)

This function associate an item to its context

Arguments

  • $id_shops integer|array
  • $type string

checkTabRights

mixed TabCore::checkTabRights($id_tab)

Arguments

  • $id_tab mixed

cleanPositions

mixed TabCore::cleanPositions($id_parent)

Arguments

  • $id_parent mixed

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

delete

mixed TabCore::delete()

deleteImage

boolean ObjectModelCore::deleteImage()

Delete images associated with the object

deleteSelection

boolean ObjectModelCore::deleteSelection(array $selection)

Delete several objects from database

Arguments

  • $selection array

disablingForModule

boolean TabCore::disablingForModule($module)

Disabling tabs for module

Arguments

  • $module mixed - string Module name

displayFieldName

mixed ObjectModelCore::displayFieldName($field, $class, $htmlentities, \Context $context)

Arguments

  • $field mixed
  • $class mixed
  • $htmlentities mixed
  • $context Context

duplicateShops

mixed ObjectModelCore::duplicateShops($id)

Arguments

  • $id mixed

enablingForModule

boolean TabCore::enablingForModule($module)

Enabling tabs for module

Arguments

  • $module mixed - string Module Name

existsInDatabase

boolean ObjectModelCore::existsInDatabase(integer $id_entity, string $table)

Specify if an ObjectModel is already in database

Arguments

  • $id_entity integer
  • $table string

formatFields

array ObjectModelCore::formatFields(integer $id_lang)

Arguments

  • $id_lang integer - If this parameter is given, only take lang fields

formatValue

mixed ObjectModelCore::formatValue(mixed $value, integer $type, $with_quotes)

Format a data

Arguments

  • $value mixed
  • $type integer
  • $with_quotes mixed

getCollectionFromModule

array|\Collection TabCore::getCollectionFromModule($module, null $id_lang)

Get collection from module name

Arguments

  • $module mixed - string Module name
  • $id_lang null - integer Language ID

getCurrentParentId

integer TabCore::getCurrentParentId()

Get tab parent id

getCurrentTabId

integer TabCore::getCurrentTabId()

Get tab id

getDefinition

array ObjectModelCore::getDefinition(string $class, string $field)

Get object definition

Arguments

  • $class string - Name of object
  • $field string - Name of field if we want the definition of one field only

getFieldByLang

mixed ObjectModelCore::getFieldByLang($field_name, null $id_lang)

Return the field value for the specified language if the field is multilang, else the field value.

Arguments

  • $field_name mixed
  • $id_lang null

getFields

array ObjectModelCore::getFields()

Prepare fields for ObjectModel class (add, update) All fields are verified (pSQL, intval.

..)

getFieldsLang

array ObjectModelCore::getFieldsLang()

Prepare multilang fields

getFieldsRequiredDatabase

mixed ObjectModelCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getIdFromClassName

integer TabCore::getIdFromClassName($class_name)

Get tab id from name

Arguments

  • $class_name mixed

getInstanceFromClassName

\Tab TabCore::getInstanceFromClassName($class_name)

Get Instance from tab class name

Arguments

  • $class_name mixed - string Name of tab class

getModuleTabList

array TabCore::getModuleTabList()

Return the list of tab used by a module

getNbTabs

mixed TabCore::getNbTabs($id_parent)

Arguments

  • $id_parent mixed

getNewLastPosition

integer TabCore::getNewLastPosition(mixed $id_parent)

return an available position in subtab for parent $id_parent

Arguments

  • $id_parent mixed

getTab

array TabCore::getTab($id_lang, $id_tab)

Get tab

Arguments

  • $id_lang mixed
  • $id_tab mixed

getTabs

mixed TabCore::getTabs($id_lang, $id_parent)

Arguments

  • $id_lang mixed
  • $id_parent mixed

getTranslationsFields

mixed ObjectModelCore::getTranslationsFields($fields_array)

Arguments

  • $fields_array mixed

getValidationRules

array ObjectModelCore::getValidationRules(string $class)

Returns object validation rules (fields validity)

Arguments

  • $class string - Child class name for static use (optional)

getWebserviceObjectList

mixed ObjectModelCore::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)

Arguments

  • $sql_join mixed
  • $sql_filter mixed
  • $sql_sort mixed
  • $sql_limit mixed

getWebserviceParameters

mixed ObjectModelCore::getWebserviceParameters($ws_params_attribute_name)

Arguments

  • $ws_params_attribute_name mixed

hydrate

mixed ObjectModelCore::hydrate(array $data, integer $id_lang)

Fill an object with given data. Data must be an array with this syntax: array(objProperty => value, objProperty2 => value, etc.)

Arguments

  • $data array
  • $id_lang integer

hydrateCollection

array ObjectModelCore::hydrateCollection(string $class, array $datas, integer $id_lang)

Fill (hydrate) a list of objects in order to get a collection of these objects

Arguments

  • $class string - Class of objects to hydrate
  • $datas array - List of data (multi-dimensional array)
  • $id_lang integer

initAccess

boolean TabCore::initAccess(integer $id_tab, \Context $context)

When creating a new tab $id_tab, this add default rights to the table access

Arguments

isAssociatedToGroupShop

boolean ObjectModelCore::isAssociatedToGroupShop(integer $id_group_shop)

Check if current object is associated to a group shop

Arguments

  • $id_group_shop integer

isAssociatedToShop

boolean ObjectModelCore::isAssociatedToShop(integer $id_shop)

Check if current object is associated to a shop

Arguments

  • $id_shop integer

isCurrentlyUsed

boolean ObjectModelCore::isCurrentlyUsed(string $table, boolean $has_active_column)

This method is allow to know if a entity is currently used

Arguments

  • $table string - name of table linked to entity
  • $has_active_column boolean - true if the table has an active column

isLangMultishop

mixed ObjectModelCore::isLangMultishop()

makeTranslationFields

mixed ObjectModelCore::makeTranslationFields($fields, $fields_array, $id_language)

Arguments

  • $fields mixed
  • $fields_array mixed
  • $id_language mixed

move

mixed TabCore::move($direction)

Arguments

  • $direction mixed

recursiveTab

mixed TabCore::recursiveTab($id_tab, $tabs)

Arguments

  • $id_tab mixed
  • $tabs mixed

save

boolean ObjectModelCore::save(boolean $null_values, boolean $autodate)

Save current object to database (add or update)

Arguments

  • $null_values boolean
  • $autodate boolean

setDefinitionRetrocompatibility

mixed ObjectModelCore::setDefinitionRetrocompatibility()

Retrocompatibility for classes without $definition static Remove this in 1.6 !

toggleStatus

boolean ObjectModelCore::toggleStatus()

Toggle object status in database

update

boolean ObjectModelCore::update(boolean $null_values)

Update current object to database

Arguments

  • $null_values boolean

updatePosition

mixed TabCore::updatePosition($way, $position)

Arguments

  • $way mixed
  • $position mixed

validateControler

mixed ObjectModelCore::validateControler($htmlentities)

TODO: refactor rename all calls to this to validateController

Arguments

  • $htmlentities mixed

validateController

mixed ObjectModelCore::validateController($htmlentities)

Arguments

  • $htmlentities mixed

validateField

boolean|string ObjectModelCore::validateField(string $field, mixed $value, integer $id_lang)

Validate a single field

Arguments

  • $field string - Field name
  • $value mixed - Field value
  • $id_lang integer

validateFields

boolean|string ObjectModelCore::validateFields(boolean $die, boolean $error_return)

Check for fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean

validateFieldsLang

boolean|string ObjectModelCore::validateFieldsLang(boolean $die, boolean $error_return)

Check for multilingual fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean