/**
  * ControllerToolBackup::index()
  * 
  * @see Load
  * @see Document
  * @see Language
  * @see Session
  * @see Response
  * @return void
  */
 public function index()
 {
     $this->document->title = $this->language->get('heading_title');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_select_all'] = $this->language->get('text_select_all');
     $this->data['text_unselect_all'] = $this->language->get('text_unselect_all');
     $this->data['entry_backup'] = $this->language->get('entry_backup');
     $this->data['help_backup'] = $this->language->get('help_backup');
     $this->data['button_backup'] = $this->language->get('button_backup');
     $this->data['tab_general'] = $this->language->get('tab_general');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if ($this->session->has('success')) {
         $this->data['success'] = $this->session->get('success');
         $this->session->clear('success');
     } else {
         $this->data['success'] = '';
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('tool/backup'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['backup'] = Url::createAdminUrl('tool/backup/backup');
     $this->data['tables'] = $this->modelBackup->getTables();
     $this->template = 'tool/backup.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerModuleCatalog2pdfInstall::index()
  * 
  * @return
  */
 public function index()
 {
     if (!$this->user->hasPermission('modify', 'module/catalog2pdf/install')) {
         $this->session->set('error', $this->language->get('error_permission'));
         $this->redirect(Url::createAdminUrl('extension/module'));
     } else {
         /*
           if (file_exists('config.php')) {
               require();
           }
         */
         $this->load->auto('setting/extension');
         $this->load->auto('user/usergroup');
         $this->modelExtension->install('module', 'catalog2pdf');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/catalog2pdf/install');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/catalog2pdf/uninstall');
         $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/catalog2pdf/widget');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/catalog2pdf/widget');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/catalog2pdf/widget');
         $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/catalog2pdf/widget');
         $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/catalog2pdf/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/catalog2pdf/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/catalog2pdf/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/catalog2pdf/plugin');
         $this->redirect(Url::createAdminUrl('extension/module'));
     }
 }
 /**
  * ControllerModuleSocialPlugin::index()
  * 
  * @return
  */
 public function index()
 {
     $this->load->language('module/crm');
     $this->document->title = $this->data['heading_title'] = $this->language->get('heading_title');
     $this->load->auto('setting/setting');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->modelSetting->update('crm', $this->request->post);
         $this->session->set('success', $this->language->get('text_success'));
         if ($_POST['to'] == "saveAndKeep") {
             $this->redirect(Url::createAdminUrl('module/crm/plugin'));
         } else {
             $this->redirect(Url::createAdminUrl('extension/module'));
         }
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('extension/module'), 'text' => $this->language->get('text_module'), 'separator' => ' :: ');
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('module/crm'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->template = 'module/crm/plugin.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 public function index()
 {
     $this->load->language('shipping/flat');
     $this->load->auto('setting/setting');
     $this->load->auto('localisation/geozone');
     $this->load->auto('localisation/taxclass');
     $this->document->title = $this->language->get('heading_title');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->modelSetting->update('flat', $this->request->post);
         $this->session->set('success', $this->language->get('text_success'));
         if ($_POST['to'] == "saveAndKeep") {
             $this->redirect(Url::createAdminUrl('shipping/flat'));
         } else {
             $this->redirect(Url::createAdminUrl('extension/shipping'));
         }
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('extension/shipping'), 'text' => $this->language->get('text_shipping'), 'separator' => ' :: ');
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('shipping/flat'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['action'] = Url::createAdminUrl('shipping/flat');
     $this->data['cancel'] = Url::createAdminUrl('extension/shipping');
     if (isset($this->request->post['flat_cost'])) {
         $this->data['flat_cost'] = $this->request->post['flat_cost'];
     } else {
         $this->data['flat_cost'] = $this->config->get('flat_cost');
     }
     if (isset($this->request->post['flat_tax_class_id'])) {
         $this->data['flat_tax_class_id'] = $this->request->post['flat_tax_class_id'];
     } else {
         $this->data['flat_tax_class_id'] = $this->config->get('flat_tax_class_id');
     }
     if (isset($this->request->post['flat_geo_zone_id'])) {
         $this->data['flat_geo_zone_id'] = $this->request->post['flat_geo_zone_id'];
     } else {
         $this->data['flat_geo_zone_id'] = $this->config->get('flat_geo_zone_id');
     }
     if (isset($this->request->post['flat_status'])) {
         $this->data['flat_status'] = $this->request->post['flat_status'];
     } else {
         $this->data['flat_status'] = $this->config->get('flat_status');
     }
     if (isset($this->request->post['flat_sort_order'])) {
         $this->data['flat_sort_order'] = $this->request->post['flat_sort_order'];
     } else {
         $this->data['flat_sort_order'] = $this->config->get('flat_sort_order');
     }
     $this->data['tax_classes'] = $this->modelTaxclass->getAll();
     $this->data['geo_zones'] = $this->modelGeozone->getAll();
     $this->template = 'shipping/flat.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerSettingCache::index()
  * 
  * @return
  */
 public function index()
 {
     $this->load->library('url');
     $res = $this->rrmdir(DIR_CACHE);
     $this->load->model('store/store');
     $stores = $this->modelStore->getAll();
     $this->session->clear('ntConfig_0');
     foreach ($stores as $store) {
         $this->session->clear('ntConfig_' . (int) $store['store_id']);
     }
     $this->session->clear('language');
     $this->session->clear('fkey');
     if ($res) {
         $this->session->set('success', 'Se han eliminado todos los archivos del cache con éxito');
     } else {
         $this->session->set('error', 'Error: No se pudieron eliminar los archivos del cache');
     }
     if ($_SERVER['HTTP_REFERER']) {
         $this->redirect($_SERVER['HTTP_REFERER']);
     } elseif ($this->session->has('redirect')) {
         $this->redirect($this->session->get('redirect'));
         $this->session->clear('redirect');
     } else {
         $this->redirect(Url::createAdminUrl('common/home'));
     }
 }
 public function index()
 {
     $this->load->auto("setting/extension");
     $extensions = $this->modelExtension->getInstalled('module');
     $this->data['extensions'] = array();
     $files = glob(DIR_APPLICATION . 'controller/module/*.php');
     if ($files) {
         foreach ($files as $file) {
             $extension = basename($file, '.php');
             $this->load->language('module/' . $extension);
             $action = array();
             if (!in_array($extension, $extensions)) {
                 $action[] = array('action' => 'install', 'img' => 'install.png', 'text' => $this->language->get('text_install'), 'href' => Url::createAdminUrl('extension/module/install') . '&extension=' . $extension);
             } else {
                 $action[] = array('action' => 'edit', 'img' => 'edit.png', 'text' => $this->language->get('text_edit'), 'href' => Url::createAdminUrl('module/' . $extension . ''));
                 $action[] = array('action' => 'install', 'img' => 'uninstall.png', 'text' => $this->language->get('text_uninstall'), 'href' => Url::createAdminUrl('extension/module/uninstall') . '&extension=' . $extension);
             }
             $postion = $pos = $this->config->get($extension . '_position');
             if ($postion) {
                 $postion = $this->language->get('text_' . $postion);
             } else {
                 $postion = "";
             }
             $this->data['extensions'][] = array('extension' => $extension, 'name' => $this->language->get('heading_title'), 'pos' => $pos, 'position' => $postion, 'status' => $this->config->get($extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'), 'sort_order' => $this->config->get($extension . '_sort_order'), 'action' => $action);
         }
     }
     $this->template = 'style/layouts.tpl';
     $this->children[] = 'common/header2';
     $this->children[] = 'common/footer2';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 public function index()
 {
     $this->user->registerActivity($this->user->getId(), 'user', 'Cierre de sesión', 'logout');
     $this->user->logout();
     $this->session->clear('token');
     $this->redirect(Url::createAdminUrl('common/login'));
 }
 public function clear()
 {
     $this->load->language('tool/error_log');
     $file = DIR_LOGS . $this->config->get('config_error_filename');
     $handle = fopen($file, 'w+');
     fclose($handle);
     $this->session->set('success', $this->language->get('text_success'));
     $this->redirect(Url::createAdminUrl('tool/error_log'));
 }
 public function index()
 {
     $this->load->language('total/tax');
     $this->document->title = $this->language->get('heading_title');
     $this->load->auto('setting/setting');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->modelSetting->update('tax', $this->request->post);
         $this->session->set('success', $this->language->get('text_success'));
         if ($_POST['to'] == "saveAndKeep") {
             $this->redirect(Url::createAdminUrl('total/tax'));
         } else {
             $this->redirect(Url::createAdminUrl('extension/total'));
         }
     }
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_enabled'] = $this->language->get('text_enabled');
     $this->data['text_disabled'] = $this->language->get('text_disabled');
     $this->data['entry_status'] = $this->language->get('entry_status');
     $this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
     $this->data['button_save'] = $this->language->get('button_save');
     $this->data['button_save_and_keep'] = $this->language->get('button_save_and_keep');
     $this->data['button_save_and_exit'] = $this->language->get('button_save_and_exit');
     $this->data['button_cancel'] = $this->language->get('button_cancel');
     $this->data['tab_general'] = $this->language->get('tab_general');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('extension/total'), 'text' => $this->language->get('text_total'), 'separator' => ' :: ');
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('total/tax'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['action'] = Url::createAdminUrl('total/tax');
     $this->data['cancel'] = Url::createAdminUrl('extension/total');
     if (isset($this->request->post['tax_status'])) {
         $this->data['tax_status'] = $this->request->post['tax_status'];
     } else {
         $this->data['tax_status'] = $this->config->get('tax_status');
     }
     if (isset($this->request->post['tax_sort_order'])) {
         $this->data['tax_sort_order'] = $this->request->post['tax_sort_order'];
     } else {
         $this->data['tax_sort_order'] = $this->config->get('tax_sort_order');
     }
     $this->data['Url'] = new Url();
     $scripts[] = array('id' => 'scriptForm', 'method' => 'ready', 'script' => "\$('#form').ntForm({\r\n                submitButton:false,\r\n                cancelButton:false,\r\n                lockButton:false\r\n            });\r\n            \$('textarea').ntTextArea();\r\n            \r\n            var form_clean = \$('#form').serialize();  \r\n            \r\n            window.onbeforeunload = function (e) {\r\n                var form_dirty = \$('#form').serialize();\r\n                if(form_clean != form_dirty) {\r\n                    return 'There is unsaved form data.';\r\n                }\r\n            };\r\n            \r\n            \$('.sidebar .tab').on('click',function(){\r\n                \$(this).closest('.sidebar').addClass('show').removeClass('hide').animate({'right':'0px'});\r\n            });\r\n            \$('.sidebar').mouseenter(function(){\r\n                clearTimeout(\$(this).data('timeoutId'));\r\n            }).mouseleave(function(){\r\n                var e = this;\r\n                var timeoutId = setTimeout(function(){\r\n                    if (\$(e).hasClass('show')) {\r\n                        \$(e).removeClass('show').addClass('hide').animate({'right':'-400px'});\r\n                    }\r\n                }, 600);\r\n                \$(this).data('timeoutId', timeoutId); \r\n            });");
     $scripts[] = array('id' => 'scriptFunctions', 'method' => 'function', 'script' => "function saveAndExit() { \r\n                window.onbeforeunload = null;\r\n                \$('#form').append(\"<input type='hidden' name='to' value='saveAndExit'>\").submit(); \r\n            }\r\n            \r\n            function saveAndKeep() { \r\n                window.onbeforeunload = null;\r\n                \$('#form').append(\"<input type='hidden' name='to' value='saveAndKeep'>\").submit(); \r\n            }");
     $this->scripts = array_merge($this->scripts, $scripts);
     $this->template = 'total/tax.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerModuleSocialPlugin::index()
  * 
  * @return
  */
 public function index()
 {
     $this->load->language('module/social');
     $this->document->title = $this->data['heading_title'] = $this->language->get('heading_title');
     $this->load->auto('setting/setting');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->modelSetting->update('social', $this->request->post);
         $this->session->set('success', $this->language->get('text_success'));
         if ($_POST['to'] == "saveAndKeep") {
             $this->redirect(Url::createAdminUrl('module/social/plugin'));
         } else {
             $this->redirect(Url::createAdminUrl('extension/module'));
         }
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('extension/module'), 'text' => $this->language->get('text_module'), 'separator' => ' :: ');
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('module/social'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['action'] = Url::createAdminUrl('module/social');
     $this->data['cancel'] = Url::createAdminUrl('extension/module');
     $this->data['social_facebook_app_id'] = isset($this->request->post['social_facebook_app_id']) ? $this->request->post['social_facebook_app_id'] : $this->config->get('social_facebook_app_id');
     $this->data['social_facebook_app_secret'] = isset($this->request->post['social_facebook_app_secret']) ? $this->request->post['social_facebook_app_secret'] : $this->config->get('social_facebook_app_secret');
     $this->data['social_meli_app_id'] = isset($this->request->post['social_meli_app_id']) ? $this->request->post['social_meli_app_id'] : $this->config->get('social_meli_app_id');
     $this->data['social_meli_app_secret'] = isset($this->request->post['social_meli_app_secret']) ? $this->request->post['social_meli_app_secret'] : $this->config->get('social_meli_app_secret');
     $this->data['social_paypal_app_id'] = isset($this->request->post['social_paypal_app_id']) ? $this->request->post['social_paypal_app_id'] : $this->config->get('social_paypal_app_id');
     $this->data['social_paypal_app_secret'] = isset($this->request->post['social_paypal_app_secret']) ? $this->request->post['social_paypal_app_secret'] : $this->config->get('social_paypal_app_secret');
     $this->data['social_twitter_consumer_key'] = isset($this->request->post['social_twitter_consumer_key']) ? $this->request->post['social_twitter_consumer_key'] : $this->config->get('social_twitter_consumer_key');
     $this->data['social_twitter_consumer_secret'] = isset($this->request->post['social_twitter_consumer_secret']) ? $this->request->post['social_twitter_consumer_secret'] : $this->config->get('social_twitter_consumer_secret');
     $this->data['social_twitter_oauth_token'] = isset($this->request->post['social_twitter_oauth_token']) ? $this->request->post['social_twitter_oauth_token'] : $this->config->get('social_twitter_oauth_token');
     $this->data['social_twitter_oauth_token_secret'] = isset($this->request->post['social_twitter_oauth_token_secret']) ? $this->request->post['social_twitter_oauth_token_secret'] : $this->config->get('social_twitter_oauth_token_secret');
     $this->data['social_twitter_consumer_secret'] = isset($this->request->post['social_twitter_consumer_secret']) ? $this->request->post['social_twitter_consumer_secret'] : $this->config->get('social_twitter_consumer_secret');
     $this->data['social_google_client_id'] = isset($this->request->post['social_google_client_id']) ? $this->request->post['social_google_client_id'] : $this->config->get('social_google_client_id');
     $this->data['social_google_client_secret'] = isset($this->request->post['social_google_client_secret']) ? $this->request->post['social_google_client_secret'] : $this->config->get('social_google_client_secret');
     $this->data['social_google_api_key'] = isset($this->request->post['social_google_api_key']) ? $this->request->post['social_google_api_key'] : $this->config->get('social_google_api_key');
     $this->data['social_google_consumer_key'] = isset($this->request->post['social_google_consumer_key']) ? $this->request->post['social_google_consumer_key'] : $this->config->get('social_google_consumer_key');
     $this->data['social_google_consumer_secret'] = isset($this->request->post['social_google_consumer_secret']) ? $this->request->post['social_google_consumer_secret'] : $this->config->get('social_google_consumer_secret');
     $this->data['social_live_client_id'] = isset($this->request->post['social_live_client_id']) ? $this->request->post['social_live_client_id'] : $this->config->get('social_live_client_id');
     $this->data['social_live_client_secret'] = isset($this->request->post['social_live_client_secret']) ? $this->request->post['social_live_client_secret'] : $this->config->get('social_live_client_secret');
     $scripts[] = array('id' => 'socialScripts', 'method' => 'ready', 'script' => "\$('.vtabs_page').hide();\r\n            \$('#tab_facebook').show();");
     $scripts[] = array('id' => 'socialFunctions', 'method' => 'function', 'script' => "function showTab(a) {\r\n                \$('.vtabs_page').hide();\r\n                \$(\$(a).data('target')).show();\r\n            }");
     $this->scripts = array_merge($this->scripts, $scripts);
     $this->template = 'module/social/plugin.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 public function index()
 {
     $this->load->language('payment/pp_standard');
     $this->document->title = $this->language->get('heading_title');
     $this->load->model('setting/setting');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->modelSetting->update('pp_standard', $this->request->post);
         $this->session->data['success'] = $this->language->get('text_success');
         if ($_POST['to'] == "saveAndKeep") {
             $this->redirect(Url::createAdminUrl('payment/pp_standard'));
         } else {
             $this->redirect(Url::createAdminUrl('extension/payment'));
         }
     }
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     $this->data['error_email'] = isset($this->error['email']) ? $this->error['email'] : '';
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => HTTP_HOME . 'index.php?r=common/home&token=' . $this->session->data['token'], 'text' => $this->language->get('text_home'), 'separator' => FALSE);
     $this->document->breadcrumbs[] = array('href' => HTTP_HOME . 'index.php?r=extension/payment&token=' . $this->session->data['token'], 'text' => $this->language->get('text_payment'), 'separator' => ' :: ');
     $this->document->breadcrumbs[] = array('href' => HTTP_HOME . 'index.php?r=payment/pp_standard&token=' . $this->session->data['token'], 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['action'] = HTTP_HOME . 'index.php?r=payment/pp_standard&token=' . $this->session->data['token'];
     $this->data['cancel'] = HTTP_HOME . 'index.php?r=extension/payment&token=' . $this->session->data['token'];
     $this->setvar('pp_standard_image');
     $this->setvar('pp_standard_order_status_id');
     $this->setvar('pp_standard_newsletter_id');
     $this->setvar('pp_standard_email');
     $this->setvar('pp_standard_test');
     $this->setvar('pp_standard_transaction');
     $this->setvar('pp_standard_app_id');
     $this->setvar('pp_standard_app _secret');
     $this->setvar('pp_standard_geo_zone_id');
     $this->setvar('pp_standard_status');
     $this->setvar('pp_standard_sort_order');
     if ($this->data['pp_standard_image'] && file_exists(DIR_IMAGE . $this->data['pp_standard_image'])) {
         $this->data['preview'] = NTImage::resizeAndSave($this->data['pp_standard_image'], 100, 100);
     } else {
         $this->data['preview'] = NTImage::resizeAndSave('no_image.jpg', 100, 100);
     }
     $this->load->model('localisation/orderstatus');
     $this->data['order_statuses'] = $this->modelOrderstatus->getAll();
     $this->load->model('localisation/geozone');
     $this->data['geo_zones'] = $this->modelGeozone->getAll();
     $this->load->model('marketing/newsletter');
     $this->data['newsletters'] = $this->modelNewsletter->getAll();
     $scripts[] = array('id' => 'categoryFunctions', 'method' => 'function', 'script' => "function image_delete(field, preview) {\r\n                \$('#' + field).val('');\r\n                \$('#' + preview).attr('src','" . HTTP_IMAGE . "cache/no_image-100x100.jpg');\r\n            }\r\n            \r\n            function image_upload(field, preview) {\r\n                var height = \$(window).height() * 0.8;\r\n                var width = \$(window).width() * 0.8;\r\n                \r\n            \t\$('#dialog').remove();\r\n            \t\$('.box').prepend('<div id=\"dialog\" style=\"padding: 3px 0px 0px 0px;z-index:10000;\"><iframe src=\"" . Url::createAdminUrl("common/filemanager") . "&field=' + encodeURIComponent(field) + '\" style=\"padding:0; margin: 0; display: block; width: 100%; height: 100%;z-index:10000;\" frameborder=\"no\" scrolling=\"auto\"></iframe></div>');\r\n                \r\n                \$('#dialog').dialog({\r\n            \t\ttitle: '" . $this->data['text_image_manager'] . "',\r\n            \t\tclose: function (event, ui) {\r\n            \t\t\tif (\$('#' + field).attr('value')) {\r\n            \t\t\t\t\$.ajax({\r\n            \t\t\t\t\turl: '" . Url::createAdminUrl("common/filemanager/image") . "',\r\n            \t\t\t\t\ttype: 'POST',\r\n            \t\t\t\t\tdata: 'image=' + encodeURIComponent(\$('#' + field).val()),\r\n            \t\t\t\t\tdataType: 'text',\r\n            \t\t\t\t\tsuccess: function(data) {\r\n            \t\t\t\t\t\t\$('#' + preview).replaceWith('<img src=\"' + data + '\" id=\"' + preview + '\" class=\"image\" onclick=\"image_upload(\\'' + field + '\\', \\'' + preview + '\\');\">');\r\n            \t\t\t\t\t}\r\n            \t\t\t\t});\r\n            \t\t\t}\r\n            \t\t},\t\r\n            \t\tbgiframe: false,\r\n            \t\twidth: width,\r\n            \t\theight: height,\r\n            \t\tresizable: false,\r\n            \t\tmodal: false\r\n            \t});}");
     $this->scripts = array_merge($this->scripts, $scripts);
     $this->template = 'payment/pp_standard.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
 }
 /**
  * ControllerModuleManufacturerUninstall::index()
  * 
  * @return
  */
 public function index()
 {
     if (!$this->user->hasPermission('modify', 'module/manufacturer/uninstall')) {
         $this->session->set('error', $this->language->get('error_permission'));
         $this->redirect(Url::createAdminUrl('extension/module'));
     } else {
         $this->load->auto('setting/extension');
         $this->load->auto('setting/setting');
         $this->load->auto('style/widget');
         $this->modelExtension->uninstall('module', 'manufacturer');
         $this->modelSetting->delete('manufacturer');
         $this->modelWidget->deleteAll('manufacturer');
         $this->redirect(Url::createAdminUrl('extension/module'));
     }
 }
 public function index()
 {
     $this->load->language('error/permission');
     $this->document->title = $this->language->get('heading_title');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_permission'] = $this->language->get('text_permission');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('error/permission'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->template = 'error/permission.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 public function index()
 {
     $this->document->title = $this->language->get('heading_title');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->modelSetting->update('marketing', $this->request->post);
         $this->session->set('success', $this->language->get('text_success'));
     }
     if ($this->session->has('success')) {
         $this->data['success'] = $this->session->get('success');
         $this->session->clear('success');
     } else {
         $this->data['success'] = '';
     }
     $this->data['newsletters'] = $this->modelNewsletter->getAll();
     $this->data['pages'] = $this->modelPage->getAll();
     $this->setvar('marketing_page_contact_id');
     $this->setvar('marketing_email_new_customer');
     $this->setvar('marketing_email_activate_customer');
     $this->setvar('marketing_email_new_order');
     $this->setvar('marketing_email_order_pdf');
     $this->setvar('marketing_email_new_comment');
     $this->setvar('marketing_email_new_reply');
     $this->setvar('marketing_email_old_order');
     $this->setvar('marketing_email_new_payment');
     $this->setvar('marketing_email_update_order');
     $this->setvar('marketing_email_new_contact');
     $this->setvar('marketing_email_add_balance');
     $this->setvar('marketing_email_subtract_balance');
     $this->setvar('marketing_email_happy_birthday');
     $this->setvar('marketing_email_recommended_products');
     $this->setvar('marketing_email_promote_product');
     $this->setvar('marketing_email_invite_friends');
     $this->setvar('marketing_page_new_customer');
     $this->setvar('marketing_page_activate_customer');
     $this->setvar('marketing_page_add_to_cart');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('marketing/message'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->document->title = $this->data['heading_title'] = $this->language->get('heading_title');
     $this->template = 'marketing/message.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('marketing_compression'));
 }
 private function modules()
 {
     $this->data['extensions'] = array();
     $extensions = $this->modelExtension->getInstalled('module');
     $files = glob(DIR_APPLICATION . 'controller/module/*.php');
     if ($files) {
         foreach ($files as $file) {
             $extension = basename($file, '.php');
             $this->load->language('module/' . $extension);
             $action = array();
             if (in_array($extension, $extensions)) {
                 $action[] = array('action' => 'edit', 'img' => 'edit.png', 'text' => $this->language->get('text_edit'), 'href' => Url::createAdminUrl('module/' . $extension . ''));
                 $action[] = array('action' => 'install', 'img' => 'uninstall.png', 'text' => $this->language->get('text_uninstall'), 'href' => Url::createAdminUrl('extension/module/uninstall') . '&extension=' . $extension);
             }
             $this->data['extensions'][] = array('extension' => $extension, 'name' => $this->language->get('heading_title'), 'desc' => $this->language->get('overview'), 'action' => $action);
         }
     }
 }
 /**
  * ControllerToolRestore::index()
  * 
  * @see Load
  * @see Document
  * @see Response
  * @see Session
  * @see Request
  * @see Language
  * @return void 
  */
 public function index()
 {
     $this->document->title = $this->language->get('heading_title');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         if (is_uploaded_file($this->request->files['import']['tmp_name'])) {
             $content = file_get_contents($this->request->files['import']['tmp_name']);
         } else {
             $content = false;
         }
         if ($content) {
             $this->modelBackup->restore($content);
             $this->session->set('success', $this->language->get('text_success'));
             $this->redirect(Url::createAdminUrl('tool/restore'));
         } else {
             $this->error['warning'] = $this->language->get('error_empty');
         }
     }
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['entry_restore'] = $this->language->get('entry_restore');
     $this->data['help_restore'] = $this->language->get('help_restore');
     $this->data['button_restore'] = $this->language->get('button_restore');
     $this->data['tab_general'] = $this->language->get('tab_general');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if ($this->session->has('success')) {
         $this->data['success'] = $this->session->get('success');
         $this->session->clear('success');
     } else {
         $this->data['success'] = '';
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('tool/restore'), 'text' => 'Restaurar', 'separator' => ' :: ');
     $this->data['restore'] = Url::createAdminUrl('tool/restore');
     $this->template = 'tool/restore.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerModuleCrmInstall::index()
  * 
  * @return
  */
 public function index()
 {
     if (!$this->user->hasPermission('modify', 'module/crm/install')) {
         $this->session->set('error', $this->language->get('error_permission'));
         $this->redirect(Url::createAdminUrl('extension/module'));
     } else {
         $this->load->auto('setting/extension');
         $this->load->auto('user/usergroup');
         $this->modelExtension->install('module', 'crm');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/install');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/install');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/uninstall');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/uninstall');
         /*
          $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/crm/widget');
          $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/widget');
          $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/widget');
          $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/crm/widget');
         */
         $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/crm/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/crm/plugin');
         $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/crm/opportunity');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/opportunity');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/opportunity');
         $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/crm/opportunity');
         $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/crm/step/otracosa');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/step');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/step');
         $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/crm/step');
         $this->modelUsergroup->addPermission($this->user->getId(), 'create', 'module/crm/status');
         $this->modelUsergroup->addPermission($this->user->getId(), 'access', 'module/crm/status');
         $this->modelUsergroup->addPermission($this->user->getId(), 'modify', 'module/crm/status');
         $this->modelUsergroup->addPermission($this->user->getId(), 'delete', 'module/crm/status');
         //TODO: add menu links to the admin menu
         /*
          * $this->modelSetting->set('admin-menu', 'parent-crm', 'CRM Ventas');
          */
         $this->redirect(Url::createAdminUrl('extension/module'));
     }
 }
 public function index()
 {
     $this->document->title = $this->language->get('heading_title');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->data['token'] = $this->session->get('ukey');
     $this->data['total_sale'] = $this->currency->format($this->modelOrder->getTotalSales(), $this->config->get('config_currency'));
     $this->data['total_sale_year'] = $this->currency->format($this->modelOrder->getTotalSalesByYear(date('Y')), $this->config->get('config_currency'));
     $this->data['total_order'] = $this->modelOrder->getAllTotal();
     $this->data['total_customer'] = $this->modelCustomer->getAllTotal();
     $this->data['total_customer_approval'] = $this->modelCustomer->getAllTotalAwaitingApproval();
     $this->data['total_product'] = $this->modelProduct->getAllTotal();
     $this->data['total_review'] = $this->modelReview->getAllTotal();
     $this->data['total_review_approval'] = $this->modelReview->getAllTotalAwaitingApproval();
     $this->data['orders'] = array();
     $data = array('sort' => 'o.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => 10);
     $results = $this->modelOrder->getAll($data);
     foreach ($results as $result) {
         $action = array();
         $action[] = array('text' => $this->language->get('text_edit'), 'href' => Url::createAdminUrl('sale/order/update', array('order_id' => $result['order_id'])));
         $this->data['orders'][] = array('order_id' => $result['order_id'], 'name' => $result['name'], 'status' => $result['status'], 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'total' => $this->currency->format($result['total'], $result['currency'], $result['value']), 'action' => $action);
     }
     if ($this->config->get('config_currency_auto')) {
         $this->load->auto('localisation/currency');
         $this->modelCurrency->updateAll();
     }
     /*
            $this->load->library('update');
            $update = new Update($this->registry);
            $this->data['msg'] = $update->checkForUpdates();
     * 
     */
     $this->loadAssets();
     // javascript files
     $javascripts['highcharts'] = "js/vendor/highcharts-4.0.1/highcharts.js";
     $this->javascripts = array_merge($javascripts, $this->javascripts);
     $this->template = 'common/home.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerCommonHeader::index()
  * 
  * @return
  */
 protected function index()
 {
     if ($this->request->hasQuery('hl')) {
         $this->session->set('language', $this->request->getQuery('hl'));
         if ($this->session->has('redirect')) {
             $this->redirect($this->session->get('redirect'));
         } else {
             $this->redirect(Url::createAdminUrl('common/home'));
         }
     }
     $this->load->language('common/header');
     $this->data['title'] = $this->document->title . " | NecoTienda";
     $this->data['breadcrumbs'] = $this->document->breadcrumbs;
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->load->library('browser');
     $browser = new Browser();
     if ($browser->getBrowser() == 'Internet Explorer' && $browser->getVersion() <= 8) {
         $this->redirect(Url::createUrl("page/deprecated", null, 'NONSSL', HTTP_CATALOG));
     }
     if (!$this->user->validSession()) {
         $this->data['logged'] = '';
         $this->data['home'] = Url::createAdminUrl('common/login');
     } else {
         $this->data['logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
         if ($this->session->has('success')) {
             $this->data['success'] = $this->session->get('success');
             $this->session->clear('success');
         }
         if ($this->session->has('error')) {
             $this->data['error'] = $this->session->get('error');
             $this->session->clear('error');
         }
         $this->load->auto("setting/store");
         $this->data['stores'] = $this->modelStore->getAll();
     }
     $this->loadCss();
     $this->id = 'header';
     $this->template = 'common/header.tpl';
     $this->render();
 }
 /**
  * ControllerToolUpdate::index()
  * 
  * @see Load
  * @see Document
  * @see Language
  * @see Session
  * @see Response
  * @return void
  */
 public function index()
 {
     $this->language->load('tool/update');
     $this->document->title = $this->language->get('heading_title');
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->load->library('backup');
     $this->load->library('update');
     $this->load->model('setting/setting');
     $update = new Update($this->registry);
     $this->data['update_info'] = $update->getInfo();
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         $this->modelSetting->editMaintenance(1);
         $backup = new Backup($this->registry);
         //TODO: respaldar solamente los archivos y las tablas que se van a actualizar
         //$backup->run();
         $result = $update->run();
         if (is_null($result)) {
             //actualizado
         } else {
             if (isset($result['requirements_error'])) {
                 unset($result['requirements_error']);
                 $this->data['error'] = '<ul><li>' . implode('</li><li>', $result) . '</ul>';
             }
             //error, no se actualizo
         }
         $this->modelSetting->editMaintenance(0);
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('tool/update') . $url, 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['action'] = Url::createAdminUrl('tool/update') . $url;
     $this->template = 'tool/update.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 private function getForm()
 {
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     $this->data['error_username'] = isset($this->error['username']) ? $this->error['username'] : '';
     $this->data['error_password'] = isset($this->error['password']) ? $this->error['password'] : '';
     $this->data['error_confirm'] = isset($this->error['confirm']) ? $this->error['confirm'] : '';
     $this->data['error_firstname'] = isset($this->error['firstname']) ? $this->error['firstname'] : '';
     $this->data['error_email'] = isset($this->error['email']) ? $this->error['email'] : '';
     $this->data['error_lastname'] = isset($this->error['lastname']) ? $this->error['lastname'] : '';
     $url = '';
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('user/user') . $url, 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     if (!isset($this->request->get['user_id'])) {
         $this->data['action'] = Url::createAdminUrl('user/user/insert') . $url;
     } else {
         $this->data['action'] = Url::createAdminUrl('user/user/update') . '&user_id=' . $this->request->get['user_id'] . $url;
     }
     $this->data['cancel'] = Url::createAdminUrl('user/user') . $url;
     if (isset($this->request->get['user_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $user_info = $this->modelUser->getById($this->request->get['user_id']);
     }
     $this->setvar('username', $user_info, '');
     $this->setvar('firstname', $user_info, '');
     $this->setvar('lastname', $user_info, '');
     $this->setvar('email', $user_info, '');
     $this->setvar('user_group_id', $user_info, '');
     $this->setvar('status', $user_info, 0);
     $this->data['user_groups'] = $this->modelUsergroup->getAll();
     $this->template = 'user/user_form.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 private function getForm()
 {
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     $this->data['error_title'] = isset($this->error['title']) ? $this->error['title'] : '';
     $this->data['error_code'] = isset($this->error['code']) ? $this->error['code'] : '';
     $this->data['error_value'] = isset($this->error['value']) ? $this->error['value'] : '';
     $url = '';
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('localisation/currency') . $url, 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     if (!isset($this->request->get['currency_id'])) {
         $this->data['action'] = Url::createAdminUrl('localisation/currency/insert') . $url;
     } else {
         $this->data['action'] = Url::createAdminUrl('localisation/currency/update') . '&currency_id=' . $this->request->get['currency_id'] . $url;
     }
     $this->data['cancel'] = Url::createAdminUrl('localisation/currency') . $url;
     if (isset($this->request->get['currency_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $currency_info = $this->modelCurrency->getById($this->request->get['currency_id']);
     }
     $this->setvar('title', $currency_info, '');
     $this->setvar('code', $currency_info, '');
     $this->setvar('symbol_left', $currency_info, '');
     $this->setvar('symbol_right', $currency_info, '');
     $this->setvar('decimal_place', $currency_info, '');
     $this->setvar('value', $currency_info, '');
     $this->setvar('status', $currency_info, 1);
     $this->template = 'localisation/currency_form.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
 }
 public function send()
 {
     $htmlbody = html_entity_decode($this->cache->get("campaign.html.temp"));
     $htmlbody = str_replace('%7B', '{', $htmlbody);
     $htmlbody = str_replace('%7D', '}', $htmlbody);
     $data = unserialize($this->cache->get("campaign.data.temp"));
     $to = $data['to'];
     $campaign = $data['post'];
     $links = $data['links'];
     $campaign['contacts'] = $to;
     $campaign_id = $this->modelCampaign->add($campaign);
     $this->modelCampaign->setProperty($campaign_id, 'mail_server', 'mail_server_id', $campaign['mail_server_id']);
     $params = array('job' => 'send_campaign', 'campaign_id' => $campaign_id);
     $this->load->library('task');
     $task = new Task($this->registry);
     $task->object_id = (int) $campaign_id;
     $task->object_type = 'campaign';
     $task->task = $campaign['name'];
     $task->type = 'send';
     $task->time_exec = date('Y-m-d H:i:s', strtotime($campaign['date_start']));
     $task->params = $params;
     $task->time_interval = $campaign['repeat'];
     $task->time_last_exec = $row['time_last_exec'];
     $task->run_once = !(bool) $campaign['repeat'];
     $task->status = 1;
     $task->date_start_exec = date('Y-m-d H:i:s', strtotime($campaign['date_start']));
     $task->date_end_exec = date('Y-m-d H:i:s', strtotime($campaign['date_end']));
     foreach ($to as $sort_order => $contact) {
         foreach ($links as $link) {
             if (empty($link['url']) || empty($link['redirect'])) {
                 continue;
             }
             $link['url'] = str_replace('%7B', '{', $link['url']);
             $link['url'] = str_replace('%7D', '}', $link['url']);
             $link['url'] = str_replace('{%contact_id%}', $contact['contact_id'], $link['url']);
             $link['url'] = str_replace('{%campaign_id%}', $campaign_id, $link['url']);
             $this->modelCampaign->addLink($link, $campaign_id);
         }
         $params = array('contact_id' => $contact['contact_id'], 'name' => $contact['name'], 'email' => $contact['email'], 'campaign_id' => $campaign_id);
         $queue = array("params" => $params, "status" => 1, "time_exec" => date('Y-m-d H:i:s', strtotime($campaign['date_start'])));
         $htmlbody = str_replace('{%contact_id%}', $contact['contact_id'], $htmlbody);
         $htmlbody = str_replace('{%campaign_id%}', $campaign_id, $htmlbody);
         $this->cache->set("campaign.html.{$campaign_id}." . $contact['contact_id'], $htmlbody);
         $task->addQueue($queue);
     }
     $task->createSendTask();
     $this->cache->set("campaign.html.{$campaign_id}", $htmlbody);
     $this->session->set('success', $this->language->get('text_success'));
     $this->redirect(Url::createAdminUrl("marketing/campaign"));
 }
 public function grid()
 {
     $filter_name = isset($this->request->get['filter_name']) ? $this->request->get['filter_name'] : null;
     $filter_group = isset($this->request->get['filter_group']) ? $this->request->get['filter_group'] : null;
     $filter_date_start = isset($this->request->get['filter_date_start']) ? $this->request->get['filter_date_start'] : null;
     $filter_date_end = isset($this->request->get['filter_date_end']) ? $this->request->get['filter_date_end'] : null;
     $page = isset($this->request->get['page']) ? $this->request->get['page'] : 1;
     $sort = isset($this->request->get['sort']) ? $this->request->get['sort'] : 'firstname';
     $order = isset($this->request->get['order']) ? $this->request->get['order'] : 'ASC';
     $limit = !empty($this->request->get['limit']) ? $this->request->get['limit'] : $this->config->get('config_admin_limit');
     $url = '';
     if (isset($this->request->get['filter_name'])) {
         $url .= '&filter_name=' . $this->request->get['filter_name'];
     }
     if (isset($this->request->get['filter_group'])) {
         $url .= '&filter_group=' . $this->request->get['filter_group'];
     }
     if (isset($this->request->get['filter_date_start'])) {
         $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
     }
     if (isset($this->request->get['filter_date_end'])) {
         $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (!empty($this->request->get['limit'])) {
         $url .= '&limit=' . $this->request->get['limit'];
     }
     $this->data['customers'] = array();
     $data = array('filter_name' => $filter_name, 'filter_group' => $filter_group, 'filter_date_start' => $filter_date_start, 'filter_date_end' => $filter_date_end, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit);
     $customer_total = $this->modelCustomer->getTotalCumpleaneros();
     $results = $this->modelCustomer->getCumpleaneros($data);
     foreach ($results as $result) {
         $this->data['customers'][] = array('customer_id' => $result['customer_id'], 'name' => $result['name'], 'email' => $result['email'], 'telephone' => $result['telephone'], 'facebook' => $result['facebook'], 'twitter' => $result['twitter']);
     }
     $this->data['text_enabled'] = $this->language->get('text_enabled');
     $this->data['text_disabled'] = $this->language->get('text_disabled');
     $this->data['text_yes'] = $this->language->get('text_yes');
     $this->data['text_no'] = $this->language->get('text_no');
     $this->data['text_no_results'] = $this->language->get('text_no_results');
     $this->data['column_name'] = $this->language->get('column_name');
     $this->data['column_email'] = $this->language->get('column_email');
     $this->data['column_telephone'] = $this->language->get('column_telephone');
     $this->data['column_facebook'] = $this->language->get('column_facebook');
     $this->data['column_twitter'] = $this->language->get('column_twitter');
     $this->data['column_action'] = $this->language->get('column_action');
     $url = '';
     if ($order == 'ASC') {
         $url .= '&order=DESC';
     } else {
         $url .= '&order=ASC';
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     $this->data['sort_firstname'] = Url::createAdminUrl('sale/cumpleanos/grid') . '&sort=name' . $url;
     $this->data['sort_email'] = Url::createAdminUrl('sale/cumpleanos/grid') . '&sort=c.email' . $url;
     $url = '';
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     $pagination = new Pagination();
     $pagination->total = $customer_total;
     $pagination->page = $page;
     $pagination->limit = $limit;
     $pagination->text = $this->language->get('text_pagination');
     $pagination->url = Url::createAdminUrl('sale/customer') . $url . '&page={page}';
     $this->data['pagination'] = $pagination->render();
     $this->data['sort'] = $sort;
     $this->data['order'] = $order;
     $this->template = 'sale/cumpleanos_grid.tpl';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerStoreProduct::index()
  * 
  * @see Load
  * @see Language
  * @return void
  */
 public function index()
 {
     //TODO: mantener y capturar los filtros en todos los enlaces
     $filter_browser = isset($this->request->get['filter_browser']) ? $this->request->get['filter_browser'] : null;
     $filter_version = isset($this->request->get['filter_version']) ? $this->request->get['filter_version'] : null;
     $filter_language = isset($this->request->get['filter_language']) ? $this->request->get['filter_language'] : null;
     $filter_country_id = isset($this->request->get['filter_country_id']) ? $this->request->get['filter_country'] : null;
     $filter_zone_id = isset($this->request->get['filter_zone_id']) ? $this->request->get['filter_zone_id'] : null;
     $filter_customer_id = isset($this->request->get['filter_customer_id']) ? $this->request->get['filter_customer_id'] : null;
     $filter_object_id = isset($this->request->get['filter_object_id']) ? $this->request->get['filter_object_id'] : null;
     $filter_object = isset($this->request->get['filter_object']) ? $this->request->get['filter_object'] : null;
     $filter_store_id = isset($this->request->get['filter_store_id']) ? $this->request->get['filter_store_id'] : null;
     $filter_ref = isset($this->request->get['filter_ref']) ? $this->request->get['filter_ref'] : null;
     $filter_os = isset($this->request->get['filter_os']) ? $this->request->get['filter_os'] : null;
     $filter_ip = isset($this->request->get['filter_ip']) ? $this->request->get['filter_ip'] : null;
     $filter_date_start = isset($this->request->get['filter_date_start']) ? $this->request->get['filter_date_start'] : null;
     $filter_date_end = isset($this->request->get['filter_date_end']) ? $this->request->get['filter_date_end'] : null;
     $url = '';
     if (isset($this->request->get['filter_browser'])) {
         $url .= '&filter_browser=' . $this->request->get['filter_browser'];
     }
     if (isset($this->request->get['filter_version'])) {
         $url .= '&filter_version=' . $this->request->get['filter_version'];
     }
     if (isset($this->request->get['filter_language'])) {
         $url .= '&filter_language=' . $this->request->get['filter_language'];
     }
     if (isset($this->request->get['filter_country_id'])) {
         $url .= '&filter_country_id=' . $this->request->get['filter_country_id'];
     }
     if (isset($this->request->get['filter_zone_id'])) {
         $url .= '&filter_zone_id=' . $this->request->get['filter_zone_id'];
     }
     if (isset($this->request->get['filter_customer_id'])) {
         $url .= '&filter_customer_id=' . $this->request->get['filter_customer_id'];
     }
     if (isset($this->request->get['filter_object_id'])) {
         $url .= '&filter_object_id=' . $this->request->get['filter_object_id'];
     }
     if (isset($this->request->get['filter_object'])) {
         $url .= '&filter_object=' . $this->request->get['filter_object'];
     }
     if (isset($this->request->get['filter_store_id'])) {
         $url .= '&filter_store_id=' . $this->request->get['filter_store_id'];
     }
     if (isset($this->request->get['filter_ref'])) {
         $url .= '&filter_ref=' . $this->request->get['filter_ref'];
     }
     if (isset($this->request->get['filter_os'])) {
         $url .= '&filter_os=' . $this->request->get['filter_os'];
     }
     if (isset($this->request->get['filter_ip'])) {
         $url .= '&filter_ip=' . $this->request->get['filter_ip'];
     }
     if (isset($this->request->get['filter_date_start'])) {
         $url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
     }
     if (isset($this->request->get['filter_date_end'])) {
         $url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
     }
     $this->data['products'] = array();
     $data = array('filter_browser' => $filter_browser, 'filter_version' => $filter_version, 'filter_language' => $filter_quantity, 'filter_country_id' => $filter_country_id, 'filter_zone_id' => $filter_zone_id, 'filter_customer_id' => $filter_customer_id, 'filter_object_id' => $filter_object_id, 'filter_object' => $filter_object, 'filter_store_id' => $filter_store_id, 'filter_ref' => $filter_ref, 'filter_os' => $filter_os, 'filter_ip' => $filter_ip, 'filter_date_start' => $filter_date_start, 'filter_date_end' => $filter_date_end);
     $this->document->title = $this->data['heading_title'] = $this->language->get('heading_see_title');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('report/visit') . $url, 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->load->auto('stats/traffic');
     $results = $this->modelTraffic->getAll($data);
     $allStock = "[";
     foreach ($this->modelTraffic->getAll($data) as $row) {
         $allStock .= "[" . $row['date_added'] . "," . $row['total'] . "],";
     }
     $allStock = substr($allStock, 0, strlen($allStock) - 1) . "]";
     $productsStock = "[";
     foreach ($this->modelTraffic->getAllProductsForHS() as $row) {
         $productsStock .= "[" . $row['date_added'] . "," . $row['total'] . "],";
     }
     $productsStock = substr($productsStock, 0, strlen($productsStock) - 1) . "]";
     // javascript files
     $javascripts[] = "js/vendor/highstock/highstock.js";
     $javascripts[] = "js/vendor/highstock/modules/exporting.js";
     $javascripts[] = "js/vendor/highcharts/jquery.highchartTable.min.js";
     $this->data['javascripts'] = $this->javascripts = array_merge($javascripts, $this->javascripts);
     // SCRIPTS
     $scripts[] = array('id' => 'seeFunctions', 'method' => 'function', 'script' => "function showTab(a) {\r\n                \$('.vtabs_page').hide();\r\n                \$(\$(a).attr('data-target')).show();\r\n            }\r\n            \r\n            function updateCharts(ds,de) {\r\n                if (typeof de == 'undefined' || typeof ds == 'undefined') {\r\n                    alert('No se pudieron cargar todas las estadísticas');\r\n                    return false;\r\n                }\r\n                \r\n                var params = '&ds='+ ds +'&de='+ de;\r\n                \r\n                \$('#visitsStats')\r\n                    .html('<img src=\"image/nt_loader.gif\" alt\"Cargando...\" />')\r\n                    .load('" . Url::createAdminUrl("store/product/visits") . "' + params);\r\n                /*\r\n                \$('#ordersStats')\r\n                    .delay(600)\r\n                    .html('<img src=\"image/nt_loader.gif\" alt\"Cargando...\" />')\r\n                    .load('" . Url::createAdminUrl("store/product/visits") . "' + params);\r\n                    \r\n                \$('#salesStats')\r\n                    .delay(1200)\r\n                    .html('<img src=\"image/nt_loader.gif\" alt\"Cargando...\" />')\r\n                    .load('" . Url::createAdminUrl("store/product/visits") . "' + params);\r\n                    \r\n                \$('#commentsStats')\r\n                    .delay(1800)\r\n                    .html('<img src=\"image/nt_loader.gif\" alt\"Cargando...\" />')\r\n                    .load('" . Url::createAdminUrl("store/product/visits") . "' + params);\r\n                */\r\n            }");
     $scripts[] = array('id' => 'seeScripts', 'method' => 'ready', 'script' => "\$('#chartVisits').highcharts('StockChart', {\r\n                chart: {\r\n                    events: {\r\n                        load: function(e) {\r\n                            updateCharts(this.xAxis[0].min,this.xAxis[0].max);\r\n                        }\r\n                    }\r\n                },\r\n                rangeSelector : {\r\n    \t\t\t\tselected : 1\r\n    \t\t\t},\r\n    \t\t\ttitle : {\r\n    \t\t\t\ttext : 'Visitas a la Tienda Virtual'\r\n    \t\t\t},\r\n    \t\t\ttooltip: {\r\n                    pointFormat: '<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b><br/>',\r\n        \t\t\tvalueDecimals: 0\r\n    \t\t\t},\r\n                xAxis: {\r\n                    events: {\r\n                        setExtremes: function(e) {\r\n                            updateCharts(e.min,e.max);\r\n                        }\r\n                    },\r\n                    minRange: 3600000\r\n                },\r\n    \t\t\tseries : \r\n                [{\r\n        \t\t\tname : 'Total Visitas',\r\n        \t\t\tdata : {$allStock}\r\n    \t\t\t},\r\n                {\r\n        \t\t\tname : 'Visitas Productos',\r\n                    data : {$productsStock}\r\n        \t\t}]\r\n    \t\t});\r\n            \r\n            \$('#formFilter').ntForm({\r\n                lockButton:false,\r\n                ajax:true,\r\n                type:'get',\r\n                dataType:'html',\r\n                url:'" . Url::createAdminUrl("store/product/seeData") . "',\r\n                beforeSend:function(){\r\n                    \$('#gridWrapper').hide();\r\n                    \$('#gridPreloader').show();\r\n                },\r\n                success:function(data){\r\n                    \$('#gridPreloader').hide();\r\n                    \$('#gridWrapper').html(data).show();\r\n                }\r\n            });\r\n            \r\n            \$('.vtabs_page').hide();\r\n            \$('#tab_visits').show();");
     $this->scripts = array_merge($this->scripts, $scripts);
     $this->template = 'store/product_see.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerStyleWidget::index()
  * 
  * @see Load
  * @see Document
  * @see Language
  * @see getList
  * @return void
  */
 public function index()
 {
     $this->document->title = $this->data['heading_title'] = $this->language->get('heading_title');
     $extensions = $this->modelExtension->getInstalled('module');
     $this->data['extensions'] = array();
     $modules = glob(DIR_APPLICATION . "controller/module/{$filter_name}*");
     if ($modules) {
         foreach ($modules as $module) {
             if (!file_exists($module . '/widget.php')) {
                 continue;
             }
             $extension = basename($module, '/widget.php');
             $this->load->language('module/' . $extension);
             $action = array();
             if (in_array($extension, $extensions)) {
                 $this->data['modules'][] = array('widget' => $extension, 'name' => $this->language->get('heading_title'), 'description' => $this->language->get('description'));
             }
         }
     }
     /*
      //TODO: model template
      $template_info = $this->modelTemplate->getByName($this->config->get('config_template'));
      $this->setvar('hasColumnLeft',$template_info);
      $this->setvar('hasColumnRight',$template_info);
      $this->setvar('hasFooter',$template_info);
      $this->setvar('hasHeader',$template_info);
      $this->setvar('hasMain',$template_info);
     */
     $this->data['hasFeaturedContent'] = true;
     $this->data['hasFeaturedFooter'] = true;
     $this->data['hasColumnLeft'] = true;
     $this->data['hasColumnRight'] = true;
     $this->data['hasFooter'] = true;
     //$this->data['hasHeader'] = true;
     $this->data['hasMain'] = true;
     $this->data['stores'] = $this->modelStore->getAll();
     $this->data['store_id'] = $this->request->hasQuery('store_id') ? $this->request->getQuery('store_id') : 0;
     if ((int) $this->data['store_id'] != 0) {
         $this->data['store_exists'] = $this->modelStore->getById($this->data['store_id']);
     }
     if ((int) $this->data['store_id'] == 0) {
         $this->data['store_exists'] = true;
     }
     $data['store_id'] = $this->data['store_id'];
     $this->data['widgets'] = $this->modelWidget->getAll($data);
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('style/widget') . $url, 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     if ($this->session->has('success')) {
         $this->data['success'] = $this->session->get('success');
         $this->session->clear('success');
     } else {
         $this->data['success'] = '';
     }
     $this->template = 'style/widget.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerExtensionShipping::uninstall()
  * 
  * @see Load
  * @see Language
  * @see Document
  * @see Session
  * @see Response
  * @return void
  */
 public function uninstall()
 {
     if (!$this->user->hasPermission('modify', 'extension/shipping')) {
         $this->session->set('error', $this->language->get('error_permission'));
         $this->redirect(Url::createAdminUrl('extension/shipping'));
     } else {
         $this->modelExtension->uninstall('shipping', $this->request->get['extension']);
         $this->modelSetting->delete($this->request->get['extension']);
         $this->redirect(Url::createAdminUrl('extension/shipping'));
     }
 }
 /**
  * ControllerStoreStore::getForm()
  * 
  * @see Load
  * @see Document
  * @see Request
  * @see Session
  * @see Response
  * @see Pagination
  * @see Language
  * @return void
  */
 private function getForm()
 {
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : null;
     $this->data['error_name'] = isset($this->error['name']) ? $this->error['name'] : null;
     $this->data['error_rif'] = isset($this->error['rif']) ? $this->error['rif'] : null;
     $this->data['error_url'] = isset($this->error['url']) ? $this->error['url'] : null;
     $this->data['error_owner'] = isset($this->error['owner']) ? $this->error['owner'] : null;
     $this->data['error_address'] = isset($this->error['address']) ? $this->error['address'] : null;
     $this->data['error_email'] = isset($this->error['email']) ? $this->error['email'] : null;
     $this->data['error_telephone'] = isset($this->error['telephone']) ? $this->error['telephone'] : null;
     $this->data['error_title'] = isset($this->error['title']) ? $this->error['title'] : null;
     $this->data['error_image_thumb'] = isset($this->error['image_thumb']) ? $this->error['image_thumb'] : null;
     $this->data['error_image_popup'] = isset($this->error['image_popup']) ? $this->error['image_popup'] : null;
     $this->data['error_image_category'] = isset($this->error['image_category']) ? $this->error['image_category'] : null;
     $this->data['error_image_product'] = isset($this->error['image_product']) ? $this->error['image_product'] : null;
     $this->data['error_image_additional'] = isset($this->error['image_additional']) ? $this->error['image_additional'] : null;
     $this->data['error_image_related'] = isset($this->error['image_related']) ? $this->error['image_related'] : null;
     $this->data['error_image_cart'] = isset($this->error['image_cart']) ? $this->error['image_cart'] : null;
     $this->data['error_error_filename'] = isset($this->error['error_filename']) ? $this->error['error_filename'] : null;
     $this->data['error_catalog_limit'] = isset($this->error['catalog_limit']) ? $this->error['catalog_limit'] : null;
     $this->data['error_admin_limit'] = isset($this->error['admin_limit']) ? $this->error['admin_limit'] : null;
     $this->data['error_smtp_host'] = isset($this->error['smtp_host']) ? $this->error['smtp_host'] : null;
     $this->data['error_pop3_host'] = isset($this->error['pop3_host']) ? $this->error['pop3_host'] : null;
     $this->data['error_pop3_port'] = isset($this->error['pop3_port']) ? $this->error['pop3_port'] : null;
     $this->data['error_smtp_port'] = isset($this->error['smtp_port']) ? $this->error['smtp_port'] : null;
     $this->data['error_smtp_from_email'] = isset($this->error['smtp_from_email']) ? $this->error['smtp_from_email'] : null;
     $this->data['error_smtp_timeout'] = isset($this->error['smtp_timeout']) ? $this->error['smtp_timeout'] : null;
     $this->data['error_bounce_email'] = isset($this->error['bounce_email']) ? $this->error['bounce_email'] : null;
     $this->data['error_replyto_email'] = isset($this->error['replyto_email']) ? $this->error['replyto_email'] : null;
     if ($this->session->has('success')) {
         $this->data['success'] = $this->session->get('success');
         $this->session->clear('success');
     } else {
         $this->data['success'] = '';
     }
     $this->data['cancel'] = Url::createAdminUrl('store/store');
     if (!isset($this->request->get['store_id'])) {
         $this->data['action'] = Url::createAdminUrl('store/store/insert');
     } else {
         $this->data['action'] = Url::createAdminUrl('store/store/update', array('store_id' => $this->request->get['store_id']));
     }
     if (isset($this->request->get['store_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $store_info = $this->modelStore->getById($this->request->get['store_id']);
     }
     if ($this->request->hasQuery('store_id')) {
         $this->data['showContent'] = true;
     }
     $this->setVarData('config_name', $store_info, '');
     $this->setVarData('config_folder', $store_info, '');
     $this->setVarData('config_rif', $store_info, '');
     $this->setVarData('config_url', $store_info, '');
     $this->setVarData('config_owner', $store_info, '');
     $this->setVarData('config_address', $store_info, '');
     $this->setVarData('config_email', $store_info, '');
     $this->setVarData('config_telephone', $store_info, '');
     $this->setVarData('config_fax', $store_info, '');
     $this->setVarData('config_title', $store_info, '');
     $this->setVarData('config_meta_description', $store_info, '');
     $this->setVarData('config_template', $store_info, '');
     $this->setVarData('config_mobile_template', $store_info, '');
     $this->setVarData('config_tablet_template', $store_info, '');
     $this->setVarData('config_facebook_template', $store_info, '');
     $this->setVarData('config_mobile_url', $store_info, '');
     $this->setVarData('config_tablet_url', $store_info, '');
     $this->setVarData('config_facebbok_url', $store_info, '');
     $this->setVarData('config_redirect_when_mobile', $store_info, '');
     $this->setVarData('config_redirect_when_tablet', $store_info, '');
     $this->setVarData('config_redirect_when_facebook', $store_info, '');
     $this->setVarData('config_country_id', $store_info, '');
     $this->setVarData('config_zone_id', $store_info, '');
     $this->setVarData('config_language', $store_info, '');
     $this->setVarData('config_admin_language', $store_info, '');
     $this->setVarData('config_currency', $store_info, '');
     $this->setVarData('config_currency_auto', $store_info, '');
     $this->setVarData('config_tax', $store_info, '');
     $this->setVarData('config_customer_group_id', $store_info, '');
     $this->setVarData('config_customer_price', $store_info, '');
     $this->setVarData('config_customer_approval', $store_info, '');
     $this->setVarData('config_store_mode', $store_info, '');
     $this->setVarData('config_account_id', $store_info, '');
     $this->setVarData('config_checkout_id', $store_info, '');
     $this->setVarData('config_stock_display', $store_info, '');
     $this->setVarData('config_stock_checkout', $store_info, '');
     $this->setVarData('config_order_status_id', $store_info, '');
     $this->setVarData('config_stock_status_id', $store_info, '');
     $this->setVarData('config_shipping_session', $store_info, '');
     $this->setVarData('config_admin_limit', $store_info, '');
     $this->setVarData('config_catalog_limit', $store_info, '');
     $this->setVarData('config_new_days', $store_info, '');
     $this->setVarData('config_cart_weight', $store_info, '');
     $this->setVarData('config_review', $store_info, '');
     $this->setVarData('config_review_approve', $store_info, '');
     $this->setVarData('config_logo', $store_info, '');
     $this->setVarData('config_email_logo', $store_info, '');
     $this->setVarData('config_mobile_logo', $store_info, '');
     $this->setVarData('config_icon', $store_info, '');
     $this->setVarData('config_image_thumb_width', $store_info, '');
     $this->setVarData('config_image_thumb_height', $store_info, '');
     $this->setVarData('config_image_popup_width', $store_info, '');
     $this->setVarData('config_image_popup_height', $store_info, '');
     $this->setVarData('config_image_category_width', $store_info, '');
     $this->setVarData('config_image_category_height', $store_info, '');
     $this->setVarData('config_image_post_width', $store_info, '');
     $this->setVarData('config_image_post_height', $store_info, '');
     $this->setVarData('config_image_product_width', $store_info, '');
     $this->setVarData('config_image_product_height', $store_info, '');
     $this->setVarData('config_image_additional_width', $store_info, '');
     $this->setVarData('config_image_additional_height', $store_info, '');
     $this->setVarData('config_image_related_width', $store_info, '');
     $this->setVarData('config_image_related_height', $store_info, '');
     $this->setVarData('config_image_cart_width', $store_info, '');
     $this->setVarData('config_image_cart_height', $store_info, '');
     $this->setVarData('config_mail_protocol', $store_info, '');
     $this->setVarData('config_smtp_host', $store_info, '');
     $this->setVarData('config_pop3_host', $store_info, '');
     $this->setVarData('config_smtp_from_email', $store_info, '');
     $this->setVarData('config_smtp_from_name', $store_info, '');
     $this->setVarData('config_smtp_username', $store_info, '');
     $this->setVarData('config_smtp_password', $store_info, '');
     $this->setVarData('config_smtp_method', $store_info, 'mail');
     $this->setVarData('config_smtp_port', $store_info, 25);
     $this->setVarData('config_pop3_protocol', $store_info, 'pop3');
     $this->setVarData('config_pop3_port', $store_info, 110);
     $this->setVarData('config_smtp_timeout', $store_info, 5);
     $this->setVarData('config_smtp_maxsize', $store_info, 0);
     $this->setVarData('config_smtp_charset', $store_info, 'utf-8');
     $this->setVarData('config_alert_mail', $store_info, '');
     $this->setVarData('config_smtp_auth', $store_info, '');
     $this->setVarData('config_alert_emails', $store_info, '');
     $this->setVarData('config_mail_parameter', $store_info, '');
     $this->setVarData('config_ssl', $store_info, '');
     $this->setVarData('config_pop3_ssl', $store_info, '');
     $this->setVarData('config_smtp_ssl', $store_info, '');
     $this->setVarData('config_bounce_email', $store_info, '');
     $this->setVarData('config_replyto_email', $store_info, '');
     $this->setVarData('config_bounce_server', $store_info, '');
     $this->setVarData('config_bounce_username', $store_info, '');
     $this->setVarData('config_bounce_password', $store_info, '');
     $this->setVarData('config_bounce_protocol', $store_info, '');
     $this->setVarData('config_bounce_extra_settings', $store_info, '');
     $this->setVarData('config_bounce_protocol', $store_info, 'pop3');
     $this->setVarData('config_bounce_process', $store_info, 0);
     $this->setVarData('config_bounce_agree_delete', $store_info, 0);
     $this->setVarData('config_bounce_extra_settings', $store_info, '');
     $this->setVarData('config_bounce_extra_settings', $store_info, '');
     $this->setVarData('config_maintenance', $store_info, '');
     $this->setVarData('config_encryption', $store_info, '');
     $this->setVarData('config_js_security', $store_info, '');
     $this->setVarData('config_server_security', $store_info, '');
     $this->setVarData('config_password_security', $store_info, '');
     $this->setVarData('config_seo_url', $store_info, '');
     $this->setVarData('config_compression', $store_info, '');
     $this->setVarData('config_error_display', $store_info, '');
     $this->setVarData('config_error_log', $store_info, '');
     $this->setVarData('config_error_filename', $store_info, '');
     $this->setVarData('config_dir_export', $store_info, '');
     $directories = glob(DIR_CATALOG . 'view/theme/*', GLOB_ONLYDIR);
     $this->data['templates'] = array();
     foreach ($directories as $directory) {
         $this->data['templates'][] = basename($directory);
     }
     $languages = $this->data['languages'] = $this->modelLanguage->getAll();
     foreach ($languages as $language) {
         if (isset($this->request->post['config_title_' . $language['language_id']])) {
             $this->data['config_title_' . $language['language_id']] = $this->request->post['config_title_' . $language['language_id']];
         } elseif ($store_info['config_title_' . $language['language_id']]) {
             $this->data['config_title_' . $language['language_id']] = $store_info['config_title_' . $language['language_id']];
         } else {
             $this->data['config_title_' . $language['language_id']] = '';
         }
         if (isset($this->request->post['config_description_' . $language['language_id']])) {
             $this->data['config_description_' . $language['language_id']] = $this->request->post['config_description_' . $language['language_id']];
         } elseif ($store_info['config_description_' . $language['language_id']]) {
             $this->data['config_description_' . $language['language_id']] = $store_info['config_description_' . $language['language_id']];
         } else {
             $this->data['config_description_' . $language['language_id']] = '';
         }
         if (isset($this->request->post['config_meta_description_' . $language['language_id']])) {
             $this->data['config_meta_description_' . $language['language_id']] = $this->request->post['config_meta_description_' . $language['language_id']];
         } elseif ($store_info['config_meta_description_' . $language['language_id']]) {
             $this->data['config_meta_description_' . $language['language_id']] = $store_info['config_meta_description_' . $language['language_id']];
         } else {
             $this->data['config_meta_description_' . $language['language_id']] = '';
         }
     }
     $this->data['countries'] = $this->modelCountry->getAll();
     $this->data['currencies'] = $this->modelCurrency->getAll();
     $this->data['pages'] = $this->modelPage->getAll();
     $this->data['customer_groups'] = $this->modelCustomergroup->getAll();
     $this->data['order_statuses'] = $this->modelOrderstatus->getAll();
     $this->data['stock_statuses'] = $this->modelStockstatus->getAll();
     if (!empty($this->request->post['config_logo']) && file_exists(DIR_IMAGE . $this->request->post['config_logo'])) {
         $this->data['preview_logo'] = HTTP_IMAGE . $this->request->post['config_logo'];
     } elseif (!empty($store_info['config_logo']) && file_exists(DIR_IMAGE . $store_info['config_logo'])) {
         $this->data['preview_logo'] = HTTP_IMAGE . $store_info['config_logo'];
     } else {
         $this->data['preview_logo'] = NTImage::resizeAndSave('no_image.jpg', 100, 100);
     }
     if (!empty($this->request->post['config_email_logo']) && file_exists(DIR_IMAGE . $this->request->post['config_email_logo'])) {
         $this->data['preview_email_logo'] = HTTP_IMAGE . $this->request->post['config_email_logo'];
     } elseif (!empty($store_info['config_email_logo']) && file_exists(DIR_IMAGE . $store_info['config_email_logo'])) {
         $this->data['preview_email_logo'] = HTTP_IMAGE . $store_info['config_email_logo'];
     } else {
         $this->data['preview_email_logo'] = NTImage::resizeAndSave('no_image.jpg', 100, 100);
     }
     if (!empty($this->request->post['config_mobile_logo']) && file_exists(DIR_IMAGE . $this->request->post['config_mobile_logo'])) {
         $this->data['preview_mobile_logo'] = HTTP_IMAGE . $this->request->post['config_mobile_logo'];
     } elseif (!empty($store_info['config_mobile_logo']) && file_exists(DIR_IMAGE . $store_info['config_mobile_logo'])) {
         $this->data['preview_mobile_logo'] = HTTP_IMAGE . $store_info['config_mobile_logo'];
     } else {
         $this->data['preview_mobile_logo'] = NTImage::resizeAndSave('no_image.jpg', 100, 100);
     }
     if (!empty($this->request->post['config_icon']) && file_exists(DIR_IMAGE . $this->request->post['config_icon'])) {
         $this->data['preview_icon'] = HTTP_IMAGE . $this->request->post['config_icon'];
     } elseif (!empty($store_info['config_logo']) && file_exists(DIR_IMAGE . $store_info['config_icon'])) {
         $this->data['preview_icon'] = HTTP_IMAGE . $store_info['config_icon'];
     } else {
         $this->data['preview_icon'] = NTImage::resizeAndSave('no_image.jpg', 100, 100);
     }
     $ignore = array('common/login', 'common/logout', 'error/not_found', 'error/permission');
     $this->data['tokens'] = array();
     $files = glob(DIR_APPLICATION . 'controller/*/*.php');
     foreach ($files as $file) {
         $data = explode('/', dirname($file));
         $token = end($data) . '/' . basename($file, '.php');
         if (!in_array($token, $ignore)) {
             $this->data['tokens'][] = $token;
         }
     }
     if (isset($this->request->post['config_token_ignore'])) {
         $this->data['config_token_ignore'] = $this->request->post['config_token_ignore'];
     } elseif (isset($store_info['config_token_ignore'])) {
         $this->data['config_token_ignore'] = unserialize($store_info['config_token_ignore']);
     } else {
         $this->data['config_token_ignore'] = array();
     }
     $scripts[] = array('id' => 'form', 'method' => 'ready', 'script' => "\$('.product_tab').hide();\r\n            \$('#general').show();\r\n            \$('.product_tabs .htab').on('click',function(e){\r\n                \$('.product_tab').hide();\r\n                \$(\$(this).attr('data-target')).show();\r\n            });");
     foreach ($this->data['languages'] as $language) {
         $code = "var editor" . $language["language_id"] . " = CKEDITOR.replace('description" . $language["language_id"] . "', {" . "filebrowserBrowseUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserImageBrowseUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserFlashBrowseUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserUploadUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserImageUploadUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserFlashUploadUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "height:600" . "});" . "editor" . $language["language_id"] . ".products = '" . $json['products'] . "';" . "editor" . $language["language_id"] . ".config.allowedContent = true;";
         $cssrules = "assets/theme/" . ($this->config->get('config_template') ? $this->config->get('config_template') : 'choroni') . "/css/theme.css";
         if (file_exists(DIR_ROOT . $cssrules)) {
             $code .= "editor" . $language["language_id"] . ".config.contentsCss = '" . HTTP_CATALOG . $cssrules . "';";
         }
         $scripts[] = array('id' => 'pageLanguage' . $language["language_id"], 'method' => 'ready', 'script' => $code);
     }
     $scripts[] = array('id' => 'Functions', 'method' => 'function', 'script' => "function image_delete(field, preview) {\r\n                \$('#' + field).val('');\r\n                \$('#' + preview).attr('src','" . HTTP_IMAGE . "cache/no_image-100x100.jpg');\r\n            }");
     $this->scripts = array_merge($this->scripts, $scripts);
     // javascript files
     $jspath = defined("CDN_JS") ? CDN_JS : HTTP_JS;
     $javascripts[] = "js/vendor/ckeditor/ckeditor.js";
     $this->javascripts = array_merge($javascripts, $this->javascripts);
     $this->template = 'store/store_form.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerStoreCategory::getForm()
  * 
  * @see Load
  * @see Model
  * @see Document
  * @see Session
  * @see Language
  * @see Response
  * @return void
  */
 private function getForm()
 {
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     $this->data['error_name'] = isset($this->error['name']) ? $this->error['name'] : '';
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('store/category'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     if (!isset($this->request->get['category_id'])) {
         $this->data['action'] = Url::createAdminUrl('store/category/insert');
     } else {
         $this->data['action'] = Url::createAdminUrl('store/category/update', array('category_id' => $this->request->get['category_id']));
     }
     $this->data['cancel'] = Url::createAdminUrl('store/category');
     if ($this->request->hasQuery('category_id') && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $category_info = $this->modelCategory->getById($this->request->getQuery('category_id'));
     }
     $this->data['languages'] = $this->modelLanguage->getAll();
     $this->data['stores'] = $this->modelStore->getAll();
     $this->data['_stores'] = $this->modelCategory->getStores($this->request->getQuery('category_id'));
     $this->data['layout'] = $this->modelCategory->getProperty($this->request->getQuery('category_id'), 'style', 'view');
     if (file_exists(DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/common/home.tpl')) {
         $folderTPL = DIR_CATALOG . 'view/theme/' . $this->config->get('config_template') . '/';
     } else {
         $folderTPL = DIR_CATALOG . 'view/theme/default/';
     }
     $directories = glob($folderTPL . "*", GLOB_ONLYDIR);
     $this->data['templates'] = array();
     foreach ($directories as $key => $directory) {
         $this->data['views'][$key]['folder'] = basename($directory);
         $files = glob($directory . "/*.tpl", GLOB_NOSORT);
         foreach ($files as $k => $file) {
             $this->data['views'][$key]['files'][$k] = str_replace("\\", "/", $file);
         }
     }
     if (isset($this->request->post['category_description'])) {
         $this->data['category_description'] = $this->request->post['category_description'];
     } elseif (isset($category_info)) {
         $this->data['category_description'] = $this->modelCategory->getDescriptions($this->request->get['category_id']);
     } else {
         $this->data['category_description'] = array();
     }
     $this->setvar('category_id', $category_info);
     $this->setvar('status', $category_info, 1);
     $this->setvar('parent_id', $category_info, 0);
     $this->setvar('keyword', $category_info, '');
     $this->setvar('image', $category_info);
     $this->setvar('sort_order', $category_info, 0);
     $this->data['categories'] = $this->modelCategory->getAll();
     if (!empty($category_info['image']) && file_exists(DIR_IMAGE . $category_info['image'])) {
         $this->data['preview'] = NTImage::resizeAndSave($category_info['image'], 100, 100);
     } else {
         $this->data['preview'] = NTImage::resizeAndSave('no_image.jpg', 100, 100);
     }
     $scripts[] = array('id' => 'categoryForm', 'method' => 'ready', 'script' => "\$('#addsWrapper').hide();\r\n            \r\n            \$('#addsPanel').on('click',function(e){\r\n                var products = \$('#addsWrapper').find('.row');\r\n                \r\n                if (products.length == 0) {\r\n                    \$.getJSON('" . Url::createAdminUrl("store/category/products") . "',\r\n                        {\r\n                            'category_id':'" . $this->request->getQuery('category_id') . "'\r\n                        }, function(data) {\r\n                            \r\n                            var htmlOutput = '<div class=\"row\">';\r\n                            htmlOutput += '<label for=\"q\" style=\"float:left\">';\r\n                            htmlOutput += 'Filtrar listado de productos:';\r\n                            htmlOutput += '</label>';\r\n                            htmlOutput += '<input type=\"text\" value=\"\" name=\"q\" id=\"q\" placeholder=\"Filtrar Productos\" />';\r\n                            htmlOutput += '</div>';\r\n                            htmlOutput += '<div class=\"clear\"></div>';\r\n                            htmlOutput += '<br />';\r\n                            htmlOutput += '<a onclick=\"\$(\\'#adds b\\').removeClass(\\'added\\').addClass(\\'add\\');\$(\\'#adds input[type=checkbox]\\').attr(\\'checked\\',null);\$(\\'#adds\\').append(\\' <input type=\\\\\\'hidden\\\\\\' name=\\\\\\'Products[0]\\\\\\' value=\\\\\\'0\\\\\\' id=\\\\\\'tempRelated\\\\\\' /> \\');\">Seleccionar Ninguno</a>';\r\n                            htmlOutput += '&nbsp;&nbsp;|&nbsp;&nbsp;';\r\n                            htmlOutput += '<a onclick=\"\$(\\'#adds b\\').removeClass(\\'add\\').addClass(\\'added\\');\$(\\'#adds input[type=checkbox]\\').attr(\\'checked\\',1);\$(\\'#tempRelated\\').remove();\">Seleccionar Todos</a>';\r\n                            htmlOutput += '<br />';\r\n                            htmlOutput += '<ul id=\"adds\"></ul>';\r\n                            \r\n                            \$('#addsWrapper').html(htmlOutput);\r\n                            \r\n                            \$.each(data, function(i,item){\r\n                                if (item.class == 'added') {\r\n                                    checked = ' checked=\"checked\"';\r\n                                } else {\r\n                                    checked = '';\r\n                                }\r\n                                \$('#adds').append('<li><img src=\"' + item.pimage + '\" alt=\"' + item.pname + '\" /><b class=\"' + item.class + '\">' + item.pname + '</b><input type=\"checkbox\" name=\"Products[' + item.product_id + ']\" value=\"' + item.product_id + '\" style=\"display:none\"'+ checked +' /></li>');\r\n                                \r\n                            });\r\n                            \r\n                            \$('#q').on('keyup',function(e){\r\n                                var that = this;\r\n                                var valor = \$(that).val().toLowerCase();\r\n                                if (valor.length <= 0) {\r\n                                    \$('#adds li').show();\r\n                                } else {\r\n                                    \$('#adds li b').each(function(){\r\n                                        if (\$(this).text().toLowerCase().indexOf( valor ) > 0) {\r\n                                            \$(this).closest('li').show();\r\n                                        } else {\r\n                                            \$(this).closest('li').hide();\r\n                                        }\r\n                                    });\r\n                                }\r\n                            }); \r\n                            \r\n                            \$('li').on('click',function() {\r\n                                var b = \$(this).find('b');\r\n                                if (b.hasClass('added')) {\r\n                                    b.removeClass('added').addClass('add');\r\n                                    \$(this).find('input[type=checkbox]').removeAttr('checked');\r\n                                } else {\r\n                                    b.removeClass('add').addClass('added');\r\n                                    \$(this).find('input[type=checkbox]').attr('checked','checked');\r\n                                }\r\n                            });\r\n                    });\r\n                }\r\n            });\r\n                \r\n            \$('#addsPanel').on('click',function(){ \$('#addsWrapper').slideToggle() });");
     foreach ($this->data['languages'] as $language) {
         $code = "var editor" . $language["language_id"] . " = CKEDITOR.replace('description" . $language["language_id"] . "', {" . "filebrowserBrowseUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserImageBrowseUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserFlashBrowseUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserUploadUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserImageUploadUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "filebrowserFlashUploadUrl: '" . Url::createAdminUrl("common/filemanager") . "'," . "height:600" . "});" . "editor" . $language["language_id"] . ".products = '" . $json['products'] . "';" . "editor" . $language["language_id"] . ".config.allowedContent = true;";
         $cssrules = "assets/theme/" . ($this->config->get('config_template') ? $this->config->get('config_template') : 'choroni') . "/css/theme.css";
         if (file_exists(DIR_ROOT . $cssrules)) {
             $code .= "editor" . $language["language_id"] . ".config.contentsCss = '" . HTTP_CATALOG . $cssrules . "';";
         }
         $code .= "\$('#description_" . $language["language_id"] . "_name').change(function(e){\r\n                    \$.getJSON('" . Url::createAdminUrl('common/home/slug') . "',\r\n                    { \r\n                        slug : \$(this).val(),\r\n                        query : 'path=" . $this->request->getQuery('category_id') . "',\r\n                    },\r\n                    function(data){\r\n                        \$('#description_" . $language["language_id"] . "_keyword').val(data.slug);\r\n                    });\r\n                });";
         $scripts[] = array('id' => 'pageLanguage' . $language["language_id"], 'method' => 'ready', 'script' => $code);
     }
     $scripts[] = array('id' => 'categoryFunctions', 'method' => 'function', 'script' => "function image_delete(field, preview) {\r\n                \$('#' + field).val('');\r\n                \$('#' + preview).attr('src','" . HTTP_IMAGE . "cache/no_image-100x100.jpg');\r\n            }\r\n            \r\n            function image_upload(field, preview) {\r\n                var height = \$(window).height() * 0.8;\r\n                var width = \$(window).width() * 0.8;\r\n                \r\n            \t\$('#dialog').remove();\r\n            \t\$('.box').prepend('<div id=\"dialog\" style=\"padding: 3px 0px 0px 0px;z-index:10000;\"><iframe src=\"" . Url::createAdminUrl("common/filemanager") . "&field=' + encodeURIComponent(field) + '\" style=\"padding:0; margin: 0; display: block; width: 100%; height: 100%;z-index:10000\" frameborder=\"no\" scrolling=\"auto\"></iframe></div>');\r\n                \r\n                \$('#dialog').dialog({\r\n            \t\ttitle: '" . $this->data['text_image_manager'] . "',\r\n            \t\tclose: function (event, ui) {\r\n            \t\t\tif (\$('#' + field).attr('value')) {\r\n            \t\t\t\t\$.ajax({\r\n            \t\t\t\t\turl: '" . Url::createAdminUrl("common/filemanager/image") . "',\r\n            \t\t\t\t\ttype: 'POST',\r\n            \t\t\t\t\tdata: 'image=' + encodeURIComponent(\$('#' + field).val()),\r\n            \t\t\t\t\tdataType: 'text',\r\n            \t\t\t\t\tsuccess: function(data) {\r\n            \t\t\t\t\t\t\$('#' + preview).replaceWith('<img src=\"' + data + '\" id=\"' + preview + '\" class=\"image\" onclick=\"image_upload(\\'' + field + '\\', \\'' + preview + '\\');\">');\r\n            \t\t\t\t\t}\r\n            \t\t\t\t});\r\n            \t\t\t}\r\n            \t\t},\t\r\n            \t\tbgiframe: false,\r\n            \t\twidth: width,\r\n            \t\theight: height,\r\n            \t\tresizable: false,\r\n            \t\tmodal: false\r\n            \t});}");
     $this->scripts = array_merge($this->scripts, $scripts);
     // javascript files
     $jspath = defined("CDN_JS") ? CDN_JS : HTTP_JS;
     $javascripts[] = "js/vendor/ckeditor/ckeditor.js";
     $this->javascripts = array_merge($javascripts, $this->javascripts);
     /* feedback form values */
     $this->data['domain'] = HTTP_HOME;
     $this->data['account_id'] = C_CODE;
     $this->data['local_ip'] = $_SERVER['SERVER_ADDR'];
     $this->data['remote_ip'] = $_SERVER['REMOTE_ADDR'];
     $this->data['server'] = serialize($_SERVER);
     //TODO: encriptar todos estos datos con una llave que solo yo poseo
     $this->template = 'store/category_form.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 /**
  * ControllerSaleBank::getForm()
  * 
  * @see Load
  * @see Document
  * @see Language
  * @see Session
  * @see Response
  * @see Request     
  * @return void 
  */
 private function getForm()
 {
     $this->data['error_warning'] = $this->error['warning'] ? $this->error['warning'] : '';
     $this->data['error_accountholder'] = $this->error['accountholder'] ? $this->error['accountholder'] : '';
     $this->data['error_number'] = $this->error['number'] ? $this->error['number'] : '';
     $this->data['error_email'] = $this->error['email'] ? $this->error['email'] : '';
     $this->data['error_rif'] = $this->error['rif'] ? $this->error['rif'] : '';
     $this->data['error_type'] = $this->error['type'] ? $this->error['type'] : '';
     $this->data['error_bank'] = $this->error['bank'] ? $this->error['bank'] : '';
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createAdminUrl('sale/bank_account') . $url, 'text' => $this->language->get('heading_title'), 'separator' => ' :: ');
     if (!isset($this->request->get['bank_account_id'])) {
         $this->data['action'] = Url::createAdminUrl('sale/bank_account/insert') . $url;
     } else {
         $this->data['action'] = Url::createAdminUrl('sale/bank_account/update') . '&bank_account_id=' . $this->request->get['bank_account_id'] . $url;
     }
     $this->data['cancel'] = Url::createAdminUrl('sale/bank_account') . $url;
     if (isset($this->request->get['bank_account_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $bank_account_info = $this->modelBank_account->getById($this->request->get['bank_account_id']);
     }
     $this->data['stores'] = $this->modelStore->getAll();
     $this->data['_stores'] = $this->modelBank_account->getStores($this->request->get['bank_account_id']);
     $this->setvar('accountholder', $bank_account_info, '');
     $this->setvar('number', $bank_account_info, '');
     $this->setvar('email', $bank_account_info, '');
     $this->setvar('rif', $bank_account_info, '');
     $this->setvar('type', $bank_account_info, '');
     $this->setvar('bank_id', $bank_account_info, '');
     $this->data['banks'] = $this->modelBank->getAll();
     $this->template = 'sale/bank_account_form.tpl';
     $this->children[] = 'common/header';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }