public function initToolbar()
 {
     switch ($this->display) {
         default:
             parent::initToolbar();
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if (in_array($this->display, array('add', 'edit'))) {
         $this->toolbar_btn = array_merge(array('save-and-stay' => array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'))), $this->toolbar_btn);
     }
 }
 public function initToolbar()
 {
     if ($this->display == 'add' || $this->display == 'edit') {
         $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save, then add a category reduction.'), 'force_desc' => true);
     }
     parent::initToolbar();
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if (isset($this->toolbar_btn['new'])) {
         $this->toolbar_btn['new']['href'] = $this->context->link->getAdminLink('AdminCarrierWizard');
     }
 }
 public function initToolbar()
 {
     if (!$this->id_shop_group && $this->object && $this->object->id_shop_group) {
         $this->id_shop_group = $this->object->id_shop_group;
     }
     if (!$this->display && $this->id_shop_group) {
         $this->toolbar_btn['edit'] = array('desc' => $this->l('Edit this shop group'), 'href' => $this->context->link->getAdminLink('AdminShopGroup') . '&updateshop_group&id_shop_group=' . $this->id_shop_group);
     }
     if ($this->display == 'edit' || $this->display == 'add') {
         if ($shop = $this->loadObject(true)) {
             if ((bool) $shop->id) {
                 // adding button for delete this shop
                 if ($this->tabAccess['delete'] && $this->display != 'add' && !Shop::hasDependency($shop->id)) {
                     $this->toolbar_btn['delete'] = array('short' => 'Delete', 'href' => $this->context->link->getAdminLink('AdminShop') . '&id_shop=' . $shop->id . '&deleteshop', 'desc' => $this->l('Delete this shop'), 'confirm' => 1);
                 }
                 $this->toolbar_btn['new-url'] = array('href' => $this->context->link->getAdminLink('AdminShopUrl') . '&id_shop=' . $shop->id . '&addshop_url', 'desc' => $this->l('Add URL'), 'class' => 'addShopUrl');
             }
             if ($this->tabAccess['edit']) {
                 $this->toolbar_btn['save'] = array('short' => 'Save', 'href' => '#todo' . $this->context->link->getAdminLink('AdminShops') . '&id_shop=' . $shop->id, 'desc' => $this->l('Save'));
                 $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#todo' . $this->context->link->getAdminLink('AdminShops') . '&id_shop=' . $shop->id, 'desc' => $this->l('Save and stay'));
             }
         }
     }
     parent::initToolbar();
     $this->context->smarty->assign('toolbar_scroll', 1);
     $this->show_toolbar = false;
     if (isset($this->toolbar_btn['new'])) {
         $this->toolbar_btn['new'] = array('desc' => $this->l('Add new shop'), 'href' => $this->context->link->getAdminLink('AdminShop') . '&add' . $this->table . '&id_shop_group=' . $this->id_shop_group);
     }
     if (isset($this->toolbar_btn['back'])) {
         $this->toolbar_btn['back']['href'] .= '&id_shop_group=' . $this->id_shop_group;
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if (!$this->display) {
         $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=addresses', 'desc' => $this->l('Import'));
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if (isset($this->toolbar_btn['new']) && $this->display != 'view') {
         $this->toolbar_btn['new']['href'] = $this->context->link->getAdminLink('AdminCarriers') . '&onboarding_carrier';
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if ($this->display != 'add' && $this->display != 'edit') {
         $this->toolbar_btn['new'] = array('desc' => $this->l('Add a new shop group'), 'href' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token);
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if ($this->display == 'options') {
         unset($this->toolbar_btn['new']);
     } elseif ($this->display != 'add' && $this->display != 'edit') {
         unset($this->toolbar_btn['save']);
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if (!$this->can_add_confirmpayment) {
         unset($this->toolbar_btn['new']);
     } elseif (!$this->display && $this->can_import) {
         $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=confirmpayment', 'desc' => $this->l('Import'));
     }
 }
 public function initToolbar()
 {
     // If display list, we don't want the "add" button
     if (!$this->display || $this->display == 'list') {
         return;
     } elseif ($this->display != 'options') {
         $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'), 'force_desc' => true);
     }
     parent::initToolbar();
 }
 public function initToolbar()
 {
     if ($this->display == 'view' && ($id_request = Tools::getValue('id_request_sql'))) {
         $this->toolbar_btn['edit'] = array('href' => self::$currentIndex . '&updaterequest_sql&token=' . $this->token . '&id_request_sql=' . (int) $id_request, 'desc' => $this->l('Edit this SQL query'));
     }
     parent::initToolbar();
     if ($this->display == 'options') {
         unset($this->toolbar_btn['new']);
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if ($this->display != 'edit' && $this->display != 'add') {
         if ($this->id_object) {
             $this->loadObject();
         }
         if (!$this->id_shop_group && $this->object && $this->object->id_shop_group) {
             $this->id_shop_group = $this->object->id_shop_group;
         }
         $this->toolbar_btn['new'] = array('desc' => $this->l('Add new shop'), 'href' => $this->context->link->getAdminLink('AdminShop') . '&add' . $this->table . '&id_shop_group=' . $this->id_shop_group);
     }
 }
 public function initContent()
 {
     parent::initToolbar();
     parent::initTabModuleList();
     parent::initPageHeaderToolbar();
     $this->addHeaderToolbarBtn();
     parent::initContent();
     $this->show_page_header_toolbar = (bool) $this->showContentHeader;
     if ($this->title) {
         $this->context->smarty->assign(array('title' => $this->title));
     }
     $vars = array('maintenance_mode' => !(bool) Configuration::get('PS_SHOP_ENABLE'), 'headerTabContent' => $this->headerTabContent, 'content' => '{$content}', 'enableSidebar' => $this->enableSidebar);
     if (!empty($this->helpLink)) {
         $vars['help_link'] = $this->helpLink;
     }
     $this->context->smarty->assign($vars);
 }
 public function initToolbar()
 {
     if (empty($this->display)) {
         if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) {
             $this->toolbar_btn['new-url'] = array('href' => self::$currentIndex . '&add' . $this->table . 'root&token=' . $this->token, 'desc' => $this->l('Add new root category'));
         }
         $this->toolbar_btn['new'] = array('href' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token, 'desc' => $this->l('Add new'));
         $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=' . $this->table, 'desc' => $this->l('Import'));
     }
     // be able to edit the Home category
     if (count(Category::getCategoriesWithoutParent()) == 1 && !Tools::isSubmit('id_category') && ($this->display == 'view' || empty($this->display))) {
         $this->toolbar_btn['edit'] = array('href' => self::$currentIndex . '&update' . $this->table . '&id_category=' . (int) $this->_category->id . '&token=' . $this->token, 'desc' => $this->l('Edit'));
     }
     if (Tools::getValue('id_category') && !Tools::isSubmit('updatecategory')) {
         $this->toolbar_btn['edit'] = array('href' => self::$currentIndex . '&update' . $this->table . '&id_category=' . (int) Tools::getValue('id_category') . '&token=' . $this->token, 'desc' => $this->l('Edit'));
     }
     if ($this->display == 'view') {
         $this->toolbar_btn['new'] = array('href' => self::$currentIndex . '&add' . $this->table . '&id_parent=' . (int) Tools::getValue('id_category') . '&token=' . $this->token, 'desc' => $this->l('Add new'));
     }
     parent::initToolbar();
     if ($this->_category->id == Category::getTopCategory()->id && isset($this->toolbar_btn['new'])) {
         unset($this->toolbar_btn['new']);
     }
     // after adding a category
     if (empty($this->display)) {
         $id_category = Tools::isSubmit('id_category') ? '&id_parent=' . (int) Tools::getValue('id_category') : '';
         $this->toolbar_btn['new'] = array('href' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token . $id_category, 'desc' => $this->l('Add new'));
         if (Tools::isSubmit('id_category')) {
             $back = Tools::safeOutput(Tools::getValue('back', ''));
             if (empty($back)) {
                 $back = self::$currentIndex . '&token=' . $this->token;
             }
             $this->toolbar_btn['back'] = array('href' => $back, 'desc' => $this->l('Back to list'));
         }
     }
 }
Beispiel #16
0
 public function initToolbar()
 {
     if ($this->display == 'view') {
         $order = $this->loadObject();
         $customer = $this->context->customer;
         $this->toolbar_title[] = sprintf($this->l('Order %1$s from %2$s %3$s'), $order->reference, $customer->firstname, $customer->lastname);
         if ($order->hasBeenShipped()) {
             $type = $this->l('Return products');
         } elseif ($order->hasBeenPaid()) {
             $type = $this->l('Standard refund');
         } else {
             $type = $this->l('Cancel products');
         }
         if (!$order->hasBeenShipped() && !$this->lite_display) {
             $this->toolbar_btn['new'] = array('short' => 'Create', 'href' => '#', 'desc' => $this->l('Add a product'), 'class' => 'add_product');
         }
         if (Configuration::get('PS_ORDER_RETURN') && !$this->lite_display) {
             $this->toolbar_btn['standard_refund'] = array('short' => 'Create', 'href' => '', 'desc' => $type, 'class' => 'process-icon-standardRefund');
         }
         if ($order->hasInvoice() && !$this->lite_display) {
             $this->toolbar_btn['partial_refund'] = array('short' => 'Create', 'href' => '', 'desc' => $this->l('Partial refund'), 'class' => 'process-icon-partialRefund');
         }
     }
     $res = parent::initToolbar();
     if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && isset($this->toolbar_btn['new']) && Shop::isFeatureActive()) {
         unset($this->toolbar_btn['new']);
     }
     return $res;
 }
 /**
  * AdminController::initToolbar() override
  * @see AdminController::initToolbar()
  *
  */
 public function initToolbar()
 {
     parent::initToolbar();
     $this->addPageHeaderToolBarModulesListButton();
     if (empty($this->display) && $this->can_import) {
         $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=suppliers', 'desc' => $this->l('Import'));
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
 }
 /**
  * assign default action in toolbar_btn smarty var, if they are not set.
  * uses override to specifically add, modify or remove items
  *
  */
 public function initToolbar()
 {
     switch ($this->display) {
         case 'addstock':
             $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'));
         case 'removestock':
         case 'transferstock':
             $this->toolbar_btn['save'] = array('href' => '#', 'desc' => $this->l('Save'));
             // Default cancel button - like old back link
             $back = Tools::safeOutput(Tools::getValue('back', ''));
             if (empty($back)) {
                 $back = self::$currentIndex . '&token=' . $this->token;
             }
             $this->toolbar_btn['cancel'] = array('href' => $back, 'desc' => $this->l('Cancel'));
             break;
         default:
             parent::initToolbar();
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     if ($this->display == 'edit' || $this->display == 'add') {
         if ($product = $this->loadObject(true)) {
             if ($this->tabAccess['edit']) {
                 $this->toolbar_btn['save'] = array('short' => 'Save', 'href' => '#', 'desc' => $this->l('Save'));
                 $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'));
             }
             if ((bool) $product->id) {
                 // adding button for duplicate this product
                 if ($this->tabAccess['add'] && $this->display != 'add') {
                     $this->toolbar_btn['duplicate'] = array('short' => 'Duplicate', 'desc' => $this->l('Duplicate'), 'confirm' => 1, 'js' => 'if (confirm(\'' . $this->l('Also copy images') . ' ?\')) document.location = \'' . $this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) $product->id . '&duplicateproduct\'; else document.location = \'' . $this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) $product->id . '&duplicateproduct&noimage=1\';');
                 }
                 // adding button for preview this product
                 if ($url_preview = $this->getPreviewUrl($product)) {
                     $this->toolbar_btn['preview'] = array('short' => 'Preview', 'href' => $url_preview, 'desc' => $this->l('Preview'), 'target' => true, 'class' => 'previewUrl');
                 }
                 // adding button for preview this product statistics
                 if (file_exists(_PS_MODULE_DIR_ . 'statsproduct/statsproduct.php') && $this->display != 'add') {
                     $this->toolbar_btn['stats'] = array('short' => 'Statistics', 'href' => $this->context->link->getAdminLink('AdminStats') . '&module=statsproduct&id_product=' . (int) $product->id, 'desc' => $this->l('Product sales'));
                 }
                 // adding button for adding a new combination in Combination tab
                 $this->toolbar_btn['newCombination'] = array('short' => 'New combination', 'desc' => $this->l('New combination'), 'class' => 'toolbar-new');
                 // adding button for delete this product
                 if ($this->tabAccess['delete'] && $this->display != 'add') {
                     $this->toolbar_btn['delete'] = array('short' => 'Delete', 'href' => $this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) $product->id . '&deleteproduct', 'desc' => $this->l('Delete this product.'), 'confirm' => 1, 'js' => 'if (confirm(\'' . $this->l('Delete product?') . '\')){return true;}else{event.preventDefault();}');
                 }
             }
         }
     } else {
         $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=' . $this->table, 'desc' => $this->l('Import'));
     }
     $this->context->smarty->assign('toolbar_scroll', 1);
     $this->context->smarty->assign('show_toolbar', 1);
     $this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
 }
 /**
  * @see AdminController::initToolbar();
  */
 public function initToolbar()
 {
     if (Tools::isSubmit('id_warehouse') && (int) Tools::getValue('id_warehouse') != -1) {
         $this->toolbar_btn['export-stock-mvt-csv'] = array('short' => 'Export this list as CSV', 'href' => $this->context->link->getAdminLink('AdminStockMvt') . '&csv&id_warehouse=' . (int) $this->getCurrentWarehouseId(), 'desc' => $this->l('Export (CSV)'));
     }
     parent::initToolbar();
     unset($this->toolbar_btn['new']);
 }
 /**
  * Function used to render the list to display for this controller
  */
 public function renderList()
 {
     //init and render the first list
     $this->initOrderStatutsList();
     $lists = parent::renderList();
     //init and render the second list
     $this->_filter = false;
     $this->initOrdersReturnsList();
     // call postProcess() to take care of actions and filters
     $this->postProcess();
     $this->toolbar_title = $this->l('Return status');
     $this->checkFilterForOrdersReturnsList();
     parent::initToolbar();
     $lists .= parent::renderList();
     return $lists;
 }
 /**
  * AdminController::initToolbar() override
  * @see AdminController::initToolbar()
  *
  */
 public function initToolbar()
 {
     switch ($this->display) {
         case 'editaddresses':
         case 'addaddress':
             $this->toolbar_btn['save'] = array('href' => '#', 'desc' => $this->l('Save'));
             // Default cancel button - like old back link
             if (!isset($this->no_back) || $this->no_back == false) {
                 $back = Tools::safeOutput(Tools::getValue('back', ''));
                 if (empty($back)) {
                     $back = self::$currentIndex . '&token=' . $this->token;
                 }
                 $this->toolbar_btn['cancel'] = array('href' => $back, 'desc' => $this->l('Cancel'));
             }
             break;
         default:
             parent::initToolbar();
             $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=manufacturers', 'desc' => $this->l('Import'));
     }
 }
 /**
  * Assigns default actions in toolbar_btn smarty var, if they are not set.
  * uses override to specifically add, modify or remove items
  * @see AdminSupplier::initToolbar()
  */
 public function initToolbar()
 {
     switch ($this->display) {
         case 'update_order_state':
             $this->toolbar_btn['save'] = array('href' => '#', 'desc' => $this->l('Save'));
         case 'update_receipt':
             // Default cancel button - like old back link
             if (!isset($this->no_back) || $this->no_back == false) {
                 $back = Tools::safeOutput(Tools::getValue('back', ''));
                 if (empty($back)) {
                     $back = self::$currentIndex . '&token=' . $this->token;
                 }
                 $this->toolbar_btn['cancel'] = array('href' => $back, 'desc' => $this->l('Cancel'));
             }
             break;
         case 'add':
         case 'edit':
             $this->toolbar_btn['save-and-stay'] = array('href' => '#', 'desc' => $this->l('Save and stay'));
         default:
             parent::initToolbar();
     }
 }
 public function initToolbar()
 {
     parent::initToolbar();
     unset($this->toolbar_btn['new']);
 }
Beispiel #26
0
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com 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.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2016 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
$con = new AdminController();
$tab = new Tab((int) Tab::getIdFromClassName(Tools::getValue('controller')));
$con->id = $tab->id;
$con->init();
$con->initToolbar();
$con->initPageHeaderToolbar();
$con->setMedia();
$con->initHeader();
$con->initFooter();
$title = array($tab->getFieldByLang('name'));
Context::getContext()->smarty->assign(array('navigationPipe', Configuration::get('PS_NAVIGATION_PIPE'), 'meta_title' => implode(' ' . Configuration::get('PS_NAVIGATION_PIPE') . ' ', $title), 'display_header' => true, 'display_header_javascript' => true, 'display_footer' => true));
$dir = Context::getContext()->smarty->getTemplateDir(0) . 'controllers' . DIRECTORY_SEPARATOR . trim($con->override_folder, '\\/') . DIRECTORY_SEPARATOR;
$header_tpl = file_exists($dir . 'header.tpl') ? $dir . 'header.tpl' : 'header.tpl';
$tool_tpl = file_exists($dir . 'page_header_toolbar.tpl') ? $dir . 'page_header_toolbar.tpl' : 'page_header_toolbar.tpl';
Context::getContext()->smarty->assign(array('show_page_header_toolbar' => true, 'title' => implode(' ' . Configuration::get('PS_NAVIGATION_PIPE') . ' ', $title), 'toolbar_btn' => array()));
echo Context::getContext()->smarty->fetch($header_tpl);
echo Context::getContext()->smarty->fetch($tool_tpl);
 public function initToolbar()
 {
     parent::initToolbar();
     if ($this->display == 'edit' || $this->display == 'add') {
         $this->toolbar_btn['save'] = array('short' => 'Save', 'href' => '#', 'desc' => $this->l('Save'));
         $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'));
     }
     $this->context->smarty->assign('toolbar_scroll', 1);
     $this->context->smarty->assign('show_toolbar', 1);
     $this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
 }
 /**
  * @see AdminController::initToolbar();
  */
 public function initToolbar()
 {
     if (Tools::isSubmit('id_warehouse') && (int) Tools::getValue('id_warehouse') != -1) {
         $this->toolbar_btn['export-stock-state-quantities-csv'] = array('short' => 'Export this list as CSV', 'href' => $this->context->link->getAdminLink('AdminStockInstantState') . '&csv_quantities&id_warehouse=' . (int) $this->getCurrentCoverageWarehouse(), 'desc' => $this->l('Export Quantities (CSV)'), 'class' => 'process-icon-export');
         $this->toolbar_btn['export-stock-state-prices-csv'] = array('short' => 'Export this list as CSV', 'href' => $this->context->link->getAdminLink('AdminStockInstantState') . '&csv_prices&id_warehouse=' . (int) $this->getCurrentCoverageWarehouse(), 'desc' => $this->l('Export Prices (CSV)'), 'class' => 'process-icon-export');
     }
     parent::initToolbar();
     unset($this->toolbar_btn['new']);
 }
Beispiel #29
0
 public function initToolbar()
 {
     parent::initToolbar();
     $this->toolbar_btn['delete'] = array('short' => 'Erase', 'desc' => $this->l('Erase all'), 'js' => 'if (confirm(\'' . $this->l('Are you sure?') . '\')) document.location = \'' . Tools::safeOutput($this->context->link->getAdminLink('AdminLogs')) . '&amp;token=' . $this->token . '&amp;deletelog=1\';');
     unset($this->toolbar_btn['new']);
 }
Beispiel #30
0
 public function initToolbar()
 {
     parent::initToolbar();
     if ($this->display == 'edit' || $this->display == 'add') {
         $this->toolbar_btn['save'] = array('short' => 'Save', 'href' => '#', 'desc' => $this->l('Save'));
         $this->toolbar_btn['save-and-stay'] = array('short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'));
         // adding button for adding a new combination in Combination tab
         $this->toolbar_btn['newCombination'] = array('short' => 'New combination', 'desc' => $this->l('New combination'), 'class' => 'toolbar-new');
     } else {
         $this->toolbar_btn['import'] = array('href' => $this->context->link->getAdminLink('AdminImport', true) . '&import_type=products', 'desc' => $this->l('Import'));
     }
     $this->context->smarty->assign('toolbar_scroll', 1);
     $this->context->smarty->assign('show_toolbar', 1);
     $this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
 }