Skip to content

Latest commit

 

History

History
1786 lines (914 loc) · 38.8 KB

class.HookCore.md

File metadata and controls

1786 lines (914 loc) · 38.8 KB

Class HookCore

Contents

Properties

Methods

Properties

$_hook_modules_cache

protected mixed $_hook_modules_cache = null

$_hook_modules_cache_exec

protected mixed $_hook_modules_cache_exec = null

$definition

public mixed $definition = array('table' => 'hook', 'primary' => 'id_hook', 'fields' => array('name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 32), 'title' => array('type' => self::TYPE_STRING), 'description' => array('type' => self::TYPE_HTML), 'position' => array('type' => self::TYPE_BOOL), 'live_edit' => array('type' => self::TYPE_BOOL)))

$description

public string $description

$executed_hooks

public array $executed_hooks = array()

$live_edit

public boolean $live_edit = false

$name

public string $name

$position

public boolean $position = false

$title

public string $title

$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

PDFInvoice

mixed HookCore::PDFInvoice($pdf, $id_order)

Arguments

  • $pdf mixed
  • $id_order mixed

__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

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

Add current object to database

Arguments

  • $autodate boolean
  • $null_values boolean

addFieldsRequiredDatabase

mixed ObjectModelCore::addFieldsRequiredDatabase($fields)

Arguments

  • $fields mixed

addProduct

mixed HookCore::addProduct($product)

Arguments

  • $product 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

backBeforePayment

mixed HookCore::backBeforePayment($module)

Arguments

  • $module mixed

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

delete

boolean ObjectModelCore::delete()

Delete current object from database

deleteImage

boolean ObjectModelCore::deleteImage()

Delete images associated with the object

deleteProduct

mixed HookCore::deleteProduct($product)

Arguments

  • $product mixed

deleteSelection

boolean ObjectModelCore::deleteSelection(array $selection)

Delete several objects from database

Arguments

  • $selection array

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

exec

string HookCore::exec(string $hook_name, array $hookArgs, integer $id_module)

Execute modules for specified hook

Arguments

  • $hook_name string - Hook Name
  • $hookArgs array - Parameters for the functions
  • $id_module integer - Execute hook for this module only

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

get

integer HookCore::get(string $hookName)

Return hook ID from name

Arguments

  • $hookName string - Hook name

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

getHookAliasList

array HookCore::getHookAliasList()

Get list of hook alias

getHookModuleExecList

array HookCore::getHookModuleExecList(string $hook_name)

Get list of modules we can execute per hook

Arguments

  • $hook_name string - Get list of modules for this hook if given

getHookModuleList

array HookCore::getHookModuleList()

Get list of all registered hooks with modules

getHooks

array HookCore::getHooks(boolean $position)

Return Hooks List

Arguments

  • $position boolean

getIdByName

integer HookCore::getIdByName(string $hook_name)

Return hook ID from name

Arguments

  • $hook_name string - Hook name

getModulesFromHook

array HookCore::getModulesFromHook(integer $id_hook, integer $id_module)

Return Hooks List

Arguments

  • $id_hook integer
  • $id_module integer

getRetroHookName

integer HookCore::getRetroHookName(string $hook_name)

Return retrocompatible hook name

Arguments

  • $hook_name string - Hook name

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

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

newOrder

mixed HookCore::newOrder($cart, $order, $customer, $currency, $orderStatus)

Called when quantity of a product is updated.

Arguments

  • $cart mixed
  • $order mixed
  • $customer mixed
  • $currency mixed
  • $orderStatus mixed

orderConfirmation

mixed HookCore::orderConfirmation($id_order)

Arguments

  • $id_order mixed

paymentReturn

mixed HookCore::paymentReturn($id_order, $id_module)

Arguments

  • $id_order mixed
  • $id_module mixed

postUpdateOrderStatus

mixed HookCore::postUpdateOrderStatus($newOrderStatusId, $id_order)

Arguments

  • $newOrderStatusId mixed
  • $id_order mixed

preloadHookModulesCache

boolean HookCore::preloadHookModulesCache()

Preload hook modules cache

productFooter

mixed HookCore::productFooter($product, $category)

Arguments

  • $product mixed
  • $category mixed

productOutOfStock

mixed HookCore::productOutOfStock($product)

Arguments

  • $product 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

updateCarrier

mixed HookCore::updateCarrier($id_carrier, $carrier)

Arguments

  • $id_carrier mixed
  • $carrier mixed

updateOrderStatus

mixed HookCore::updateOrderStatus($newOrderStatusId, $id_order)

Arguments

  • $newOrderStatusId mixed
  • $id_order mixed

updateProduct

mixed HookCore::updateProduct($product)

Arguments

  • $product mixed

updateProductAttribute

mixed HookCore::updateProductAttribute($id_product_attribute)

Arguments

  • $id_product_attribute mixed

updateQuantity

mixed HookCore::updateQuantity($product, $order)

Arguments

  • $product mixed
  • $order 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