public function postProcess() { global $cookie; $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if (Tools::isSubmit('submitAdd' . $this->table)) { if ($id_category = intval(Tools::getValue('id_category'))) { if (!Category::checkBeforeMove($id_category, intval(Tools::getValue('id_parent')))) { $this->_errors[] = Tools::displayError('category cannot be moved here'); return false; } // Updating customer's group if ($this->tabAccess['edit'] !== '1') { $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); } else { $object = new $this->className($id_category); if (Validate::isLoadedObject($object)) { $object->updateGroup(Tools::getValue('groupBox')); } else { $this->_errors[] = Tools::displayError('an error occurred while updating object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } } } parent::postProcess(); }
public function postProcess() { global $cookie, $currentIndex; $this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); $this->adminAttributes->postProcess($this->token); Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessAttributeGroup to stop saving process if (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table . 'Box'])) { Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token); } $this->_errors[] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations'); } else { $this->_errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } else { parent::postProcess(); } if (isset($this->_errors) && count($this->_errors)) { $key = array_search('An error occurred during deletion of ' . $this->table . '.', $this->_errors); if ($key !== false) { $this->_errors[$key] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations'); } } }
public function postProcess() { global $cookie, $currentIndex; $this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); $this->adminAttributes->postProcess($this->token); Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessAttributeGroup to stop saving process if (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table . 'Box'])) { Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else { $this->_errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } else { parent::postProcess(); } }
function checkTabRights($id_tab) { global $cookie; $tabAccess = Profile::getProfileAccess($cookie->profile, intval($id_tab)); if ($tabAccess['view'] === '1') { return true; } return false; }
public function initProcess() { parent::initProcess(); $access = Profile::getProfileAccess($this->context->employee->id_profile, (int) Tab::getIdFromClassName('AdminOrders')); if ($access['view'] === '1' && ($action = Tools::getValue('submitAction'))) { $this->action = $action; } else { $this->errors[] = Tools::displayError('You do not have permission to view this.'); } }
public function initProcess() { parent::initProcess(); $this->checkCacheFolder(); $access = Profile::getProfileAccess($this->context->employee->id_profile, (int) Tab::getIdFromClassName('AdminOrders')); if ($access['view'] === '1' && ($action = Tools::getValue('submitAction'))) { $this->action = $action; } else { $this->errors[] = $this->trans('You do not have permission to view this.', array(), 'Admin.Notifications.Error'); } }
public function __construct() { $this->display = 'view'; $this->table = 'carrier'; $this->identifier = 'id_carrier'; $this->className = 'Carrier'; $this->lang = false; $this->deleted = true; $this->step_number = 0; $this->fieldImageSettings = array('name' => 'logo', 'dir' => 's'); parent::__construct(); $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, Tab::getIdFromClassName('AdminCarriers')); }
public function postProcess() { /* PrestaShop demo mode */ if (_PS_MODE_DEMO_) { $this->_errors[] = Tools::displayError('This functionnality has been disabled.'); return; } global $cookie; $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if ($this->tabAccess['add'] === '1' and Tools::isSubmit('submitAdd' . $this->table)) { if ($id = (int) Tools::getValue('id_attachment') and $a = new Attachment($id)) { $_POST['file'] = $a->file; $_POST['mime'] = $a->mime; } if (!sizeof($this->_errors)) { if (isset($_FILES['file']) and is_uploaded_file($_FILES['file']['tmp_name'])) { if ($_FILES['file']['size'] > Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024) { $this->_errors[] = $this->l('File too large, maximum size allowed:') . ' ' . Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 . ' ' . $this->l('kb') . '. ' . $this->l('File size you\'re trying to upload is:') . number_format($_FILES['file']['size'] / 1024, 2, '.', '') . $this->l('kb'); } else { do { $uniqid = sha1(microtime()); } while (file_exists(_PS_DOWNLOAD_DIR_ . $uniqid)); if (!copy($_FILES['file']['tmp_name'], _PS_DOWNLOAD_DIR_ . $uniqid)) { $this->_errors[] = $this->l('File copy failed'); } $_POST['file_name'] = $_FILES['file']['name']; @unlink($_FILES['file']['tmp_name']); if (!sizeof($this->_errors) && file_exists(_PS_DOWNLOAD_DIR_ . $a->file)) { @unlink(_PS_DOWNLOAD_DIR_ . $a->file); } $_POST['file'] = $uniqid; $_POST['mime'] = $_FILES['file']['type']; } } elseif (array_key_exists('file', $_FILES) && (int) $_FILES['file']['error'] === 1) { $max_upload = (int) ini_get('upload_max_filesize'); $max_post = (int) ini_get('post_max_size'); $upload_mb = min($max_upload, $max_post); $this->_errors[] = $this->l('the File') . ' <b>' . $_FILES['file']['name'] . '</b> ' . $this->l('exceeds the size allowed by the server. This limit is set to') . ' <b>' . $upload_mb . $this->l('Mb') . '</b>'; } elseif (!empty($_FILES['file']['tmp_name'])) { $this->_errors[] = $this->l('The file does not exist or cannot be downloaded;check your server configuration regarding the maximum upload size.'); } } $this->validateRules(); } $return = parent::postProcess(); if (!$return && isset($uniqid) && file_exists(_PS_DOWNLOAD_DIR_ . $uniqid)) { @unlink(_PS_DOWNLOAD_DIR_ . $uniqid); } return $return; }
public function hookBackOfficeHome($params) { global $cookie; $this->_postProcess(); $currency = Currency::getCurrency(intval(Configuration::get('PS_CURRENCY_DEFAULT'))); $results = $this->getResults(); $employee = new Employee(intval($cookie->id_employee)); $id_tab_stats = Tab::getIdFromClassName('AdminStats'); $access = Profile::getProfileAccess($employee->id_profile, $id_tab_stats); if (!$access['view']) { return ''; } $this->_html = ' <fieldset style="width:520px;"> <legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Statistics') . '</legend> <div style="float:left;width:240px;text-align:center"> <div style="float:left;width:120px;text-align:center"> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square1.gif\')"> <br /><br />' . Tools::displayPrice($results['total_sales'], $currency) . ' </p></center> <p>' . $this->l('of sales') . '</p> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square3.gif\')"> <br /><br />' . intval($results['total_registrations']) . ' </p></center> <p>' . ($results['total_registrations'] != 1 ? $this->l('registrations') : $this->l('registration')) . '</p> </div> <div style="float:left;width:120px;text-align:center"> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square2.gif\')"> <br /><br />' . intval($results['total_orders']) . ' </p></center> <p>' . ($results['total_orders'] != 1 ? $this->l('orders placed') : $this->l('order placed')) . '</p> <center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square4.gif\')"> <br /><br />' . intval($results['total_viewed']) . ' </p></center> <p>' . ($results['total_viewed'] != 1 ? $this->l('product pages viewed') : $this->l('product page viewed')) . '</p> </div> </div> <div style="float:right;text-align:right;width:240px">'; include_once dirname(__FILE__) . '/../..' . $this->_adminPath . '/tabs/AdminStats.php'; $this->_html .= AdminStatsTab::displayCalendarStatic(array('Calendar' => $this->l('Calendar'), 'Day' => $this->l('Day'), 'Month' => $this->l('Month'), 'Year' => $this->l('Year'))); $this->_html .= '<div class="space"></div> <p style=" font-weight: bold ">' . $this->l('Visitors online now:') . ' ' . intval($this->getVisitorsNow()) . '</p> </div> </fieldset> <div class="clear space"><br /><br /></div>'; return $this->_html; }
public function postProcess() { global $cookie; $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if ($this->tabAccess['add'] === '1' and Tools::isSubmit('submitAdd' . $this->table)) { $this->deleted = false; $_POST['invoice'] = Tools::getValue('invoice', 0); $_POST['delivery'] = Tools::getValue('delivery', 0); $_POST['logable'] = Tools::getValue('logable', 0); $_POST['send_email'] = Tools::getValue('send_email', 0); $_POST['hidden'] = Tools::getValue('hidden', 0); if (!$_POST['send_email']) { $languages = Language::getLanguages(false); foreach ($languages as $language) { $_POST['template_' . (int) $language['id_lang']] = ''; } } parent::postProcess(); } elseif ($this->tabAccess['delete'] === '1' and isset($_GET['delete' . $this->table])) { $orderState = new OrderState((int) $_GET['id_order_state'], $cookie->id_lang); if (!$orderState->isRemovable()) { $this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); } else { parent::postProcess(); } } elseif ($this->tabAccess['delete'] === '1' and isset($_POST['submitDelorder_state'])) { foreach ($_POST[$this->table . 'Box'] as $selection) { $orderState = new OrderState((int) $selection, $cookie->id_lang); if (!$orderState->isRemovable()) { $this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); break; } } if (empty($this->_errors)) { parent::postProcess(); } } else { parent::postProcess(); } }
public function postProcess() { global $cookie, $currentIndex; $this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); $this->adminAttributes->postProcess($this->token); if (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table . 'Box'])) { Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token); } $this->_errors[] = Tools::displayError('an error occurred while deleting selection'); } else { $this->_errors[] = Tools::displayError('you must select at least one element to delete'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } else { parent::postProcess(); } }
<?php /* * 2015-2016 DOGS * @author J.Podracky, L.Fisher * @copyright 2015-2016 F2FCREATIVE */ if (!defined('_PS_ADMIN_DIR_')) { define('_PS_ADMIN_DIR_', getcwd()); } include _PS_ADMIN_DIR_ . '/../config/config.inc.php'; if (!Context::getContext()->employee->isLoggedBack()) { Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminLogin')); } $tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminBackup')); if ($tabAccess['view'] !== '1') { die(Tools::displayError('You do not have permission to view this.')); } $backupdir = realpath(PrestaShopBackup::getBackupPath()); if ($backupdir === false) { die(Tools::displayError('There is no "/backup" directory.')); } if (!($backupfile = Tools::getValue('filename'))) { die(Tools::displayError('No file has been specified.')); } // Check the realpath so we can validate the backup file is under the backup directory $backupfile = realpath($backupdir . DIRECTORY_SEPARATOR . $backupfile); if ($backupfile === false or strncmp($backupdir, $backupfile, strlen($backupdir)) != 0) { die(Tools::dieOrLog('The backup file does not exist.')); } if (substr($backupfile, -4) == '.bz2') {
function content_566801a0a465f3_87307043($_smarty_tpl) { if (!is_callable('smarty_function_math')) { include 'E:\\Xampp\\htdocs\\pf_fshow_quickstart\\tools\\smarty\\plugins\\function.math.php'; } if ($_smarty_tpl->tpl_vars['ajax']->value) { ?> <script type="text/javascript"> $(function () { $(".ajax_table_link").click(function () { var link = $(this); $.post($(this).attr('href'), function (data) { if (data.success == 1) { showSuccessMessage(data.text); if (link.hasClass('action-disabled')){ link.removeClass('action-disabled').addClass('action-enabled'); } else { link.removeClass('action-enabled').addClass('action-disabled'); } link.children().each(function () { if ($(this).hasClass('hidden')) { $(this).removeClass('hidden'); } else { $(this).addClass('hidden'); } }); } else { showErrorMessage(data.text); } }, 'json'); return false; }); }); </script> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['is_order_position']->value) { ?> <script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script> <script type="text/javascript"> var come_from = '<?php echo addslashes($_smarty_tpl->tpl_vars['list_id']->value); ?> '; var alternate = <?php if ($_smarty_tpl->tpl_vars['order_way']->value == 'DESC') { ?> '1'<?php } else { ?> '0'<?php } ?> ; </script> <script type="text/javascript" src="../js/admin/dnd.js"></script> <?php } if (!$_smarty_tpl->tpl_vars['simple_header']->value) { ?> <script type="text/javascript"> $(function() { $('table.<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> .filter').keypress(function(e){ var key = (e.keyCode ? e.keyCode : e.which); if (key == 13) { e.preventDefault(); formSubmit(e, 'submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> '); } }) $('#submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').click(function() { $('#submitFilter<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').val(1); }); if ($("table .datepicker").length > 0) { $("table .datepicker").datepicker({ prevText: '', nextText: '', altFormat: 'yy-mm-dd' }); } }); </script> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['simple_header']->value) { ?> <div class="leadin"> </div> <?php } ?> <?php if (isset($_smarty_tpl->tpl_vars['backup_url']->value) && isset($_smarty_tpl->tpl_vars['backup_weight']->value)) { ?> <div class="panel"> <h3> <i class="icon-download"></i> <?php echo smartyTranslate(array('s' => 'Download'), $_smarty_tpl); ?> </h3> <p> <a class="btn btn-default" href="<?php echo $_smarty_tpl->tpl_vars['backup_url']->value; ?> "> <i class="icon-download"></i> <?php echo smartyTranslate(array('s' => 'Download the backup file (%s MB)', 'sprintf' => $_smarty_tpl->tpl_vars['backup_weight']->value), $_smarty_tpl); ?> </a> </p> <p><?php echo smartyTranslate(array('s' => 'Tip: You can also download this file from your FTP server. Backup files are located in the "/adminXXXX/backups" directory.'), $_smarty_tpl); ?> </p> </div> <?php } ?> <div class="alert alert-warning"> <button data-dismiss="alert" class="close" type="button">×</button> <h4><?php echo smartyTranslate(array('s' => 'Disclaimer before creating a new backup'), $_smarty_tpl); ?> </h4> <ol> <li><?php echo smartyTranslate(array('s' => 'PrestaShop is not responsible for your database, its backups and/or recovery.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'PrestaShop is open-source software. You are using it at your own risk under the license agreement.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'You should back up your data on a regular basis (both files and database).'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'This function only backs up your database, not your files.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'By default, your existing database tables will be dropped during the backup recovery (see "Backup options" below).'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Always verify the quality and integrity of your backup files!'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Always verify that your backup files are complete, up-to-date and valid, even if you had a success message appear during the backup process.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Always check your data.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Never restore a backup on a live site.'), $_smarty_tpl); ?> </li> </ol> <form action="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currentIndex']->value, ENT_QUOTES, 'UTF-8', true); ?> &add<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> &token=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true); ?> " method="post" class="form-horizontal"> <button type="submit" class="btn btn-default"> <i class="icon-save"></i> <?php echo smartyTranslate(array('s' => 'I have read the disclaimer. Please create a new backup.'), $_smarty_tpl); ?> </button> </form> </div> <?php if ($_smarty_tpl->tpl_vars['host_mode']->value) { ?> <div class="alert alert-info"> <h4><?php echo smartyTranslate(array('s' => 'How to restore a database backup'), $_smarty_tpl); ?> </h4> <?php echo smartyTranslate(array('s' => 'If you need to restore a database backup, we invite you to subscribe to a [1][2]technical support plan[/2][/1].', 'tags' => array('<strong>', '<a class="_blank" href="http://addons.prestashop.com/support/16298-support-essentiel-plan.html">')), $_smarty_tpl); ?> <br /> <?php echo smartyTranslate(array('s' => 'Our team will take care of restoring your database safely.'), $_smarty_tpl); ?> <br /> <br /> <?php echo smartyTranslate(array('s' => 'Why can\'t I restore it by myself?'), $_smarty_tpl); ?> <br /> <?php echo smartyTranslate(array('s' => 'Your shop is hosted by PrestaShop. Although you can create backup files here below, there are core settings you cannot access for security reasons, like the database management. Thus, only our team can proceed to a restoration.'), $_smarty_tpl); ?> </div> <?php } else { ?> <div class="alert alert-info"> <h4><?php echo smartyTranslate(array('s' => 'How to restore a database backup in 10 easy steps'), $_smarty_tpl); ?> </h4> <ol> <li><?php echo smartyTranslate(array('s' => 'Set "Enable Shop" to "No" in the "Maintenance" page under the "Preferences" menu.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Download the backup from the list below or from your FTP server (in the folder "admin/backups").'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Check the backup integrity: Look for errors, incomplete file, etc... Be sure to verify all of your data.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Please ask your hosting provider for "phpMyAdmin" access to your database.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Connect to "phpMyAdmin" and select your current database.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Unless you enabled the "Drop existing tables" option, you must delete all tables from your current database.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'At the top of the screen, please select the "Import" tab'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Click on the "Browse" button and select the backup file from your hard drive.'), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Check the maximum filesize allowed (e.g. Max: 16MB)'), $_smarty_tpl); ?> <br /><?php echo smartyTranslate(array('s' => 'If your backup file exceeds this limit, contact your hosting provider for assistance. '), $_smarty_tpl); ?> </li> <li><?php echo smartyTranslate(array('s' => 'Click on the "Go" button and please wait patiently for the import process to conclude. This may take several minutes.'), $_smarty_tpl); ?> </li> </ol> </div> <?php } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h' => 'displayAdminListBefore'), $_smarty_tpl); ?> <?php if (isset($_smarty_tpl->tpl_vars['name_controller']->value)) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array('hookName', 'hookName', null); ob_start(); ?> display<?php echo ucfirst($_smarty_tpl->tpl_vars['name_controller']->value); ?> ListBefore<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h' => $_smarty_tpl->tpl_vars['hookName']->value), $_smarty_tpl); ?> <?php } elseif (isset($_GET['controller'])) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array('hookName', 'hookName', null); ob_start(); ?> display<?php echo htmlentities(ucfirst($_GET['controller'])); ?> ListBefore<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h' => $_smarty_tpl->tpl_vars['hookName']->value), $_smarty_tpl); ?> <?php } ?> <div class="alert alert-warning" id="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> -empty-filters-alert" style="display:none;"><?php echo smartyTranslate(array('s' => 'Please fill at least one field to perform a search in this list.'), $_smarty_tpl); ?> </div> <?php if (isset($_smarty_tpl->tpl_vars['sql']->value) && $_smarty_tpl->tpl_vars['sql']->value) { ?> <form id="sql_form_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> " action="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getAdminLink('AdminRequestSql'), ENT_QUOTES, 'UTF-8', true); ?> &addrequest_sql" method="post" class="hide"> <input type="hidden" id="sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> " name="sql" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['sql']->value, ENT_QUOTES, 'UTF-8', true); ?> "/> <input type="hidden" id="sql_name_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> " name="name" value=""/> </form> <?php } ?> <form method="post" action="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['action']->value, ENT_QUOTES, 'UTF-8', true); ?> " class="form-horizontal clearfix" id="form-<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> "> <?php if (!$_smarty_tpl->tpl_vars['simple_header']->value) { ?> <input type="hidden" id="submitFilter<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " name="submitFilter<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " value="0"/> <input type="hidden" name="page" value="<?php echo intval($_smarty_tpl->tpl_vars['page']->value); ?> "/> <input type="hidden" name="selected_pagination" value="<?php echo intval($_smarty_tpl->tpl_vars['selected_pagination']->value); ?> "/> <div class="panel col-lg-12"> <div class="panel-heading"> <?php if (isset($_smarty_tpl->tpl_vars['icon']->value)) { ?> <i class="<?php echo $_smarty_tpl->tpl_vars['icon']->value; ?> "></i> <?php } if (is_array($_smarty_tpl->tpl_vars['title']->value)) { echo end($_smarty_tpl->tpl_vars['title']->value); } else { echo $_smarty_tpl->tpl_vars['title']->value; } ?> <?php if (isset($_smarty_tpl->tpl_vars['toolbar_btn']->value) && count($_smarty_tpl->tpl_vars['toolbar_btn']->value) > 0) { ?> <span class="badge"><?php echo $_smarty_tpl->tpl_vars['list_total']->value; ?> </span> <span class="panel-heading-action"> <?php $_smarty_tpl->tpl_vars['btn'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['btn']->_loop = false; $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['toolbar_btn']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['btn']->key => $_smarty_tpl->tpl_vars['btn']->value) { $_smarty_tpl->tpl_vars['btn']->_loop = true; $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['btn']->key; ?> <?php if ($_smarty_tpl->tpl_vars['k']->value != 'modules-list' && $_smarty_tpl->tpl_vars['k']->value != 'back') { ?> <a id="desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['imgclass'])) { echo $_smarty_tpl->tpl_vars['btn']->value['imgclass']; } else { echo $_smarty_tpl->tpl_vars['k']->value; } ?> " class="list-toolbar-btn<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['target']) && $_smarty_tpl->tpl_vars['btn']->value['target']) { ?> _blank<?php } ?> "<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['href'])) { ?> href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['btn']->value['href'], ENT_QUOTES, 'UTF-8', true); ?> "<?php } if (isset($_smarty_tpl->tpl_vars['btn']->value['js']) && $_smarty_tpl->tpl_vars['btn']->value['js']) { ?> onclick="<?php echo $_smarty_tpl->tpl_vars['btn']->value['js']; ?> "<?php } ?> > <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="<?php echo smartyTranslate(array('s' => $_smarty_tpl->tpl_vars['btn']->value['desc']), $_smarty_tpl); ?> " data-html="true" data-placement="top"> <i class="process-icon-<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['imgclass'])) { echo $_smarty_tpl->tpl_vars['btn']->value['imgclass']; } else { echo $_smarty_tpl->tpl_vars['k']->value; } if (isset($_smarty_tpl->tpl_vars['btn']->value['class'])) { ?> <?php echo $_smarty_tpl->tpl_vars['btn']->value['class']; } ?> "></i> </span> </a> <?php } ?> <?php } ?> <a class="list-toolbar-btn" href="javascript:location.reload();"> <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="<?php echo smartyTranslate(array('s' => 'Refresh list'), $_smarty_tpl); ?> " data-html="true" data-placement="top"> <i class="process-icon-refresh"></i> </span> </a> <?php if (isset($_smarty_tpl->tpl_vars['sql']->value) && $_smarty_tpl->tpl_vars['sql']->value) { ?> <?php $_smarty_tpl->tpl_vars['sql_manager'] = new Smarty_variable(Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql')), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['sql_manager']->value['view'] == 1) { ?> <a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('.leadin').first().append('<div class=\'alert alert-info\'>' + $('#sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val() + '</div>'); $(this).attr('onclick', '');"> <span class="label-tooltip" data-toggle="tooltip" data-original-title="<?php echo smartyTranslate(array('s' => 'Show SQL query'), $_smarty_tpl); ?> " data-html="true" data-placement="top" > <i class="process-icon-terminal"></i> </span> </a> <a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('#sql_name_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val(createSqlQueryName()); $('#sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val($('#sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val().replace(/\s+limit\s+[0-9,\s]+$/ig, '').trim()); $('#sql_form_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').submit();"> <span class="label-tooltip" data-toggle="tooltip" data-original-title="<?php echo smartyTranslate(array('s' => 'Export to SQL Manager'), $_smarty_tpl); ?> " data-html="true" data-placement="top" > <i class="process-icon-database"></i> </span> </a> <?php } ?> <?php } ?> </span> <?php } ?> </div> <?php if ($_smarty_tpl->tpl_vars['show_toolbar']->value) { ?> <script type="text/javascript"> //<![CDATA[ var submited = false; $(function() { //get reference on save link btn_save = $('i[class~="process-icon-save"]').parent(); //get reference on form submit button btn_submit = $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form_submit_btn'); if (btn_save.length > 0 && btn_submit.length > 0) { //get reference on save and stay link btn_save_and_stay = $('i[class~="process-icon-save-and-stay"]').parent(); //get reference on current save link label lbl_save = $('#desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -save div'); //override save link label with submit button value if (btn_submit.val().length > 0) { lbl_save.html(btn_submit.attr("value")); } if (btn_save_and_stay.length > 0) { //get reference on current save link label lbl_save_and_stay = $('#desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -save-and-stay div'); //override save and stay link label with submit button value if (btn_submit.val().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked')) { lbl_save_and_stay.html(btn_submit.val() + " <?php echo smartyTranslate(array('s' => 'and stay'), $_smarty_tpl); ?> "); } } //hide standard submit button btn_submit.hide(); //bind enter key press to validate form $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form').keypress(function (e) { if (e.which == 13 && e.target.localName != 'textarea') { $('#desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -save').click(); } }); //submit the form btn_save.click(function() { // Avoid double click if (submited) { return false; } submited = true; //add hidden input to emulate submit button click when posting the form -> field name posted btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />'); $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form').submit(); return false; }); if (btn_save_and_stay) { btn_save_and_stay.click(function() { //add hidden input to emulate submit button click when posting the form -> field name posted btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />'); $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form').submit(); return false; }); } } }); //]]> </script> <?php } } elseif ($_smarty_tpl->tpl_vars['simple_header']->value) { ?> <div class="panel col-lg-12"> <?php if (isset($_smarty_tpl->tpl_vars['title']->value)) { ?> <h3><?php if (isset($_smarty_tpl->tpl_vars['icon']->value)) { ?> <i class="<?php echo $_smarty_tpl->tpl_vars['icon']->value; ?> "></i> <?php } if (is_array($_smarty_tpl->tpl_vars['title']->value)) { echo end($_smarty_tpl->tpl_vars['title']->value); } else { echo $_smarty_tpl->tpl_vars['title']->value; } ?> </h3><?php } } ?> <?php if ($_smarty_tpl->tpl_vars['bulk_actions']->value && $_smarty_tpl->tpl_vars['has_bulk_actions']->value) { ?> <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(2, null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(1, null, 0); ?> <?php } ?> <style> @media (max-width: 992px) { <?php $_smarty_tpl->tpl_vars['param'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['param']->_loop = false; $_from = $_smarty_tpl->tpl_vars['fields_display']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['smarty']->value['foreach']['params']['index'] = -1; foreach ($_from as $_smarty_tpl->tpl_vars['param']->key => $_smarty_tpl->tpl_vars['param']->value) { $_smarty_tpl->tpl_vars['param']->_loop = true; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['params']['index']++; ?> .table-responsive-row td:nth-of-type(<?php echo smarty_function_math(array('equation' => "x+y", 'x' => $_smarty_tpl->getVariable('smarty')->value['foreach']['params']['index'], 'y' => $_smarty_tpl->tpl_vars['y']->value), $_smarty_tpl); ?> ):before { content: "<?php echo $_smarty_tpl->tpl_vars['param']->value['title']; ?> "; } <?php } ?> } </style> <div class="table-responsive-row clearfix<?php if (isset($_smarty_tpl->tpl_vars['use_overflow']->value) && $_smarty_tpl->tpl_vars['use_overflow']->value) { ?> overflow-y<?php } ?> "> <table<?php if ($_smarty_tpl->tpl_vars['table_id']->value) { ?> id="table-<?php echo $_smarty_tpl->tpl_vars['table_id']->value; ?> "<?php } ?> class="table<?php if ($_smarty_tpl->tpl_vars['table_dnd']->value) { ?> tableDnD<?php } ?> <?php echo $_smarty_tpl->tpl_vars['table']->value; ?> " > <thead> <tr class="nodrag nodrop"> <?php if ($_smarty_tpl->tpl_vars['bulk_actions']->value && $_smarty_tpl->tpl_vars['has_bulk_actions']->value) { ?> <th class="center fixed-width-xs"></th> <?php } ?> <?php $_smarty_tpl->tpl_vars['params'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['params']->_loop = false; $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['fields_display']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['params']->key => $_smarty_tpl->tpl_vars['params']->value) { $_smarty_tpl->tpl_vars['params']->_loop = true; $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['params']->key; ?> <th class="<?php if (isset($_smarty_tpl->tpl_vars['params']->value['class'])) { echo $_smarty_tpl->tpl_vars['params']->value['class']; } if (isset($_smarty_tpl->tpl_vars['params']->value['align'])) { ?> <?php echo $_smarty_tpl->tpl_vars['params']->value['align']; } ?> "> <span class="title_box<?php if (isset($_smarty_tpl->tpl_vars['order_by']->value) && $_smarty_tpl->tpl_vars['key']->value == $_smarty_tpl->tpl_vars['order_by']->value) { ?> active<?php } ?> "> <?php if (isset($_smarty_tpl->tpl_vars['params']->value['hint'])) { ?> <span class="label-tooltip" data-toggle="tooltip" title=" <?php if (is_array($_smarty_tpl->tpl_vars['params']->value['hint'])) { ?> <?php $_smarty_tpl->tpl_vars['hint'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['hint']->_loop = false; $_from = $_smarty_tpl->tpl_vars['params']->value['hint']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['hint']->key => $_smarty_tpl->tpl_vars['hint']->value) { $_smarty_tpl->tpl_vars['hint']->_loop = true; ?> <?php if (is_array($_smarty_tpl->tpl_vars['hint']->value)) { ?> <?php echo $_smarty_tpl->tpl_vars['hint']->value['text']; ?> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['hint']->value; ?> <?php } ?> <?php } ?> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['params']->value['hint']; ?> <?php } ?> "> <?php echo $_smarty_tpl->tpl_vars['params']->value['title']; ?> </span> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['params']->value['title']; ?> <?php } ?> <?php if ((!isset($_smarty_tpl->tpl_vars['params']->value['orderby']) || $_smarty_tpl->tpl_vars['params']->value['orderby']) && !$_smarty_tpl->tpl_vars['simple_header']->value && $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <a <?php if (isset($_smarty_tpl->tpl_vars['order_by']->value) && $_smarty_tpl->tpl_vars['key']->value == $_smarty_tpl->tpl_vars['order_by']->value && $_smarty_tpl->tpl_vars['order_way']->value == 'DESC') { ?> class="active"<?php } ?> href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currentIndex']->value, ENT_QUOTES, 'UTF-8', true); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderby=<?php echo urlencode($_smarty_tpl->tpl_vars['key']->value); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderway=desc&token=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true); if (isset($_GET[$_smarty_tpl->tpl_vars['identifier']->value])) { ?> &<?php echo $_smarty_tpl->tpl_vars['identifier']->value; ?> =<?php echo intval($_GET[$_smarty_tpl->tpl_vars['identifier']->value]); } ?> "> <i class="icon-caret-down"></i> </a> <a <?php if (isset($_smarty_tpl->tpl_vars['order_by']->value) && $_smarty_tpl->tpl_vars['key']->value == $_smarty_tpl->tpl_vars['order_by']->value && $_smarty_tpl->tpl_vars['order_way']->value == 'ASC') { ?> class="active"<?php } ?> href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currentIndex']->value, ENT_QUOTES, 'UTF-8', true); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderby=<?php echo urlencode($_smarty_tpl->tpl_vars['key']->value); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderway=asc&token=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true); if (isset($_GET[$_smarty_tpl->tpl_vars['identifier']->value])) { ?> &<?php echo $_smarty_tpl->tpl_vars['identifier']->value; ?> =<?php echo intval($_GET[$_smarty_tpl->tpl_vars['identifier']->value]); } ?> "> <i class="icon-caret-up"></i> </a> <?php } ?> </span> </th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['shop_link_type']->value) { ?> <th> <span class="title_box"> <?php if ($_smarty_tpl->tpl_vars['shop_link_type']->value == 'shop') { ?> <?php echo smartyTranslate(array('s' => 'Shop'), $_smarty_tpl); ?> <?php } else { ?> <?php echo smartyTranslate(array('s' => 'Shop group'), $_smarty_tpl); ?> <?php } ?> </span> </th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['has_actions']->value || $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <th><?php if (!$_smarty_tpl->tpl_vars['simple_header']->value) { } ?> </th> <?php } ?> </tr> <?php if (!$_smarty_tpl->tpl_vars['simple_header']->value && $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <tr class="nodrag nodrop filter <?php if ($_smarty_tpl->tpl_vars['row_hover']->value) { ?> row_hover<?php } ?> "> <?php if ($_smarty_tpl->tpl_vars['has_bulk_actions']->value) { ?> <th class="text-center"> -- </th> <?php } ?> <?php $_smarty_tpl->tpl_vars['params'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['params']->_loop = false; $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['fields_display']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['params']->key => $_smarty_tpl->tpl_vars['params']->value) { $_smarty_tpl->tpl_vars['params']->_loop = true; $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['params']->key; ?> <th <?php if (isset($_smarty_tpl->tpl_vars['params']->value['align'])) { ?> class="<?php echo $_smarty_tpl->tpl_vars['params']->value['align']; ?> " <?php } ?> > <?php if (isset($_smarty_tpl->tpl_vars['params']->value['search']) && !$_smarty_tpl->tpl_vars['params']->value['search']) { ?> -- <?php } else { ?> <?php if ($_smarty_tpl->tpl_vars['params']->value['type'] == 'bool') { ?> <select class="filter fixed-width-sm center" name="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Filter_<?php echo $_smarty_tpl->tpl_vars['key']->value; ?> "> <option value="">-</option> <option value="1" <?php if ($_smarty_tpl->tpl_vars['params']->value['value'] == 1) { ?> selected="selected" <?php } ?> ><?php echo smartyTranslate(array('s' => 'Yes'), $_smarty_tpl); ?> </option> <option value="0" <?php if ($_smarty_tpl->tpl_vars['params']->value['value'] == 0 && $_smarty_tpl->tpl_vars['params']->value['value'] != '') { ?> selected="selected" <?php } ?> ><?php echo smartyTranslate(array('s' => 'No'), $_smarty_tpl); ?> </option> </select> <?php } elseif ($_smarty_tpl->tpl_vars['params']->value['type'] == 'date' || $_smarty_tpl->tpl_vars['params']->value['type'] == 'datetime') { ?> <div class="date_range row"> <div class="input-group fixed-width-md center"> <input type="text" class="filter datepicker date-input form-control" id="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0" name="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [0]" placeholder="<?php echo smartyTranslate(array('s' => 'From'), $_smarty_tpl); ?> " /> <input type="hidden" id="<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0" name="<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [0]" value="<?php if (isset($_smarty_tpl->tpl_vars['params']->value['value'][0])) { echo $_smarty_tpl->tpl_vars['params']->value['value'][0]; } ?> "> <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div> <div class="input-group fixed-width-md center"> <input type="text" class="filter datepicker date-input form-control" id="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1" name="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [1]" placeholder="<?php echo smartyTranslate(array('s' => 'To'), $_smarty_tpl); ?> " /> <input type="hidden" id="<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1" name="<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [1]" value="<?php if (isset($_smarty_tpl->tpl_vars['params']->value['value'][1])) { echo $_smarty_tpl->tpl_vars['params']->value['value'][1]; } ?> "> <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div> <script> $(function() { var dateStart = parseDate($("#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0").val()); var dateEnd = parseDate($("#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1").val()); $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0").datepicker("option", "altField", "#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0"); $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1").datepicker("option", "altField", "#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1"); if (dateStart !== null){ $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0").datepicker("setDate", dateStart); } if (dateEnd !== null){ $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1").datepicker("setDate", dateEnd); } }); </script> </div> <?php } elseif ($_smarty_tpl->tpl_vars['params']->value['type'] == 'select') { ?> <?php if (isset($_smarty_tpl->tpl_vars['params']->value['filter_key'])) { ?> <select class="filter center" onchange="$('#submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').focus();$('#submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').click();" name="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Filter_<?php echo $_smarty_tpl->tpl_vars['params']->value['filter_key']; ?> " <?php if (isset($_smarty_tpl->tpl_vars['params']->value['width'])) { ?> style="width:<?php echo $_smarty_tpl->tpl_vars['params']->value['width']; ?> px"<?php } ?> > <option value="" <?php if ($_smarty_tpl->tpl_vars['params']->value['value'] == '') { ?> selected="selected" <?php } ?> >-</option> <?php if (isset($_smarty_tpl->tpl_vars['params']->value['list']) && is_array($_smarty_tpl->tpl_vars['params']->value['list'])) { ?> <?php $_smarty_tpl->tpl_vars['option_display'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['option_display']->_loop = false; $_smarty_tpl->tpl_vars['option_value'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['params']->value['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['option_display']->key => $_smarty_tpl->tpl_vars['option_display']->value) { $_smarty_tpl->tpl_vars['option_display']->_loop = true; $_smarty_tpl->tpl_vars['option_value']->value = $_smarty_tpl->tpl_vars['option_display']->key; ?> <option value="<?php echo $_smarty_tpl->tpl_vars['option_value']->value; ?> " <?php if ((string) $_smarty_tpl->tpl_vars['option_display']->value === (string) $_smarty_tpl->tpl_vars['params']->value['value'] || (string) $_smarty_tpl->tpl_vars['option_value']->value === (string) $_smarty_tpl->tpl_vars['params']->value['value']) { ?> selected="selected"<?php } ?> ><?php echo $_smarty_tpl->tpl_vars['option_display']->value; ?> </option> <?php } ?> <?php } ?> </select> <?php } ?> <?php } else { ?> <input type="text" class="filter" name="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Filter_<?php if (isset($_smarty_tpl->tpl_vars['params']->value['filter_key'])) { echo $_smarty_tpl->tpl_vars['params']->value['filter_key']; } else { echo $_smarty_tpl->tpl_vars['key']->value; } ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['params']->value['value'], ENT_QUOTES, 'UTF-8', true); ?> " <?php if (isset($_smarty_tpl->tpl_vars['params']->value['width']) && $_smarty_tpl->tpl_vars['params']->value['width'] != 'auto') { ?> style="width:<?php echo $_smarty_tpl->tpl_vars['params']->value['width']; ?> px"<?php } ?> /> <?php } ?> <?php } ?> </th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['shop_link_type']->value) { ?> <th>--</th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['has_actions']->value || $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <th class="actions"> <?php if ($_smarty_tpl->tpl_vars['show_filters']->value) { ?> <span class="pull-right"> <button type="submit" id="submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " name="submitFilter" class="btn btn-default" data-list-id="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> "> <i class="icon-search"></i> <?php echo smartyTranslate(array('s' => 'Search'), $_smarty_tpl); ?> </button> <?php if ($_smarty_tpl->tpl_vars['filters_has_value']->value) { ?> <button type="submit" name="submitReset<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " class="btn btn-warning"> <i class="icon-eraser"></i> <?php echo smartyTranslate(array('s' => 'Reset'), $_smarty_tpl); ?> </button> <?php } ?> </span> <?php } ?> </th> <?php } ?> </tr> <?php } ?> </thead> <?php }
protected function getModulesByInstallation($tab_modules_list = null) { $all_modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee); $all_unik_modules = array(); $modules_list = array('installed' => array(), 'not_installed' => array()); foreach ($all_modules as $mod) { if (!isset($all_unik_modules[$mod->name])) { $all_unik_modules[$mod->name] = $mod; } } $all_modules = $all_unik_modules; foreach ($all_modules as $module) { if (!isset($tab_modules_list) || in_array($module->name, $tab_modules_list)) { $perm = true; if ($module->id) { $perm &= Module::getPermissionStatic($module->id, 'configure'); } else { $id_admin_module = Tab::getIdFromClassName('AdminModules'); $access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module); if (!$access['edit']) { $perm &= false; } } if (in_array($module->name, $this->list_partners_modules)) { $module->type = 'addonsPartner'; } if ($perm) { $this->fillModuleData($module, 'array'); if ($module->id) { $modules_list['installed'][] = $module; } else { $modules_list['not_installed'][] = $module; } } } } return $modules_list; }
public function ajaxProcessGetTabModulesList() { $tab_modules_list = Tools::getValue('tab_modules_list'); $back = Tools::getValue('back_tab_modules_list'); if ($back) { $back .= '&tab_modules_open=1'; } $modules_list = array('installed' => array(), 'not_installed' => array()); if ($tab_modules_list) { $tab_modules_list = explode(',', $tab_modules_list); $all_modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee); foreach ($all_modules as $module) { if (in_array($module->name, $tab_modules_list)) { $perm = true; if ($module->id) { $perm &= Module::getPermissionStatic($module->id, 'configure'); } else { $id_admin_module = Tab::getIdFromClassName('AdminModules'); $access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module); if (!$access['edit']) { $perm &= false; } } if ($perm) { $this->fillModuleData($module, 'select', $back); if ($module->id) { $modules_list['installed'][] = $module; } else { $modules_list['not_installed'][] = $module; } } } } } $this->context->smarty->assign(array('tab_modules_list' => $modules_list, 'admin_module_favorites_view' => $this->context->link->getAdminLink('AdminModules') . '&select=favorites')); $this->smartyOutputContent('controllers/modules/tab_modules_list.tpl'); exit; }
* @author PrestaShop SA <*****@*****.**> * @copyright 2007-2012 PrestaShop SA * @version Release: $Revision: 14002 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ define('_PS_ADMIN_DIR_', getcwd()); define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility include PS_ADMIN_DIR . '/../config/config.inc.php'; /* Header can't be included, so cookie must be created here */ $cookie = new Cookie('psAdmin'); if (!$cookie->id_employee) { Tools::redirectAdmin('login.php'); } $tabAccess = Profile::getProfileAccess($cookie->profile, Tab::getIdFromClassName('AdminBackup')); if ($tabAccess['view'] !== '1') { die(Tools::displayError('You do not have permission to view here')); } $backupdir = realpath(PS_ADMIN_DIR . '/backups/'); if ($backupdir === false) { die(Tools::displayError('Backups directory does not exist.')); } if (!($backupfile = Tools::getValue('filename'))) { die(Tools::displayError('No file specified')); } // Check the realpath so we can validate the backup file is under the backup directory $backupfile = realpath($backupdir . '/' . $backupfile); if ($backupfile === false or strncmp($backupdir, $backupfile, strlen($backupdir)) != 0) { die(Tools::displayError()); }
function content_560e78bd1c1472_67526002($_smarty_tpl) { if (!is_callable('smarty_function_math')) { include '/home/oobox/domains/oobox.stronazen.pl/public_html/xiaomipl/tools/smarty/plugins/function.math.php'; } if ($_smarty_tpl->tpl_vars['ajax']->value) { ?> <script type="text/javascript"> $(function () { $(".ajax_table_link").click(function () { var link = $(this); $.post($(this).attr('href'), function (data) { if (data.success == 1) { showSuccessMessage(data.text); if (link.hasClass('action-disabled')){ link.removeClass('action-disabled').addClass('action-enabled'); } else { link.removeClass('action-enabled').addClass('action-disabled'); } link.children().each(function () { if ($(this).hasClass('hidden')) { $(this).removeClass('hidden'); } else { $(this).addClass('hidden'); } }); } else { showErrorMessage(data.text); } }, 'json'); return false; }); }); </script> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['is_order_position']->value) { ?> <script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script> <script type="text/javascript"> var come_from = '<?php echo addslashes($_smarty_tpl->tpl_vars['list_id']->value); ?> '; var alternate = <?php if ($_smarty_tpl->tpl_vars['order_way']->value == 'DESC') { ?> '1'<?php } else { ?> '0'<?php } ?> ; </script> <script type="text/javascript" src="../js/admin/dnd.js"></script> <?php } if (!$_smarty_tpl->tpl_vars['simple_header']->value) { ?> <script type="text/javascript"> $(function() { $('table.<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> .filter').keypress(function(e){ var key = (e.keyCode ? e.keyCode : e.which); if (key == 13) { e.preventDefault(); formSubmit(e, 'submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> '); } }) $('#submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').click(function() { $('#submitFilter<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').val(1); }); if ($("table .datepicker").length > 0) { $("table .datepicker").datepicker({ prevText: '', nextText: '', altFormat: 'yy-mm-dd' }); } }); </script> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['simple_header']->value) { ?> <div class="leadin"> </div> <?php } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h' => 'displayAdminListBefore'), $_smarty_tpl); ?> <?php if (isset($_smarty_tpl->tpl_vars['name_controller']->value)) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array('hookName', 'hookName', null); ob_start(); ?> display<?php echo ucfirst($_smarty_tpl->tpl_vars['name_controller']->value); ?> ListBefore<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h' => $_smarty_tpl->tpl_vars['hookName']->value), $_smarty_tpl); ?> <?php } elseif (isset($_GET['controller'])) { ?> <?php $_smarty_tpl->_capture_stack[0][] = array('hookName', 'hookName', null); ob_start(); ?> display<?php echo htmlentities(ucfirst($_GET['controller'])); ?> ListBefore<?php list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]); if (!empty($_capture_buffer)) { if (isset($_capture_assign)) { $_smarty_tpl->assign($_capture_assign, ob_get_contents()); } if (isset($_capture_append)) { $_smarty_tpl->append($_capture_append, ob_get_contents()); } Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean(); } else { $_smarty_tpl->capture_error(); } ?> <?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0][0]->smartyHook(array('h' => $_smarty_tpl->tpl_vars['hookName']->value), $_smarty_tpl); ?> <?php } ?> <div class="alert alert-warning" id="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> -empty-filters-alert" style="display:none;"><?php echo smartyTranslate(array('s' => 'Please fill at least one field to perform a search in this list.'), $_smarty_tpl); ?> </div> <?php if (isset($_smarty_tpl->tpl_vars['sql']->value) && $_smarty_tpl->tpl_vars['sql']->value) { ?> <form id="sql_form_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> " action="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getAdminLink('AdminRequestSql'), ENT_QUOTES, 'UTF-8', true); ?> &addrequest_sql" method="post" class="hide"> <input type="hidden" id="sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> " name="sql" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['sql']->value, ENT_QUOTES, 'UTF-8', true); ?> "/> <input type="hidden" id="sql_name_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> " name="name" value=""/> </form> <?php } ?> <?php if (!$_smarty_tpl->tpl_vars['simple_header']->value) { ?> <input type="hidden" id="submitFilter<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " name="submitFilter<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " value="0"/> <input type="hidden" name="page" value="<?php echo intval($_smarty_tpl->tpl_vars['page']->value); ?> "/> <input type="hidden" name="selected_pagination" value="<?php echo intval($_smarty_tpl->tpl_vars['selected_pagination']->value); ?> "/> <div class="panel col-lg-12"> <div class="panel-heading"> <?php if (isset($_smarty_tpl->tpl_vars['icon']->value)) { ?> <i class="<?php echo $_smarty_tpl->tpl_vars['icon']->value; ?> "></i> <?php } if (is_array($_smarty_tpl->tpl_vars['title']->value)) { echo end($_smarty_tpl->tpl_vars['title']->value); } else { echo $_smarty_tpl->tpl_vars['title']->value; } ?> <?php if (isset($_smarty_tpl->tpl_vars['toolbar_btn']->value) && count($_smarty_tpl->tpl_vars['toolbar_btn']->value) > 0) { ?> <span class="badge"><?php echo $_smarty_tpl->tpl_vars['list_total']->value; ?> </span> <span class="panel-heading-action"> <?php $_smarty_tpl->tpl_vars['btn'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['btn']->_loop = false; $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['toolbar_btn']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['btn']->key => $_smarty_tpl->tpl_vars['btn']->value) { $_smarty_tpl->tpl_vars['btn']->_loop = true; $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['btn']->key; ?> <?php if ($_smarty_tpl->tpl_vars['k']->value != 'modules-list' && $_smarty_tpl->tpl_vars['k']->value != 'back') { ?> <a id="desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['imgclass'])) { echo $_smarty_tpl->tpl_vars['btn']->value['imgclass']; } else { echo $_smarty_tpl->tpl_vars['k']->value; } ?> " class="list-toolbar-btn<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['target']) && $_smarty_tpl->tpl_vars['btn']->value['target']) { ?> _blank<?php } ?> "<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['href'])) { ?> href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['btn']->value['href'], ENT_QUOTES, 'UTF-8', true); ?> "<?php } if (isset($_smarty_tpl->tpl_vars['btn']->value['js']) && $_smarty_tpl->tpl_vars['btn']->value['js']) { ?> onclick="<?php echo $_smarty_tpl->tpl_vars['btn']->value['js']; ?> "<?php } ?> > <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="<?php echo smartyTranslate(array('s' => $_smarty_tpl->tpl_vars['btn']->value['desc']), $_smarty_tpl); ?> " data-html="true" data-placement="top"> <i class="process-icon-<?php if (isset($_smarty_tpl->tpl_vars['btn']->value['imgclass'])) { echo $_smarty_tpl->tpl_vars['btn']->value['imgclass']; } else { echo $_smarty_tpl->tpl_vars['k']->value; } if (isset($_smarty_tpl->tpl_vars['btn']->value['class'])) { ?> <?php echo $_smarty_tpl->tpl_vars['btn']->value['class']; } ?> "></i> </span> </a> <?php } ?> <?php } ?> <a class="list-toolbar-btn" href="javascript:location.reload();"> <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="<?php echo smartyTranslate(array('s' => 'Refresh list'), $_smarty_tpl); ?> " data-html="true" data-placement="top"> <i class="process-icon-refresh"></i> </span> </a> <?php if (isset($_smarty_tpl->tpl_vars['sql']->value) && $_smarty_tpl->tpl_vars['sql']->value) { ?> <?php $_smarty_tpl->tpl_vars['sql_manager'] = new Smarty_variable(Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql')), null, 0); ?> <?php if ($_smarty_tpl->tpl_vars['sql_manager']->value['view'] == 1) { ?> <a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('.leadin').first().append('<div class=\'alert alert-info\'>' + $('#sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val() + '</div>'); $(this).attr('onclick', '');"> <span class="label-tooltip" data-toggle="tooltip" data-original-title="<?php echo smartyTranslate(array('s' => 'Show SQL query'), $_smarty_tpl); ?> " data-html="true" data-placement="top" > <i class="process-icon-terminal"></i> </span> </a> <a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('#sql_name_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val(createSqlQueryName()); $('#sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val($('#sql_query_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').val().replace(/\s+limit\s+[0-9,\s]+$/ig, '').trim()); $('#sql_form_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true); ?> ').submit();"> <span class="label-tooltip" data-toggle="tooltip" data-original-title="<?php echo smartyTranslate(array('s' => 'Export to SQL Manager'), $_smarty_tpl); ?> " data-html="true" data-placement="top" > <i class="process-icon-database"></i> </span> </a> <?php } ?> <?php } ?> </span> <?php } ?> </div> <?php if ($_smarty_tpl->tpl_vars['show_toolbar']->value) { ?> <script type="text/javascript"> //<![CDATA[ var submited = false; $(function() { //get reference on save link btn_save = $('i[class~="process-icon-save"]').parent(); //get reference on form submit button btn_submit = $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form_submit_btn'); if (btn_save.length > 0 && btn_submit.length > 0) { //get reference on save and stay link btn_save_and_stay = $('i[class~="process-icon-save-and-stay"]').parent(); //get reference on current save link label lbl_save = $('#desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -save div'); //override save link label with submit button value if (btn_submit.val().length > 0) { lbl_save.html(btn_submit.attr("value")); } if (btn_save_and_stay.length > 0) { //get reference on current save link label lbl_save_and_stay = $('#desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -save-and-stay div'); //override save and stay link label with submit button value if (btn_submit.val().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked')) { lbl_save_and_stay.html(btn_submit.val() + " <?php echo smartyTranslate(array('s' => 'and stay'), $_smarty_tpl); ?> "); } } //hide standard submit button btn_submit.hide(); //bind enter key press to validate form $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form').keypress(function (e) { if (e.which == 13 && e.target.localName != 'textarea') { $('#desc-<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> -save').click(); } }); //submit the form btn_save.click(function() { // Avoid double click if (submited) { return false; } submited = true; //add hidden input to emulate submit button click when posting the form -> field name posted btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />'); $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form').submit(); return false; }); if (btn_save_and_stay) { btn_save_and_stay.click(function() { //add hidden input to emulate submit button click when posting the form -> field name posted btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />'); $('#<?php echo $_smarty_tpl->tpl_vars['table']->value; ?> _form').submit(); return false; }); } } }); //]]> </script> <?php } } elseif ($_smarty_tpl->tpl_vars['simple_header']->value) { ?> <div class="panel col-lg-12"> <?php if (isset($_smarty_tpl->tpl_vars['title']->value)) { ?> <h3><?php if (isset($_smarty_tpl->tpl_vars['icon']->value)) { ?> <i class="<?php echo $_smarty_tpl->tpl_vars['icon']->value; ?> "></i> <?php } if (is_array($_smarty_tpl->tpl_vars['title']->value)) { echo end($_smarty_tpl->tpl_vars['title']->value); } else { echo $_smarty_tpl->tpl_vars['title']->value; } ?> </h3><?php } } ?> <?php if ($_smarty_tpl->tpl_vars['bulk_actions']->value && $_smarty_tpl->tpl_vars['has_bulk_actions']->value) { ?> <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(2, null, 0); ?> <?php } else { ?> <?php $_smarty_tpl->tpl_vars['y'] = new Smarty_variable(1, null, 0); ?> <?php } ?> <style> @media (max-width: 992px) { <?php $_smarty_tpl->tpl_vars['param'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['param']->_loop = false; $_from = $_smarty_tpl->tpl_vars['fields_display']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['smarty']->value['foreach']['params']['index'] = -1; foreach ($_from as $_smarty_tpl->tpl_vars['param']->key => $_smarty_tpl->tpl_vars['param']->value) { $_smarty_tpl->tpl_vars['param']->_loop = true; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['params']['index']++; ?> .table-responsive-row td:nth-of-type(<?php echo smarty_function_math(array('equation' => "x+y", 'x' => $_smarty_tpl->getVariable('smarty')->value['foreach']['params']['index'], 'y' => $_smarty_tpl->tpl_vars['y']->value), $_smarty_tpl); ?> ):before { content: "<?php echo $_smarty_tpl->tpl_vars['param']->value['title']; ?> "; } <?php } ?> } </style> <div class="table-responsive-row clearfix<?php if (isset($_smarty_tpl->tpl_vars['use_overflow']->value) && $_smarty_tpl->tpl_vars['use_overflow']->value) { ?> overflow-y<?php } ?> "> <table<?php if ($_smarty_tpl->tpl_vars['table_id']->value) { ?> id="table-<?php echo $_smarty_tpl->tpl_vars['table_id']->value; ?> "<?php } ?> class="table<?php if ($_smarty_tpl->tpl_vars['table_dnd']->value) { ?> tableDnD<?php } ?> <?php echo $_smarty_tpl->tpl_vars['table']->value; ?> " > <thead> <tr class="nodrag nodrop"> <?php if ($_smarty_tpl->tpl_vars['bulk_actions']->value && $_smarty_tpl->tpl_vars['has_bulk_actions']->value) { ?> <th class="center fixed-width-xs"></th> <?php } ?> <?php $_smarty_tpl->tpl_vars['params'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['params']->_loop = false; $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['fields_display']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['params']->key => $_smarty_tpl->tpl_vars['params']->value) { $_smarty_tpl->tpl_vars['params']->_loop = true; $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['params']->key; ?> <th class="<?php if (isset($_smarty_tpl->tpl_vars['params']->value['class'])) { echo $_smarty_tpl->tpl_vars['params']->value['class']; } if (isset($_smarty_tpl->tpl_vars['params']->value['align'])) { ?> <?php echo $_smarty_tpl->tpl_vars['params']->value['align']; } ?> "> <span class="title_box<?php if (isset($_smarty_tpl->tpl_vars['order_by']->value) && $_smarty_tpl->tpl_vars['key']->value == $_smarty_tpl->tpl_vars['order_by']->value) { ?> active<?php } ?> "> <?php if (isset($_smarty_tpl->tpl_vars['params']->value['hint'])) { ?> <span class="label-tooltip" data-toggle="tooltip" title=" <?php if (is_array($_smarty_tpl->tpl_vars['params']->value['hint'])) { ?> <?php $_smarty_tpl->tpl_vars['hint'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['hint']->_loop = false; $_from = $_smarty_tpl->tpl_vars['params']->value['hint']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['hint']->key => $_smarty_tpl->tpl_vars['hint']->value) { $_smarty_tpl->tpl_vars['hint']->_loop = true; ?> <?php if (is_array($_smarty_tpl->tpl_vars['hint']->value)) { ?> <?php echo $_smarty_tpl->tpl_vars['hint']->value['text']; ?> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['hint']->value; ?> <?php } ?> <?php } ?> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['params']->value['hint']; ?> <?php } ?> "> <?php echo $_smarty_tpl->tpl_vars['params']->value['title']; ?> </span> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['params']->value['title']; ?> <?php } ?> <?php if ((!isset($_smarty_tpl->tpl_vars['params']->value['orderby']) || $_smarty_tpl->tpl_vars['params']->value['orderby']) && !$_smarty_tpl->tpl_vars['simple_header']->value && $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <a <?php if (isset($_smarty_tpl->tpl_vars['order_by']->value) && $_smarty_tpl->tpl_vars['key']->value == $_smarty_tpl->tpl_vars['order_by']->value && $_smarty_tpl->tpl_vars['order_way']->value == 'DESC') { ?> class="active"<?php } ?> href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currentIndex']->value, ENT_QUOTES, 'UTF-8', true); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderby=<?php echo urlencode($_smarty_tpl->tpl_vars['key']->value); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderway=desc&token=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true); if (isset($_GET[$_smarty_tpl->tpl_vars['identifier']->value])) { ?> &<?php echo $_smarty_tpl->tpl_vars['identifier']->value; ?> =<?php echo intval($_GET[$_smarty_tpl->tpl_vars['identifier']->value]); } ?> "> <i class="icon-caret-down"></i> </a> <a <?php if (isset($_smarty_tpl->tpl_vars['order_by']->value) && $_smarty_tpl->tpl_vars['key']->value == $_smarty_tpl->tpl_vars['order_by']->value && $_smarty_tpl->tpl_vars['order_way']->value == 'ASC') { ?> class="active"<?php } ?> href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['currentIndex']->value, ENT_QUOTES, 'UTF-8', true); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderby=<?php echo urlencode($_smarty_tpl->tpl_vars['key']->value); ?> &<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Orderway=asc&token=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true); if (isset($_GET[$_smarty_tpl->tpl_vars['identifier']->value])) { ?> &<?php echo $_smarty_tpl->tpl_vars['identifier']->value; ?> =<?php echo intval($_GET[$_smarty_tpl->tpl_vars['identifier']->value]); } ?> "> <i class="icon-caret-up"></i> </a> <?php } ?> </span> </th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['shop_link_type']->value) { ?> <th> <span class="title_box"> <?php if ($_smarty_tpl->tpl_vars['shop_link_type']->value == 'shop') { ?> <?php echo smartyTranslate(array('s' => 'Shop'), $_smarty_tpl); ?> <?php } else { ?> <?php echo smartyTranslate(array('s' => 'Shop group'), $_smarty_tpl); ?> <?php } ?> </span> </th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['has_actions']->value || $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <th><?php if (!$_smarty_tpl->tpl_vars['simple_header']->value) { } ?> </th> <?php } ?> </tr> <?php if (!$_smarty_tpl->tpl_vars['simple_header']->value && $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <tr class="nodrag nodrop filter <?php if ($_smarty_tpl->tpl_vars['row_hover']->value) { ?> row_hover<?php } ?> "> <?php if ($_smarty_tpl->tpl_vars['has_bulk_actions']->value) { ?> <th class="text-center"> -- </th> <?php } ?> <?php $_smarty_tpl->tpl_vars['params'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['params']->_loop = false; $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['fields_display']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['params']->key => $_smarty_tpl->tpl_vars['params']->value) { $_smarty_tpl->tpl_vars['params']->_loop = true; $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['params']->key; ?> <th <?php if (isset($_smarty_tpl->tpl_vars['params']->value['align'])) { ?> class="<?php echo $_smarty_tpl->tpl_vars['params']->value['align']; ?> " <?php } ?> > <?php if (isset($_smarty_tpl->tpl_vars['params']->value['search']) && !$_smarty_tpl->tpl_vars['params']->value['search']) { ?> -- <?php } else { ?> <?php if ($_smarty_tpl->tpl_vars['params']->value['type'] == 'bool') { ?> <select class="filter fixed-width-sm center" name="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Filter_<?php echo $_smarty_tpl->tpl_vars['key']->value; ?> "> <option value="">-</option> <option value="1" <?php if ($_smarty_tpl->tpl_vars['params']->value['value'] == 1) { ?> selected="selected" <?php } ?> ><?php echo smartyTranslate(array('s' => 'Yes'), $_smarty_tpl); ?> </option> <option value="0" <?php if ($_smarty_tpl->tpl_vars['params']->value['value'] == 0 && $_smarty_tpl->tpl_vars['params']->value['value'] != '') { ?> selected="selected" <?php } ?> ><?php echo smartyTranslate(array('s' => 'No'), $_smarty_tpl); ?> </option> </select> <?php } elseif ($_smarty_tpl->tpl_vars['params']->value['type'] == 'date' || $_smarty_tpl->tpl_vars['params']->value['type'] == 'datetime') { ?> <div class="date_range row"> <div class="input-group fixed-width-md center"> <input type="text" class="filter datepicker date-input form-control" id="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0" name="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [0]" placeholder="<?php echo smartyTranslate(array('s' => 'From'), $_smarty_tpl); ?> " /> <input type="hidden" id="<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0" name="<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [0]" value="<?php if (isset($_smarty_tpl->tpl_vars['params']->value['value'][0])) { echo $_smarty_tpl->tpl_vars['params']->value['value'][0]; } ?> "> <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div> <div class="input-group fixed-width-md center"> <input type="text" class="filter datepicker date-input form-control" id="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1" name="local_<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [1]" placeholder="<?php echo smartyTranslate(array('s' => 'To'), $_smarty_tpl); ?> " /> <input type="hidden" id="<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1" name="<?php echo $_smarty_tpl->tpl_vars['params']->value['name_date']; ?> [1]" value="<?php if (isset($_smarty_tpl->tpl_vars['params']->value['value'][1])) { echo $_smarty_tpl->tpl_vars['params']->value['value'][1]; } ?> "> <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div> <script> $(function() { var dateStart = parseDate($("#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0").val()); var dateEnd = parseDate($("#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1").val()); $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0").datepicker("option", "altField", "#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0"); $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1").datepicker("option", "altField", "#<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1"); if (dateStart !== null){ $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _0").datepicker("setDate", dateStart); } if (dateEnd !== null){ $("#local_<?php echo $_smarty_tpl->tpl_vars['params']->value['id_date']; ?> _1").datepicker("setDate", dateEnd); } }); </script> </div> <?php } elseif ($_smarty_tpl->tpl_vars['params']->value['type'] == 'select') { ?> <?php if (isset($_smarty_tpl->tpl_vars['params']->value['filter_key'])) { ?> <select class="filter center" onchange="$('#submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').focus();$('#submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> ').click();" name="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Filter_<?php echo $_smarty_tpl->tpl_vars['params']->value['filter_key']; ?> " <?php if (isset($_smarty_tpl->tpl_vars['params']->value['width'])) { ?> style="width:<?php echo $_smarty_tpl->tpl_vars['params']->value['width']; ?> px"<?php } ?> > <option value="" <?php if ($_smarty_tpl->tpl_vars['params']->value['value'] == '') { ?> selected="selected" <?php } ?> >-</option> <?php if (isset($_smarty_tpl->tpl_vars['params']->value['list']) && is_array($_smarty_tpl->tpl_vars['params']->value['list'])) { ?> <?php $_smarty_tpl->tpl_vars['option_display'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['option_display']->_loop = false; $_smarty_tpl->tpl_vars['option_value'] = new Smarty_Variable(); $_from = $_smarty_tpl->tpl_vars['params']->value['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } foreach ($_from as $_smarty_tpl->tpl_vars['option_display']->key => $_smarty_tpl->tpl_vars['option_display']->value) { $_smarty_tpl->tpl_vars['option_display']->_loop = true; $_smarty_tpl->tpl_vars['option_value']->value = $_smarty_tpl->tpl_vars['option_display']->key; ?> <option value="<?php echo $_smarty_tpl->tpl_vars['option_value']->value; ?> " <?php if ((string) $_smarty_tpl->tpl_vars['option_display']->value === (string) $_smarty_tpl->tpl_vars['params']->value['value'] || (string) $_smarty_tpl->tpl_vars['option_value']->value === (string) $_smarty_tpl->tpl_vars['params']->value['value']) { ?> selected="selected"<?php } ?> ><?php echo $_smarty_tpl->tpl_vars['option_display']->value; ?> </option> <?php } ?> <?php } ?> </select> <?php } ?> <?php } else { ?> <input type="text" class="filter" name="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> Filter_<?php if (isset($_smarty_tpl->tpl_vars['params']->value['filter_key'])) { echo $_smarty_tpl->tpl_vars['params']->value['filter_key']; } else { echo $_smarty_tpl->tpl_vars['key']->value; } ?> " value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['params']->value['value'], ENT_QUOTES, 'UTF-8', true); ?> " <?php if (isset($_smarty_tpl->tpl_vars['params']->value['width']) && $_smarty_tpl->tpl_vars['params']->value['width'] != 'auto') { ?> style="width:<?php echo $_smarty_tpl->tpl_vars['params']->value['width']; ?> px"<?php } ?> /> <?php } ?> <?php } ?> </th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['shop_link_type']->value) { ?> <th>--</th> <?php } ?> <?php if ($_smarty_tpl->tpl_vars['has_actions']->value || $_smarty_tpl->tpl_vars['show_filters']->value) { ?> <th class="actions"> <?php if ($_smarty_tpl->tpl_vars['show_filters']->value) { ?> <span class="pull-right"> <button type="submit" id="submitFilterButton<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " name="submitFilter" class="btn btn-default" data-list-id="<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> "> <i class="icon-search"></i> <?php echo smartyTranslate(array('s' => 'Search'), $_smarty_tpl); ?> </button> <?php if ($_smarty_tpl->tpl_vars['filters_has_value']->value) { ?> <button type="submit" name="submitReset<?php echo $_smarty_tpl->tpl_vars['list_id']->value; ?> " class="btn btn-warning"> <i class="icon-eraser"></i> <?php echo smartyTranslate(array('s' => 'Reset'), $_smarty_tpl); ?> </button> <?php } ?> </span> <?php } ?> </th> <?php } ?> </tr> <?php } ?> </thead> <?php }
public function postProcess() { $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id); if (Tools::isSubmit('submitAdd' . $this->table)) { $this->action = 'save'; if ($id_cms_category = (int) Tools::getValue('id_cms_category')) { $this->id_object = $id_cms_category; if (!CMSCategory::checkBeforeMove($id_cms_category, (int) Tools::getValue('id_parent'))) { $this->errors[] = Tools::displayError('The CMS Category cannot be moved here.'); return false; } } $object = parent::postProcess(); $this->updateAssoShop((int) Tools::getValue('id_cms_category')); if ($object !== false) { Tools::redirectAdmin(self::$currentIndex . '&conf=3&id_cms_category=' . (int) $object->id . '&token=' . Tools::getValue('token')); } return $object; } elseif (Tools::isSubmit('statuscms_category') && Tools::getValue($this->identifier)) { if ($this->tabAccess['edit'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) { $identifier = (int) $object->id_parent ? '&id_cms_category=' . (int) $object->id_parent : ''; Tools::redirectAdmin(self::$currentIndex . '&conf=5' . $identifier . '&token=' . Tools::getValue('token')); } else { $this->errors[] = Tools::displayError('An error occurred while updating the status.'); } } else { $this->errors[] = Tools::displayError('An error occurred while updating the status for an object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } } elseif (Tools::isSubmit('delete' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject()) && isset($this->fieldImageSettings)) { // check if request at least one object with noZeroObject if (isset($object->noZeroObject) && count($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1) { $this->errors[] = Tools::displayError('You need at least one object.') . ' <b>' . $this->table . '</b><br />' . Tools::displayError('You cannot delete all of the items.'); } else { $identifier = (int) $object->id_parent ? '&' . $this->identifier . '=' . (int) $object->id_parent : ''; if ($this->deleted) { $object->deleted = 1; if ($object->update()) { Tools::redirectAdmin(self::$currentIndex . '&conf=1&token=' . Tools::getValue('token') . $identifier); } } elseif ($object->delete()) { Tools::redirectAdmin(self::$currentIndex . '&conf=1&token=' . Tools::getValue('token') . $identifier); } $this->errors[] = Tools::displayError('An error occurred during deletion.'); } } else { $this->errors[] = Tools::displayError('An error occurred while deleting the object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->errors[] = Tools::displayError('You do not have permission to delete this.'); } } elseif (Tools::isSubmit('position')) { $object = new CMSCategory((int) Tools::getValue($this->identifier, Tools::getValue('id_cms_category_to_move', 1))); if ($this->tabAccess['edit'] !== '1') { $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } elseif (!Validate::isLoadedObject($object)) { $this->errors[] = Tools::displayError('An error occurred while updating the status for an object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } elseif (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) { $this->errors[] = Tools::displayError('Failed to update the position.'); } else { $identifier = (int) $object->id_parent ? '&' . $this->identifier . '=' . (int) $object->id_parent : ''; $token = Tools::getAdminTokenLite('AdminCmsContent'); Tools::redirectAdmin(self::$currentIndex . '&' . $this->table . 'Orderby=position&' . $this->table . 'Orderway=asc&conf=5' . $identifier . '&token=' . $token); } } elseif (Tools::getValue('submitDel' . $this->table) || Tools::getValue('submitBulkdelete' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (Tools::isSubmit($this->table . 'Box')) { $cms_category = new CMSCategory(); $result = true; $result = $cms_category->deleteSelection(Tools::getValue($this->table . 'Box')); if ($result) { $cms_category->cleanPositions((int) Tools::getValue('id_cms_category')); $token = Tools::getAdminTokenLite('AdminCmsContent'); Tools::redirectAdmin(self::$currentIndex . '&conf=2&token=' . $token . '&id_cms_category=' . (int) Tools::getValue('id_cms_category')); } $this->errors[] = Tools::displayError('An error occurred while deleting this selection.'); } else { $this->errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->errors[] = Tools::displayError('You do not have permission to delete this.'); } } parent::postProcess(); }
public function postProcess($token = NULL) { global $cookie, $currentIndex; $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if (Tools::isSubmit('submitAdd' . $this->table)) { if ($id_category = intval(Tools::getValue('id_category'))) { if (!Category::checkBeforeMove($id_category, intval(Tools::getValue('id_parent')))) { $this->_errors[] = Tools::displayError('category cannot be moved here'); return false; } // Updating customer's group if ($this->tabAccess['edit'] !== '1') { $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); } else { $object = new $this->className($id_category); if (Tools::getValue('groupBox') != NULL) { if (Validate::isLoadedObject($object)) { $object->updateGroup(Tools::getValue('groupBox')); } else { $this->_errors[] = Tools::displayError('an error occurred while updating object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->_errors[] = Tools::displayError('you must select at least one group'); } } } } elseif (isset($_GET['status']) and Tools::getValue($this->identifier)) { if ($this->tabAccess['edit'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) { $target = ''; if ($id_category = intval(Tools::getValue('id_category')) and Tools::getValue('id_product')) { $target = '&id_category=' . $id_category; } else { $referrer = Tools::secureReferrer($_SERVER['HTTP_REFERER']); if (preg_match('/id_category=(\\d+)/', $referrer, $matches)) { $target = '&id_category=' . $matches[1]; } } Tools::redirectAdmin($currentIndex . '&conf=5' . $target . '&token=' . Tools::getValue('token')); } else { $this->_errors[] = Tools::displayError('an error occurred while updating status'); } } else { $this->_errors[] = Tools::displayError('an error occurred while updating status for object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.'); } } elseif (isset($_GET['delete' . $this->table])) { if ($this->tabAccess['delete'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject()) and isset($this->fieldImageSettings)) { // check if request at least one object with noZeroObject if (isset($object->noZeroObject) and sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1) { $this->_errors[] = Tools::displayError('you need at least one object') . ' <b>' . $this->table . '</b>' . Tools::displayError(', you cannot delete all of them'); } else { $this->deleteImage($object->id); if ($this->deleted) { $object->deleted = 1; if ($object->update()) { Tools::redirectAdmin($currentIndex . '&conf=1&token=' . Tools::getValue('token') . '&id_category=' . intval($object->id_parent)); } } elseif ($object->delete()) { Tools::redirectAdmin($currentIndex . '&conf=1&token=' . Tools::getValue('token') . '&id_category=' . intval($object->id_parent)); } $this->_errors[] = Tools::displayError('an error occurred during deletion'); } } else { $this->_errors[] = Tools::displayError('an error occurred while deleting object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } elseif (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $object = new $this->className(); if (isset($object->noZeroObject) and (sizeof(call_user_func(array($this->className, $object->noZeroObject))) <= 1 or sizeof($_POST[$this->table . 'Box']) == sizeof(call_user_func(array($this->className, $object->noZeroObject))))) { $this->_errors[] = Tools::displayError('you need at least one object') . ' <b>' . $this->table . '</b>' . Tools::displayError(', you cannot delete all of them'); } else { $result = true; if ($this->deleted) { foreach (Tools::getValue($this->table . 'Box') as $id) { $toDelete = new $this->className($id); $toDelete->deleted = 1; $result = $result and $toDelete->update(); } } else { $result = $object->deleteSelection(Tools::getValue($this->table . 'Box')); } if ($result) { $target = ''; $referrer = Tools::secureReferrer($_SERVER['HTTP_REFERER']); if (preg_match('/id_category=(\\d+)/', $referrer, $matches)) { $target = '&id_category=' . $matches[1]; } Tools::redirectAdmin($currentIndex . '&conf=2&token=' . Tools::getValue('token') . $target); } $this->_errors[] = Tools::displayError('an error occurred while deleting selection'); } } else { $this->_errors[] = Tools::displayError('you must select at least one element to delete'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } parent::postProcess(); }
if (Tools::getValue("submitPublishCMS")) { if (Tools::getIsset("id_cms")) { $mlfljq = "id_cms"; ${"GLOBALS"}["wjycydntc"] = "id_tab_cms"; ${"GLOBALS"}["yimichh"] = "id_tab_cms"; ${"GLOBALS"}["iagtycvysjl"] = "profileAccess"; $upbjvyxjo = "id_cms"; ${"GLOBALS"}["yapsusiylun"] = "profileAccess"; ${$mlfljq} = (int) Tools::getValue("id_cms"); ${${"GLOBALS"}["aarxgtubrdp"]} = (int) Tab::getIdFromClassName("AdminCmsContent"); ${${"GLOBALS"}["btpowgsvsmi"]} = Tools::getAdminToken("AdminCmsContent" . (int) ${${"GLOBALS"}["yimichh"]} . (int) $context->employee->id); ${${"GLOBALS"}["rfeyim"]} = dirname($_SERVER["PHP_SELF"]) . "/index.php?tab=AdminCmsContent&id_cms=" . (int) ${$upbjvyxjo} . "&updatecms&token=" . ${${"GLOBALS"}["btpowgsvsmi"]}; if (Tools::getValue("redirect")) { die(${${"GLOBALS"}["rfeyim"]}); } ${${"GLOBALS"}["iagtycvysjl"]} = Profile::getProfileAccess($context->employee->id_profile, ${${"GLOBALS"}["wjycydntc"]}); if (${${"GLOBALS"}["yapsusiylun"]}["edit"]) { ${${"GLOBALS"}["knruqlqcfe"]} = new CMS((int) Tools::getValue("id_cms")); if (!Validate::isLoadedObject(${${"GLOBALS"}["knruqlqcfe"]})) { die("error: invalid id"); } $cms->active = 1; if ($cms->save()) { $lmhhtygzwvd = "bo_cms_url"; die(${$lmhhtygzwvd}); } else { die("error: saving"); } } else { die("error: permissions"); }
public function __construct() { global $timer_start; $this->timer_start = $timer_start; // Has to be remove for the next Prestashop version global $token; $this->controller_type = 'admin'; $this->controller_name = get_class($this); if (strpos($this->controller_name, 'Controller')) { $this->controller_name = substr($this->controller_name, 0, -10); } parent::__construct(); if ($this->multishop_context == -1) { $this->multishop_context = Shop::CONTEXT_ALL | Shop::CONTEXT_GROUP | Shop::CONTEXT_SHOP; } $this->bo_theme = Validate::isLoadedObject($this->context->employee) && $this->context->employee->bo_theme ? $this->context->employee->bo_theme : 'default'; $this->context->smarty->setTemplateDir(array(_PS_BO_ALL_THEMES_DIR_ . $this->bo_theme . DIRECTORY_SEPARATOR . 'template', _PS_OVERRIDE_DIR_ . 'controllers' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'templates')); $this->id = Tab::getIdFromClassName($this->controller_name); $this->token = Tools::getAdminToken($this->controller_name . (int) $this->id . (int) $this->context->employee->id); $token = $this->token; $this->_conf = array(1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'), 3 => $this->l('Creation successful'), 4 => $this->l('Update successful'), 5 => $this->l('Status update successful'), 6 => $this->l('Settings update successful'), 7 => $this->l('Image successfully deleted'), 8 => $this->l('Module downloaded successfully'), 9 => $this->l('Thumbnails successfully regenerated'), 10 => $this->l('Message sent to the customer'), 11 => $this->l('Comment added'), 12 => $this->l('Module(s) installed successfully'), 13 => $this->l('Module(s) uninstalled successfully'), 14 => $this->l('Language successfully copied'), 15 => $this->l('Translations successfully added'), 16 => $this->l('Module transplanted successfully to hook'), 17 => $this->l('Module removed successfully from hook'), 18 => $this->l('Upload successful'), 19 => $this->l('Duplication completed successfully'), 20 => $this->l('Translation added successfully but the language has not been created'), 21 => $this->l('Module reset successfully'), 22 => $this->l('Module deleted successfully'), 23 => $this->l('Localization pack imported successfully'), 24 => $this->l('Localization pack imported successfully'), 25 => $this->l('Images successfully moved'), 26 => $this->l('Cover selection saved'), 27 => $this->l('Image shop association modified'), 28 => $this->l('Zone assigned to the selection successfully'), 29 => $this->l('Upgrade successful'), 30 => $this->l('Partial refund successfully created'), 31 => $this->l('The discount successfully generated')); if (!$this->identifier) { $this->identifier = 'id_' . $this->table; } if (!$this->_defaultOrderBy) { $this->_defaultOrderBy = $this->identifier; } $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id); // Fix for AdminHome if ($this->controller_name == 'AdminHome') { $_POST['token'] = $this->token; } if (!Shop::isFeatureActive()) { $this->shopLinkType = ''; } //$this->base_template_folder = _PS_BO_ALL_THEMES_DIR_.$this->bo_theme.'/template'; $this->override_folder = Tools::toUnderscoreCase(substr($this->controller_name, 5)) . '/'; // Get the name of the folder containing the custom tpl files $this->tpl_folder = Tools::toUnderscoreCase(substr($this->controller_name, 5)) . '/'; $this->initShopContext(); $this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); }
public function getModulesList($filter_modules_list) { if (!is_array($filter_modules_list) && !is_null($filter_modules_list)) { $filter_modules_list = array($filter_modules_list); } if (!count($filter_modules_list)) { return false; } //if there is no modules to display just return false; $all_modules = Module::getModulesOnDisk(true); $this->modules_list = array(); foreach ($all_modules as $module) { $perm = true; if ($module->id) { $perm &= Module::getPermissionStatic($module->id, 'configure'); } else { $id_admin_module = Tab::getIdFromClassName('AdminModules'); $access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module); if (!$access['edit']) { $perm &= false; } } if (in_array($module->name, $filter_modules_list) && $perm) { $this->fillModuleData($module, 'array'); $this->modules_list[array_search($module->name, $filter_modules_list)] = $module; } } ksort($this->modules_list); if (count($this->modules_list)) { return true; } return false; //no module found on disk just return false; }
} } else { die('error: parameters'); } } if (Tools::getValue('submitPublishCMS')) { global $cookie; if (Tools::getIsset('id_cms')) { $id_cms = (int) Tools::getValue('id_cms'); $id_tab_cms = (int) Tab::getIdFromClassName('AdminCMSContent'); $token = Tools::getAdminToken('AdminCMSContent' . (int) $id_tab_cms . (int) $cookie->id_employee); $bo_cms_url = dirname($_SERVER['PHP_SELF']) . '/index.php?tab=AdminCMSContent&id_cms=' . (int) $id_cms . '&updatecms&token=' . $token; if (Tools::getValue('redirect')) { die($bo_cms_url); } $profileAccess = Profile::getProfileAccess((int) $cookie->profile, $id_tab_cms); if ($profileAccess['edit']) { $cms = new CMS((int) Tools::getValue('id_cms')); if (!Validate::isLoadedObject($cms)) { die('error: invalid id'); } $cms->active = 1; if ($cms->save()) { die($bo_cms_url); } else { die('error: saving'); } } else { die('error: permissions'); } } else {
public function postProcess($token = NULL) { global $cookie, $currentIndex; $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if (Tools::isSubmit('submitAdd' . $this->table)) { if ($id_cms_category = (int) Tools::getValue('id_cms_category')) { if (!CMSCategory::checkBeforeMove($id_cms_category, (int) Tools::getValue('id_parent'))) { $this->_errors[] = Tools::displayError('CMS Category cannot be moved here'); return false; } } } elseif (isset($_GET['statuscms_category']) and Tools::getValue($this->identifier)) { if ($this->tabAccess['edit'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->toggleStatus()) { Tools::redirectAdmin($currentIndex . '&conf=5' . ((int) $object->id_parent ? '&id_cms_category=' . (int) $object->id_parent : '') . '&token=' . Tools::getValue('token')); } else { $this->_errors[] = Tools::displayError('An error occurred while updating status.'); } } else { $this->_errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } } elseif (isset($_GET['delete' . $this->table])) { if ($this->tabAccess['delete'] === '1') { if (Validate::isLoadedObject($object = $this->loadObject()) and isset($this->fieldImageSettings)) { // check if request at least one object with noZeroObject if (isset($object->noZeroObject) and sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1) { $this->_errors[] = Tools::displayError('You need at least one object.') . ' <b>' . $this->table . '</b><br />' . Tools::displayError('You cannot delete all of the items.'); } else { $this->deleteImage($object->id); if ($this->deleted) { $object->deleted = 1; if ($object->update()) { Tools::redirectAdmin($currentIndex . '&conf=1&token=' . Tools::getValue('token')); } } elseif ($object->delete()) { Tools::redirectAdmin($currentIndex . '&conf=1&token=' . Tools::getValue('token')); } $this->_errors[] = Tools::displayError('An error occurred during deletion.'); } } else { $this->_errors[] = Tools::displayError('An error occurred while deleting object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } elseif (isset($_GET['position'])) { if ($this->tabAccess['edit'] !== '1') { $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } elseif (!Validate::isLoadedObject($object = new CMSCategory((int) Tools::getValue($this->identifier, Tools::getValue('id_cms_category_to_move', 1))))) { $this->_errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } elseif (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) { $this->_errors[] = Tools::displayError('Failed to update the position.'); } else { Tools::redirectAdmin($currentIndex . '&' . $this->table . 'Orderby=position&' . $this->table . 'Orderway=asc&conf=5' . (($id_category = (int) Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1))) ? '&' . $this->identifier . '=' . $id_category : '') . '&token=' . Tools::getAdminTokenLite('AdminCMSContent')); } } elseif (Tools::getValue('submitDel' . $this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table . 'Box'])) { $cms_category = new CMSCategory(); $result = true; $result = $cms_category->deleteSelection(Tools::getValue($this->table . 'Box')); if ($result) { $cms_category->cleanPositions((int) Tools::getValue('id_cms_category')); Tools::redirectAdmin($currentIndex . '&conf=2&token=' . Tools::getAdminTokenLite('AdminCMSContent') . '&id_category=' . (int) Tools::getValue('id_cms_category')); } $this->_errors[] = Tools::displayError('An error occurred while deleting selection.'); } else { $this->_errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->_errors[] = Tools::displayError('You do not have permission to delete here.'); } } parent::postProcess(true); }
private function getModulesByInstallation($modulesSelectList = null) { $addonsProvider = $this->get('prestashop.core.admin.data_provider.module_interface'); $moduleRepository = $this->get('prestashop.core.admin.module.repository'); $modulePresenter = $this->get('prestashop.adapter.presenter.module'); $modulesOnDisk = $moduleRepository->getList(); $modulesList = array('installed' => array(), 'not_installed' => array()); $modulesOnDisk = $addonsProvider->generateAddonsUrls($modulesOnDisk); foreach ($modulesOnDisk as $module) { if (!isset($modulesSelectList) || in_array($module->get('name'), $modulesSelectList)) { $perm = true; if ($module->get('id')) { $perm &= \Module::getPermissionStatic($module->get('id'), 'configure'); } else { $id_admin_module = \Tab::getIdFromClassName('AdminModules'); $access = \Profile::getProfileAccess($this->getContext()->employee->id_profile, $id_admin_module); if (!$access['edit']) { $perm &= false; } } if ($module->get('author') === ModuleRepository::PARTNER_AUTHOR) { $module->set('type', 'addonsPartner'); } if ($perm) { $module->fillLogo(); if ($module->database->get('installed') == 1) { $modulesList['installed'][] = $modulePresenter->present($module); } else { $modulesList['not_installed'][] = $modulePresenter->present($module); } } } } return $modulesList; }
/** * Check rights to view the current tab * * @return boolean */ public function viewAccess($disable = false) { global $cookie; if ($disable) { return true; } $this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id); if ($this->tabAccess['view'] === '1') { return true; } return false; }
/** * Check rights to view the current tab * * @return bool */ public function viewAccess($disable = false) { if ($disable) { return true; } $this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id); if ($this->tabAccess['view'] === '1') { return true; } return false; }
<?php session_start(); if (!defined('_PS_ADMIN_DIR_')) { define('_PS_ADMIN_DIR_', dirname(__FILE__) . '/../../'); } require_once _PS_ADMIN_DIR_ . '/../config/config.inc.php'; require_once _PS_ADMIN_DIR_ . '/init.php'; if (function_exists('mb_internal_encoding')) { mb_internal_encoding('UTF-8'); } $products_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminProducts')); $cms_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminCmsContent')); if (!$products_accesses['edit'] && !$cms_accesses['edit']) { die(Tools::displayError()); } //------------------------------------------------------------------------------ // DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES //------------------------------------------------------------------------------ //********************** //Path configuration //********************** // In this configuration the folder tree is // root // |- source <- upload folder // |- thumbs <- thumbnail folder [must have write permission (755)] // |- filemanager // |- js // | |- tinymce // | | |- plugins // | | | |- responsivefilemanager
/** * Is the Employee allowed to do the given action * * @param $action * @param $tab * * @return bool */ public function can($action, $tab) { $access = Profile::getProfileAccess($this->id_profile, Tab::getIdFromClassName($tab)); return $access[$action] == '1'; }