* @copyright 2007-2018 PrestaShop SA * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ /** * @property Zone $object */ class AdminZonesControllerCore extends AdminController { public $asso_type = 'shop'; public function __construct() { $this->bootstrap = true; $this->table = 'zone'; $this->className = 'Zone'; $this->lang = false; parent::__construct(); $this->fields_list = array( 'id_zone' => array( 'title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'center', 'class' => 'fixed-width-xs', ), 'name' => array( 'title' => $this->trans('Zone', array(), 'Admin.Global'), ), 'active' => array( 'title' => $this->trans('Enabled', array(), 'Admin.Global'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'class' => 'fixed-width-sm', ), ); $this->bulk_actions = array( 'delete' => array( 'text' => $this->trans('Delete selected', array(), 'Admin.Actions'), 'confirm' => $this->trans('Delete selected items?', array(), 'Admin.Notifications.Warning'), 'icon' => 'icon-trash', ), ); } public function initPageHeaderToolbar() { if (empty($this->display)) { $this->page_header_toolbar_btn['new_zone'] = array( 'href' => self::$currentIndex . '&addzone&token=' . $this->token, 'desc' => $this->trans('Add new zone', array(), 'Admin.International.Feature'), 'icon' => 'process-icon-new', ); } parent::initPageHeaderToolbar(); } public function renderList() { $this->addRowAction('edit'); $this->addRowAction('delete'); return parent::renderList(); } public function renderForm() { $this->fields_form = array( 'legend' => array( 'title' => $this->trans('Zones', array(), 'Admin.International.Feature'), 'icon' => 'icon-globe', ), 'input' => array( array( 'type' => 'text', 'label' => $this->trans('Name', array(), 'Admin.Global'), 'name' => 'name', 'required' => true, 'hint' => $this->trans('Zone name (e.g. Africa, West Coast, Neighboring Countries).', array(), 'Admin.International.Help'), ), array( 'type' => 'switch', 'label' => $this->trans('Active', array(), 'Admin.Global'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->trans('Enabled', array(), 'Admin.Global'), ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->trans('Disabled', array(), 'Admin.Global'), ), ), 'hint' => $this->trans('Allow or disallow shipping to this zone.', array(), 'Admin.International.Help'), ), ), ); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array( 'type' => 'shop', 'label' => $this->trans('Shop association', array(), 'Admin.Global'), 'name' => 'checkBoxShopAsso', ); } $this->fields_form['submit'] = array( 'title' => $this->trans('Save', array(), 'Admin.Actions'), ); return parent::renderForm(); } }