Skip to content

Latest commit

 

History

History
1633 lines (828 loc) · 37.8 KB

class.ProductDownloadCore.md

File metadata and controls

1633 lines (828 loc) · 37.8 KB

Class ProductDownloadCore

Contents

Properties

Methods

Properties

$_productIds

protected mixed $_productIds = array()

$active

public boolean $active = 1

$date_add

public string $date_add

$date_expiration

public string $date_expiration

$definition

public mixed $definition = array('table' => 'product_download', 'primary' => 'id_product_download', 'fields' => array('id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'display_filename' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255), 'filename' => array('type' => self::TYPE_STRING, 'validate' => 'isSha1', 'size' => 255), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_expiration' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'nb_days_accessible' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'size' => 10), 'nb_downloadable' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'size' => 10), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'is_shareable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')))

$display_filename

public string $display_filename

$filename

public string $filename

$id_product

public integer $id_product

$id_product_attribute

public integer $id_product_attribute

$is_shareable

public boolean $is_shareable

$nb_days_accessible

public string $nb_days_accessible

$nb_downloadable

public string $nb_downloadable

$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 ProductDownloadCore::__construct(integer $id_product_download)

Build a virtual product

Arguments

  • $id_product_download integer - Existing productDownload id in order to load object (optional)

add

mixed ProductDownloadCore::add($autodate, $null_values)

Arguments

  • $autodate mixed
  • $null_values 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

checkFile

boolean ProductDownloadCore::checkFile()

Check if file exists

checkWritableDir

boolean ProductDownloadCore::checkWritableDir()

Check if download repository is writable

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

delete

mixed ProductDownloadCore::delete($delete)

Arguments

  • $delete mixed

deleteFile

boolean ProductDownloadCore::deleteFile(integer $id_product_download)

Delete the file

Arguments

  • $id_product_download integer - : if we need to delete a specific product attribute file

deleteImage

boolean ObjectModelCore::deleteImage()

Delete images associated with the object

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

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

getAttributeFromIdAttribute

array ProductDownloadCore::getAttributeFromIdAttribute(integer $id_product, integer $id_product_attribute)

Return the result from an id_product_attribute

Arguments

  • $id_product integer - Product the id
  • $id_product_attribute integer - Attribute the id

getAttributeFromIdProduct

integer ProductDownloadCore::getAttributeFromIdProduct($id_product)

Return the display filename from a physical filename

Arguments

  • $id_product mixed

getDeadline

string ProductDownloadCore::getDeadline()

Return a deadline

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 ProductDownloadCore::getFields()

getFieldsLang

array ObjectModelCore::getFieldsLang()

Prepare multilang fields

getFieldsRequiredDatabase

mixed ObjectModelCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getFilenameFromFilename

string ProductDownloadCore::getFilenameFromFilename(string $filename)

Return the display filename from a physical filename

Arguments

  • $filename string - Filename physically

getFilenameFromIdAttribute

string ProductDownloadCore::getFilenameFromIdAttribute(integer $id_product, integer $id_product_attribute)

Return the filename from an id_product_attribute

Arguments

  • $id_product integer - Product the id
  • $id_product_attribute integer - Attribute the id

getFilenameFromIdProduct

string ProductDownloadCore::getFilenameFromIdProduct(integer $id_product)

Return the filename from an id_product

Arguments

  • $id_product integer - Product the id

getHash

string ProductDownloadCore::getHash()

Return a hash for control download access

getHtmlLink

string ProductDownloadCore::getHtmlLink(string $class, boolean $admin, boolean $hash)

Return html link

Arguments

  • $class string - CSS selector
  • $admin boolean - specific to backend
  • $hash boolean - hash code in table order detail

getIdFromFilename

integer ProductDownloadCore::getIdFromFilename(string $filename)

Return the display filename from a physical filename

Arguments

  • $filename string - Filename physically

getIdFromIdAttribute

integer ProductDownloadCore::getIdFromIdAttribute(integer $id_product, $id_product_attribute)

Return the id_product_download from an id_product

Arguments

  • $id_product integer - Product the id
  • $id_product_attribute mixed

getIdFromIdProduct

integer ProductDownloadCore::getIdFromIdProduct(integer $id_product)

Return the id_product_download from an id_product

Arguments

  • $id_product integer - Product the id

getNewFilename

string ProductDownloadCore::getNewFilename()

Return a sha1 filename

getTextLink

string ProductDownloadCore::getTextLink(boolean $admin, string $hash)

Return html link

Arguments

  • $admin boolean - specific to backend (optionnal)
  • $hash string - hash code in table order detail (optionnal)

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

isFeatureActive

boolean ProductDownloadCore::isFeatureActive()

This method is allow to know if a feature is used or active

isLangMultishop

mixed ObjectModelCore::isLangMultishop()

makeTranslationFields

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

Arguments

  • $fields mixed
  • $fields_array mixed
  • $id_language 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

mixed ProductDownloadCore::update($null_values)

Arguments

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