Skip to content

Latest commit

 

History

History
1709 lines (860 loc) · 37.5 KB

class.CMSCategoryCore.md

File metadata and controls

1709 lines (860 loc) · 37.5 KB

Class CMSCategoryCore

Contents

Properties

Methods

Properties

$_links

protected mixed $_links = array()

$active

public boolean $active = 1

$date_add

public string $date_add

$date_upd

public string $date_upd

$description

public string $description

$fieldsRequired

protected mixed $fieldsRequired = array('id_parent', 'active')

$fieldsRequiredLang

protected mixed $fieldsRequiredLang = array('name', 'link_rewrite')

$fieldsSize

protected mixed $fieldsSize = array('id_parent' => 10, 'active' => 1)

$fieldsSizeLang

protected mixed $fieldsSizeLang = array('name' => 64, 'link_rewrite' => 64, 'meta_title' => 128, 'meta_description' => 255, 'meta_keywords' => 255)

$fieldsValidate

protected mixed $fieldsValidate = array('active' => 'isBool', 'id_parent' => 'isUnsignedInt')

$fieldsValidateLang

protected mixed $fieldsValidateLang = array('name' => 'isCatalogName', 'link_rewrite' => 'isLinkRewrite', 'description' => 'isCleanHtml', 'meta_title' => 'isGenericName', 'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName')

$id

public mixed $id

$id_cms_category

public integer $id_cms_category

$id_parent

public integer $id_parent

$identifier

protected mixed $identifier = 'id_cms_category'

$level_depth

public integer $level_depth

$link_rewrite

public string $link_rewrite

$meta_description

public string $meta_description

$meta_keywords

public string $meta_keywords

$meta_title

public string $meta_title

$name

public string $name

$position

public integer $position

$table

protected mixed $table = 'cms_category'

$tables

protected mixed $tables = array('cms_category', 'cms_category_lang')

$_cache

protected mixed $_cache = array()

$fieldsRequiredDatabase

protected \fieldsRequiredDatabase $fieldsRequiredDatabase = null

$id_lang

protected integer $id_lang = null

$id_shop

protected mixed $id_shop = null

$image_dir

protected string $image_dir = null

$image_format

protected string $image_format = 'jpg'

$langMultiShop

protected mixed $langMultiShop = false

$webserviceParameters

protected array $webserviceParameters = array()

Methods

__construct

mixed CMSCategoryCore::__construct($id_cms_category, $id_lang)

Arguments

  • $id_cms_category mixed
  • $id_lang mixed

add

mixed CMSCategoryCore::add($autodate, $nullValues)

Arguments

  • $autodate mixed
  • $nullValues mixed

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

calcLevelDepth

integer CMSCategoryCore::calcLevelDepth()

Get the number of parent categories

checkBeforeMove

boolean CMSCategoryCore::checkBeforeMove($id_cms_category, integer $id_parent)

Check if CMSCategory can be moved in another one

Arguments

  • $id_cms_category mixed
  • $id_parent integer - Parent candidate

cleanPositions

mixed CMSCategoryCore::cleanPositions($id_category_parent)

Arguments

  • $id_category_parent mixed

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

delete

mixed CMSCategoryCore::delete()

deleteImage

boolean ObjectModelCore::deleteImage()

Delete images associated with the object

deleteSelection

mixed CMSCategoryCore::deleteSelection($categories)

Delete several categories from database

return boolean Deletion result

Arguments

  • $categories mixed

displayFieldName

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

Arguments

  • $field mixed
  • $className mixed
  • $htmlentities mixed
  • $context Context

duplicateShops

mixed ObjectModelCore::duplicateShops($id)

Arguments

  • $id mixed

existsInDatabase

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

Specify if an ObjectModel is already in database

Arguments

  • $id_entity mixed - entity id
  • $table mixed

getCategories

array CMSCategoryCore::getCategories(integer $id_lang, boolean $active, $order)

Return available categories

Arguments

  • $id_lang integer - Language ID
  • $active boolean - return only active categories
  • $order mixed

getChildren

mixed CMSCategoryCore::getChildren($id_parent, $id_lang, $active)

Arguments

  • $id_parent mixed
  • $id_lang mixed
  • $active mixed

getFields

mixed CMSCategoryCore::getFields()

getFieldsRequiredDatabase

mixed ObjectModelCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getFieldsValidateLang

array ObjectModelCore::getFieldsValidateLang()

Get list of fields related to language to validate

getHomeCategories

array CMSCategoryCore::getHomeCategories(integer $id_lang, boolean $active)

Return main categories

Arguments

  • $id_lang integer - Language ID
  • $active boolean - return only active categories

getIdentifier

string ObjectModelCore::getIdentifier()

Get object identifier name

getLastPosition

mixed CMSCategoryCore::getLastPosition($id_category_parent)

Arguments

  • $id_category_parent mixed

getLink

mixed CMSCategoryCore::getLink(\Link $link)

Arguments

getLinkRewrite

mixed CMSCategoryCore::getLinkRewrite($id_cms_category, $id_lang)

Arguments

  • $id_cms_category mixed
  • $id_lang mixed

getName

mixed CMSCategoryCore::getName($id_lang)

Arguments

  • $id_lang mixed

getParentsCategories

array CMSCategoryCore::getParentsCategories(integer $id_lang)

Get Each parent CMSCategory of this CMSCategory until the root CMSCategory

Arguments

  • $id_lang integer - Language ID

getRecurseCategory

mixed CMSCategoryCore::getRecurseCategory($id_lang, $current, $active, $links, \Link $link, \Shop $shop)

Arguments

  • $id_lang mixed
  • $current mixed
  • $active mixed
  • $links mixed
  • $link Link
  • $shop Shop

getSimpleCategories

mixed CMSCategoryCore::getSimpleCategories($id_lang)

Arguments

  • $id_lang mixed

getSubCategories

array CMSCategoryCore::getSubCategories(integer $id_lang, boolean $active)

Return current CMSCategory childs

Arguments

  • $id_lang integer - Language ID
  • $active boolean - return only active categories

getTranslationsFields

mixed ObjectModelCore::getTranslationsFields(array $fieldsArray)

Prepare multilingual fields for database insertion

Arguments

  • $fieldsArray array - Multilingual fields to prepare return array Prepared fields for database insertion

getTranslationsFieldsChild

array CMSCategoryCore::getTranslationsFieldsChild()

Check then return multilingual fields for database interaction

getUrlRewriteInformations

mixed CMSCategoryCore::getUrlRewriteInformations($id_category)

Arguments

  • $id_category mixed

getValidationRules

array ObjectModelCore::getValidationRules(string $className)

Returns object validation rules (fields validity)

Arguments

  • $className 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($wsParamsAttributeName)

Arguments

  • $wsParamsAttributeName mixed

hideCMSCategoryPosition

string CMSCategoryCore::hideCMSCategoryPosition(string $name)

Hide CMSCategory prefix used for position

Arguments

  • $name string - CMSCategory name

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

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, $fieldsArray, $id_language)

Arguments

  • $fields mixed
  • $fieldsArray mixed
  • $id_language mixed

recurseCMSCategory

mixed CMSCategoryCore::recurseCMSCategory($categories, $current, $id_cms_category, $id_selected, $is_html)

Arguments

  • $categories mixed
  • $current mixed
  • $id_cms_category mixed
  • $id_selected mixed
  • $is_html mixed

recurseLiteCategTree

array CMSCategoryCore::recurseLiteCategTree(integer $maxDepth, integer $currentDepth, $id_lang, array $excludedIdsArray, \Link $link)

Recursive scan of subcategories

Arguments

  • $maxDepth integer - Maximum depth of the tree (i.e. 2 => 3 levels depth)
  • $currentDepth integer - specify the current depth in the tree (don't use it, only for rucursivity!)
  • $id_lang mixed
  • $excludedIdsArray array - specify a list of ids to exclude of results
  • $link Link

recursiveDelete

mixed CMSCategoryCore::recursiveDelete($toDelete, array $id_cms_category)

Recursively add specified CMSCategory childs to $toDelete array

Arguments

  • $toDelete mixed
  • $id_cms_category array - Parent CMSCategory ID

save

mixed ObjectModelCore::save($nullValues, $autodate)

Save current object to database (add or update)

return boolean Insertion result

Arguments

  • $nullValues mixed
  • $autodate mixed

searchByName

array CMSCategoryCore::searchByName(integer $id_lang, string $query, boolean $unrestricted)

Light back office search for categories

Arguments

  • $id_lang integer - Language ID
  • $query string - Searched string
  • $unrestricted boolean - allows search without lang and includes first CMSCategory and exact match

searchByNameAndParentCMSCategoryId

array CMSCategoryCore::searchByNameAndParentCMSCategoryId(integer $id_lang, string $CMSCategory_name, integer $id_parent_CMSCategory)

Retrieve CMSCategory by name and parent CMSCategory id

Arguments

  • $id_lang integer - Language ID
  • $CMSCategory_name string - Searched CMSCategory name
  • $id_parent_CMSCategory integer - parent CMSCategory ID

toggleStatus

mixed ObjectModelCore::toggleStatus()

Toggle object status in database

return boolean Update result

update

mixed CMSCategoryCore::update($nullValues)

Arguments

  • $nullValues mixed

updatePosition

mixed CMSCategoryCore::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

validateFields

mixed ObjectModelCore::validateFields($die, $errorReturn)

Check for fields validity before database interaction

Arguments

  • $die mixed
  • $errorReturn mixed

validateFieldsLang

mixed ObjectModelCore::validateFieldsLang($die, $errorReturn)

Check for multilingual fields validity before database interaction

Arguments

  • $die mixed
  • $errorReturn mixed