Skip to content

Latest commit

 

History

History
4419 lines (2235 loc) · 113 KB

class.AdminGeolocationControllerCore.md

File metadata and controls

4419 lines (2235 loc) · 113 KB

Class AdminGeolocationControllerCore

2007-2015 PrestaShop

NOTICE OF LICENSE

This source file is subject to the Open Software License (OSL 3.0) that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://opensource.org/licenses/osl-3.0.php If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.

DISCLAIMER

Do not edit or add to this file if you wish to upgrade PrestaShop to newer versions in the future. If you wish to customize PrestaShop for your needs please refer to http://www.prestashop.com for more information.

Contents

Properties

Methods

Properties

$_defaultOrderBy

protected string $_defaultOrderBy = false

$_defaultOrderWay

protected string $_defaultOrderWay = 'ASC'

$_default_pagination

protected integer $_default_pagination = 50

$_filter

protected array $_filter

$_filterHaving

protected string $_filterHaving

$_group

protected string $_group

$_having

protected string $_having

$_includeContainer

protected boolean $_includeContainer = true

$_join

protected string $_join

$_languages

public array $_languages = array()

$_list

protected array $_list = array()

$_listTotal

protected integer $_listTotal

$_listsql

protected string $_listsql = ''

$_orderBy

protected string $_orderBy

$_orderWay

protected string $_orderWay

$_pagination

protected array $_pagination = array(20, 50, 100, 300, 1000)

$_redirect

protected boolean $_redirect = true

$_select

protected string $_select

$_tmpTableFilter

protected array $_tmpTableFilter = ''

$_use_found_rows

protected string $_use_found_rows = true

$_where

protected string $_where

$action

protected string $action

$actions

protected array $actions = array()

$actions_available

protected array $actions_available = array('view', 'edit', 'duplicate', 'delete')

$admin_webpath

public string $admin_webpath

$allow_employee_form_lang

public boolean $allow_employee_form_lang

$allow_export

protected boolean $allow_export = false

$base_tpl_form

public string $base_tpl_form = null

$base_tpl_view

public string $base_tpl_view = null

$bo_theme

protected string $bo_theme

$bootstrap

public boolean $bootstrap = false

$boxes

protected mixed $boxes

$breadcrumbs

protected array $breadcrumbs

$bulk_actions

protected array $bulk_actions

Actions to execute on multiple selections.

Usage:

array( 'actionName' => array( 'text' => $this->l('Message displayed on the submit button (mandatory)'), 'confirm' => $this->l('If set, this confirmation message will pop-up (optional)')), 'anotherAction' => array(...) );

If your action is named 'actionName', you need to have a method named bulkactionName() that will be executed when the button is clicked.

$cache_lang

public array $cache_lang = array()

$can_import

protected boolean $can_import = false

$className

public string $className

$colorOnBackground

protected boolean $colorOnBackground

$confirmations

public array $confirmations = array()

$content

public string $content

$controller_name

public string $controller_name

$currentIndex

public string $currentIndex

$default_form_language

public integer $default_form_language

$deleted

protected boolean $deleted = false

$display

protected string $display

$errors

public array $errors = array()

$explicitSelect

protected string $explicitSelect = false

$fieldImageSettings

public array $fieldImageSettings = array()

$fields_form

protected array $fields_form

$fields_form_override

protected array $fields_form_override

$fields_list

protected array $fields_list

$fields_options

protected array $fields_options = array()

$fields_value

public array $fields_value = false

$filter

protected boolean $filter

$filter_modules_list

protected array $filter_modules_list = null

$helper

protected \HelperList $helper

$id

public integer $id = -1

$id_object

protected integer $id_object

$identifier

protected string $identifier = false

$identifier_name

protected string $identifier_name = 'name'

$imageType

public string $imageType = 'jpg'

$informations

public array $informations = array()

$is_cms

protected boolean $is_cms = false

$is_prestashop_up

protected boolean $is_prestashop_up = true

$lang

public boolean $lang = false

$layout

public string $layout = 'layout.tpl'

$list_id

public string $list_id

$list_natives_modules

protected array $list_natives_modules = array()

$list_no_link

protected boolean $list_no_link = false

$list_partners_modules

protected array $list_partners_modules = array()

$list_simple_header

protected boolean $list_simple_header

$list_skip_actions

protected array $list_skip_actions = array()

$lite_display

protected mixed $lite_display = false

$logged_on_addons

protected boolean $logged_on_addons = false

$meta_title

protected string $meta_title = array()

$modals

public array $modals = array()

$modules_list

protected array $modules_list = array()

$multiple_fieldsets

public boolean $multiple_fieldsets = false

$multishop_context

public integer $multishop_context = -1

$multishop_context_group

public false $multishop_context_group = true

$noLink

protected boolean $noLink

$object

protected \ObjectModel $object

$page_header_toolbar_btn

public array $page_header_toolbar_btn = array()

$page_header_toolbar_title

public string $page_header_toolbar_title

$path

public string $path

$position_group_identifier

protected string $position_group_identifier

$position_identifier

protected string $position_identifier

$required_database

public boolean $required_database = false

$required_fields

public array $required_fields = array()

$row_hover

protected boolean $row_hover = true

$shopLink

protected string $shopLink

$shopLinkType

public string $shopLinkType

$shopShareDatas

public string $shopShareDatas = false

$show_form_cancel_button

public boolean $show_form_cancel_button

$show_page_header_toolbar

public boolean $show_page_header_toolbar = false

$show_toolbar

protected boolean $show_toolbar = true

$show_toolbar_options

protected boolean $show_toolbar_options = false

$specificConfirmDelete

protected boolean $specificConfirmDelete = null

$submit_action

protected string $submit_action

$tabAccess

public array $tabAccess

$tab_modules_list

protected array $tab_modules_list = array('default_list' => array(), 'slider_list' => array())

$table

public string $table = 'configuration'

$template

public string $template = 'content.tpl'

$token

public string $token

$toolbar_btn

protected array $toolbar_btn = null

$toolbar_scroll

protected boolean $toolbar_scroll = true

$toolbar_title

protected string $toolbar_title

$tpl_delete_link_vars

public array $tpl_delete_link_vars = array()

$tpl_folder

public string $tpl_folder

$tpl_form_vars

public array $tpl_form_vars = array()

$tpl_list_vars

public array $tpl_list_vars = array()

$tpl_option_vars

public array $tpl_option_vars = array()

$tpl_required_fields_vars

public array $tpl_required_fields_vars = array()

$tpl_view_vars

public array $tpl_view_vars = array()

$translationsTab

protected array $translationsTab = array()

$warnings

public array $warnings = array()

$ajax

public boolean $ajax = false

$content_only

protected boolean $content_only = false

$context

protected \Context $context

$controller_type

public string $controller_type

$css_files

public array $css_files = array()

$display_footer

protected string $display_footer

$display_header

protected boolean $display_header

$display_header_javascript

protected boolean $display_header_javascript

$js_files

public array $js_files = array()

$json

protected boolean $json = false

$php_errors

public array $php_errors = array()

$php_self

public string $php_self

$redirect_after

protected string $redirect_after = null

$status

protected string $status = ''

Methods

__construct

mixed AdminGeolocationControllerCore::__construct()

_childValidation

mixed AdminControllerCore::_childValidation()

Overload this method for custom checking

addCSS

true ControllerCore::addCSS(string|array $css_uri, string $css_media_type, integer|null $offset, boolean $check_path)

Adds a new stylesheet(s) to the page header.

Arguments

  • $css_uri string|array - Path to CSS file, or list of css files like this : array(array(uri => media_type), ...)
  • $css_media_type string
  • $offset integer|null
  • $check_path boolean

addFiltersToBreadcrumbs

string|void AdminControllerCore::addFiltersToBreadcrumbs()

addJS

void ControllerCore::addJS(string|array $js_uri, boolean $check_path)

Adds a new JavaScript file(s) to the page header.

Arguments

  • $js_uri string|array - Path to JS file or an array like: array(uri, ...)
  • $check_path boolean

addJquery

mixed ControllerCore::addJquery(string|null $version, string|null $folder, boolean $minifier)

Adds jQuery library file to queued JS file list

Arguments

  • $version string|null - jQuery library version
  • $folder string|null - jQuery file folder
  • $minifier boolean - If set tot true, a minified version will be included.

addJqueryPlugin

mixed ControllerCore::addJqueryPlugin(string|array $name, $folder, boolean $css)

Adds jQuery plugin(s) to queued JS file list

Arguments

  • $name string|array
  • $folder mixed
  • $css boolean

addJqueryUI

mixed ControllerCore::addJqueryUI(string|array $component, string $theme, boolean $check_dependencies)

Adds jQuery UI component(s) to queued JS file list

Arguments

  • $component string|array
  • $theme string
  • $check_dependencies boolean

addMetaTitle

mixed AdminControllerCore::addMetaTitle(string $entry)

Add an entry to the meta title.

Arguments

  • $entry string - New entry.

addPageHeaderToolBarModulesListButton

mixed AdminControllerCore::addPageHeaderToolBarModulesListButton()

addRowAction

mixed AdminControllerCore::addRowAction(string $action)

Declare an action to use for each row in the list

Arguments

  • $action string

addRowActionSkipList

mixed AdminControllerCore::addRowActionSkipList(string $action, array $list)

Add an action to use for each row in the list

Arguments

  • $action string
  • $list array

addToolBarModulesListButton

mixed AdminControllerCore::addToolBarModulesListButton()

afterAdd

boolean AdminControllerCore::afterAdd(\ObjectModel $object)

Arguments

afterDelete

boolean AdminControllerCore::afterDelete(\ObjectModel $object, integer $old_id)

Called before deletion

Arguments

afterImageUpload

boolean AdminControllerCore::afterImageUpload()

Check rights to view the current tab

afterUpdate

boolean AdminControllerCore::afterUpdate(\ObjectModel $object)

Arguments

ajaxDie

mixed ControllerCore::ajaxDie(string|null $value, string|null $controller, string|null $method)

Dies and echoes output value

Arguments

  • $value string|null
  • $controller string|null
  • $method string|null

ajaxProcessGetModuleQuickView

mixed AdminControllerCore::ajaxProcessGetModuleQuickView()

ajaxProcessOpenHelp

mixed AdminControllerCore::ajaxProcessOpenHelp()

beforeAdd

boolean AdminControllerCore::beforeAdd(\ObjectModel $object)

Called before Add

Arguments

beforeDelete

boolean AdminControllerCore::beforeDelete(\ObjectModel $object)

Called before deletion

Arguments

beforeUpdateOptions

mixed AdminControllerCore::beforeUpdateOptions()

Can be overridden

checkAccess

boolean AdminControllerCore::checkAccess()

Check if the token is valid, else display a warning page

checkToken

boolean AdminControllerCore::checkToken()

Check for security token

copyFromPost

mixed AdminControllerCore::copyFromPost($object, string $table)

Copy data values from $_POST to object

Arguments

  • $object mixed
  • $table string - Object table

createTemplate

\Smarty_Internal_Template AdminControllerCore::createTemplate(string $tpl_name)

Create a template from the override file, else from the base file.

Arguments

  • $tpl_name string - filename

display

void AdminControllerCore::display()

displayAjax

void AdminControllerCore::displayAjax()

displayFooter

mixed ControllerCore::displayFooter(boolean $display)

Sets page header display

Arguments

  • $display boolean

displayHeader

mixed ControllerCore::displayHeader(boolean $display)

Sets page header display

Arguments

  • $display boolean

displayHeaderJavaScript

mixed ControllerCore::displayHeaderJavaScript(boolean $display)

Sets page header javascript display

Arguments

  • $display boolean

displayInformation

mixed AdminControllerCore::displayInformation(string $msg)

Add a info message to display at the top of the page

Arguments

  • $msg string

displayModuleOptions

string|array AdminControllerCore::displayModuleOptions(\Module $module, string $output_type, string|null $back)

Display modules list

Arguments

  • $module Module
  • $output_type string - (link or select)
  • $back string|null

displayRequiredFields

string|void AdminControllerCore::displayRequiredFields()

Prepare the view to display the required fields form

displayWarning

mixed AdminControllerCore::displayWarning(string $msg)

Add a warning message to display at the top of the page

Arguments

  • $msg string

fillModuleData

mixed AdminControllerCore::fillModuleData(\Module $module, string $output_type, string|null $back)

Arguments

  • $module Module
  • $output_type string
  • $back string|null

filterTabModuleList

mixed AdminControllerCore::filterTabModuleList()

filterToField

array|false AdminControllerCore::filterToField(string $key, string $filter)

Arguments

  • $key string
  • $filter string

getController

\Controller ControllerCore::getController(string $class_name, boolean $auth, boolean $ssl)

returns a new instance of this controller

Arguments

  • $class_name string
  • $auth boolean
  • $ssl boolean

getFieldValue

string AdminControllerCore::getFieldValue(\ObjectModel $obj, string $key, integer|null $id_lang)

Return field value if possible (both classical and multilingual fields)

Case 1 : Return value if present in $_POST / $_GET Case 2 : Return object value

Arguments

  • $obj ObjectModel - Object
  • $key string - Field name
  • $id_lang integer|null - Language id (optional)

getFieldsValue

array AdminControllerCore::getFieldsValue(\ObjectModel $obj)

Return the list of fields value

Arguments

getLanguages

array AdminControllerCore::getLanguages()

getList

mixed AdminControllerCore::getList(integer $id_lang, string|null $order_by, string|null $order_way, integer $start, integer|null $limit, integer|boolean $id_lang_shop)

Get the current objects' list form the database

Arguments

  • $id_lang integer - Language used for display
  • $order_by string|null - ORDER BY clause
  • $order_way string|null - Order way (ASC, DESC)
  • $start integer - Offset in LIMIT clause
  • $limit integer|null - Row count in LIMIT clause
  • $id_lang_shop integer|boolean

getModulesList

boolean AdminControllerCore::getModulesList(array|string $filter_modules_list)

Arguments

  • $filter_modules_list array|string

getSelectedAssoShop

array AdminControllerCore::getSelectedAssoShop(string $table)

Returns an array with selected shops and type (group or boutique shop)

Arguments

  • $table string

getTemplateFormVars

mixed AdminControllerCore::getTemplateFormVars()

getTemplateListVars

mixed AdminControllerCore::getTemplateListVars()

getTemplateViewVars

mixed AdminControllerCore::getTemplateViewVars()

init

mixed AdminControllerCore::init()

Init context and dependencies, handles POST and GET

initBreadcrumbs

mixed AdminControllerCore::initBreadcrumbs(integer|null $tab_id, array|null $tabs)

Set breadcrumbs array for the controller page

Arguments

  • $tab_id integer|null
  • $tabs array|null

initContent

mixed AdminGeolocationControllerCore::initContent()

initCursedPage

void AdminControllerCore::initCursedPage()

Initialize the invalid doom page of death

initFooter

mixed AdminControllerCore::initFooter()

Assign smarty variables for the footer

initHeader

mixed AdminControllerCore::initHeader()

Assign smarty variables for the header

initModal

mixed AdminControllerCore::initModal()

initPageHeaderToolbar

mixed AdminControllerCore::initPageHeaderToolbar()

initProcess

mixed AdminControllerCore::initProcess()

Retrieve GET and POST value and translate them to actions

initShopContext

mixed AdminControllerCore::initShopContext()

initTabModuleList

mixed AdminControllerCore::initTabModuleList()

Init tab modules list and add button in toolbar

initToolbar

mixed AdminControllerCore::initToolbar()

assign default action in toolbar_btn smarty var, if they are not set.

uses override to specifically add, modify or remove items

initToolbarTitle

void AdminControllerCore::initToolbarTitle()

Set default toolbar_title to admin breadcrumb

isCached

boolean ControllerCore::isCached(string $template, string|null $cache_id, string|null $compile_id)

Checks if a template is cached

Arguments

  • $template string
  • $cache_id string|null - Cache item ID
  • $compile_id string|null

isFresh

boolean AdminControllerCore::isFresh(string $file, integer $timeout)

Arguments

  • $file string
  • $timeout integer

isGeoLiteCityAvailable

mixed AdminGeolocationControllerCore::isGeoLiteCityAvailable()

isXmlHttpRequest

boolean ControllerCore::isXmlHttpRequest()

Checks if the controller has been called from XmlHttpRequest (AJAX)

jsonConfirmation

mixed AdminControllerCore::jsonConfirmation(string $message)

Shortcut to set up a json success payload

Arguments

  • $message string - Success message

jsonError

mixed AdminControllerCore::jsonError(string $message)

Shortcut to set up a json error payload

Arguments

  • $message string - Error message

l

string AdminControllerCore::l(string $string, string|null $class, boolean $addslashes, boolean $htmlentities)

Non-static method which uses AdminController::translate()

Arguments

  • $string string - Term or expression in english
  • $class string|null - Name of the class
  • $addslashes boolean - If set to true, the return value will pass through addslashes(). Otherwise, stripslashes().
  • $htmlentities boolean - If set to true(default), the return value will pass through htmlentities($string, ENT_QUOTES, 'utf-8')

loadObject

\ObjectModel|false AdminControllerCore::loadObject(boolean $opt)

Load class object using identifier in $_GET (if possible) otherwise return an empty object, or die

Arguments

  • $opt boolean - Return an empty object if load fail

myErrorHandler

boolean ControllerCore::myErrorHandler(string $errno, string $errstr, string $errfile, integer $errline)

Custom error handler

Arguments

  • $errno string
  • $errstr string
  • $errfile string
  • $errline integer

postImage

boolean AdminControllerCore::postImage(integer $id)

Overload this method for custom checking

Arguments

  • $id integer - Object id used for deleting images

postProcess

boolean AdminControllerCore::postProcess()

processAdd

\ObjectModel|false AdminControllerCore::processAdd()

Object creation

processBulkAffectZone

boolean AdminControllerCore::processBulkAffectZone()

processBulkDelete

boolean AdminControllerCore::processBulkDelete()

Delete multiple items

processBulkDisableSelection

boolean AdminControllerCore::processBulkDisableSelection()

Disable multiple items

processBulkEnableSelection

boolean AdminControllerCore::processBulkEnableSelection()

Enable multiple items

processBulkStatusSelection

boolean AdminControllerCore::processBulkStatusSelection(boolean $status)

Toggle status of multiple items

Arguments

  • $status boolean

processDelete

\ObjectModel|false AdminControllerCore::processDelete()

Object Delete

processDeleteImage

\ObjectModel|false AdminControllerCore::processDeleteImage()

Object Delete images

processExport

mixed AdminControllerCore::processExport(string $text_delimiter)

Arguments

  • $text_delimiter string

processFilter

mixed AdminControllerCore::processFilter()

Set the filters used for the list display

processPosition

\ObjectModel|false AdminControllerCore::processPosition()

Change object position

processResetFilters

mixed AdminControllerCore::processResetFilters(integer|null $list_id)

Cancel all filters for this tab

Arguments

  • $list_id integer|null

processSave

\ObjectModel|false|void AdminControllerCore::processSave()

Call the right method for creating or updating object

processStatus

\ObjectModel|false AdminControllerCore::processStatus()

Change object status (active, inactive)

processUpdate

\ObjectModel|false|void AdminControllerCore::processUpdate()

Object update

processUpdateFields

\ObjectModel AdminControllerCore::processUpdateFields()

Change object required fields

processUpdateOptions

mixed AdminGeolocationControllerCore::processUpdateOptions()

redirect

mixed AdminControllerCore::redirect()

refresh

boolean AdminControllerCore::refresh(string $file_to_refresh, string $external_file)

Arguments

  • $file_to_refresh string
  • $external_file string

removeCSS

mixed ControllerCore::removeCSS(string|array $css_uri, string $css_media_type, boolean $check_path)

Removes CSS stylesheet(s) from the queued stylesheet list

Arguments

  • $css_uri string|array - Path to CSS file or an array like: array(array(uri => media_type), ...)
  • $css_media_type string
  • $check_path boolean

removeJS

mixed ControllerCore::removeJS(string|array $js_uri, boolean $check_path)

Removes JS file(s) from the queued JS file list

Arguments

  • $js_uri string|array - Path to JS file or an array like: array(uri, ...)
  • $check_path boolean

renderDetails

string|false AdminControllerCore::renderDetails()

Override to render the view page

renderForm

string AdminControllerCore::renderForm()

Function used to render the form for this controller

renderKpis

mixed AdminControllerCore::renderKpis()

renderList

string|false AdminControllerCore::renderList()

Function used to render the list to display for this controller

renderModal

string AdminControllerCore::renderModal()

renderModulesList

string AdminControllerCore::renderModulesList()

renderOptions

mixed AdminGeolocationControllerCore::renderOptions()

renderView

string AdminControllerCore::renderView()

Override to render the view page

run

mixed ControllerCore::run()

Starts the controller process (this method should not be overridden!)

setDeprecatedMedia

mixed AdminControllerCore::setDeprecatedMedia()

setHelperDisplay

void AdminControllerCore::setHelperDisplay(\Helper $helper)

This function sets various display options for helper list

Arguments

setMedia

mixed AdminControllerCore::setMedia()

setRedirectAfter

mixed ControllerCore::setRedirectAfter($url)

Set $this->redirect_after that will be used by redirect() after the process

Arguments

  • $url mixed

setTemplate

mixed ControllerCore::setTemplate(string $template)

Sets template file for page content output

Arguments

  • $template string

smartyOutputContent

mixed ControllerCore::smartyOutputContent(array|string $content)

Renders controller templates and generates page content

Arguments

  • $content array|string - Template file(s) to be rendered

updateAssoShop

boolean|void AdminControllerCore::updateAssoShop(integer $id_object)

Update the associations of shops

Arguments

  • $id_object integer

uploadImage

boolean AdminControllerCore::uploadImage(integer $id, string $name, string $dir, string|boolean $ext, integer|null $width, integer|null $height)

Arguments

  • $id integer
  • $name string
  • $dir string
  • $ext string|boolean
  • $width integer|null
  • $height integer|null

validateField

boolean AdminControllerCore::validateField(mixed $value, array $field)

Arguments

  • $value mixed
  • $field array

validateRules

mixed AdminControllerCore::validateRules(string|boolean $class_name)

Manage page display (form, list.

..)

Arguments

  • $class_name string|boolean - Allow to validate a different class than the current one

viewAccess

boolean AdminControllerCore::viewAccess(boolean $disable)

Check rights to view the current tab

Arguments

  • $disable boolean

viewDetails

mixed AdminControllerCore::viewDetails()

Display object details