/controllers/admin/AdminPaymentController.php
https://gitlab.com/jslee1/PrestaShop · PHP · 126 lines · 86 code · 16 blank · 24 comment · 16 complexity · 455f7b75f162ab5f12da04b25eef4a8a MD5 · raw file
- <?php
- /**
- * 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 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 <contact@prestashop.com>
- * @copyright 2007-2015 PrestaShop SA
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- * International Registered Trademark & Property of PrestaShop SA
- */
- class AdminPaymentControllerCore extends AdminController
- {
- public $payment_modules = array();
- public function __construct()
- {
- $this->bootstrap = true;
- parent::__construct();
- }
- public function initToolbarTitle()
- {
- $this->toolbar_title = array_unique($this->breadcrumbs);
- }
- public function initPageHeaderToolbar()
- {
- parent::initPageHeaderToolbar();
- $this->page_header_toolbar_btn = array();
- }
- public function postProcess()
- {
- if (Tools::getValue('action') == 'GetModuleQuickView' && Tools::getValue('ajax') == '1') {
- $this->ajaxProcessGetModuleQuickView();
- }
- if ($this->action) {
- $this->saveRestrictions($this->action);
- }
- }
- public function initContent()
- {
- $this->display = 'view';
- return parent::initContent();
- }
- public function setMedia()
- {
- parent::setMedia();
- $this->addJqueryPlugin('fancybox');
- }
- public function renderView()
- {
- $this->toolbar_title = $this->l('Payment');
- unset($this->toolbar_btn['back']);
- $shop_context = (!Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP);
- if (!$shop_context) {
- $this->tpl_view_vars = array('shop_context' => $shop_context);
- return parent::renderView();
- }
- $this->tpl_view_vars = array(
- 'modules_list' => $this->renderModulesList('back-office,AdminPayment,index'),
- 'ps_base_uri' => __PS_BASE_URI__,
- 'url_submit' => self::$currentIndex.'&token='.$this->token,
- 'shop_context' => $shop_context
- );
- return parent::renderView();
- }
- public function renderModulesList($tracking_source = false)
- {
- if ($this->getModulesList($this->filter_modules_list, $tracking_source)) {
- $active_list = array();
- foreach ($this->modules_list as $key => $module) {
- if (in_array($module->name, $this->list_partners_modules)) {
- $this->modules_list[$key]->type = 'addonsPartner';
- }
- if (isset($module->description_full) && trim($module->description_full) != '') {
- $module->show_quick_view = true;
- }
- if ($module->active) {
- $active_list[] = $module;
- } else {
- $unactive_list[] = $module;
- }
- }
- $helper = new Helper();
- $fetch = '';
- if (isset($active_list)) {
- $this->context->smarty->assign('panel_title', $this->l('Active payment'));
- $fetch = $helper->renderModulesList($active_list);
- }
- $this->context->smarty->assign(array(
- 'panel_title' => $this->l('Recommended payment gateways'),
- 'view_all' => true
- ));
- $fetch .= $helper->renderModulesList($unactive_list);
- return $fetch;
- }
- }
- }