* @copyright PrestaShop * @license http://www.opensource.org/licenses/osl-3.0.php Open-source licence 3.0 * @version 1.3 * */ include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); class AdminAccess extends AdminTab { public function postProcess() { if (Tools::isSubmit('submitAddaccess') AND $action = Tools::getValue('action') AND $id_tab = intval(Tools::getValue('id_tab')) AND $id_profile = intval(Tools::getValue('id_profile')) AND $this->tabAccess['edit'] == 1) Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'access` SET `'.pSQL($action).'` = '.intval(Tools::getValue('perm')).' WHERE `id_tab` = '.intval($id_tab).' AND `id_profile` = '.intval($id_profile)); } public function display() { $this->displayForm(); } /** * Get the current profile id * * @return the $_GET['profile'] if valid, else 1 (the first profile id) */ function getCurrentProfileId() { return (isset($_GET['profile']) AND !empty($_GET['profile']) AND is_numeric($_GET['profile'])) ? intval($_GET['profile']) : 1; } public function displayForm($isMainTab = true) { global $cookie, $currentIndex; parent::displayForm(); $currentProfile = intval($this->getCurrentProfileId()); $tabs = Tab::getTabs($cookie->id_lang); $profiles = Profile::getProfiles(intval($cookie->id_lang)); $accesses = Profile::getProfileAccesses(intval($currentProfile)); echo '
| '.$this->l('View').' | '.$this->l('Add').' | '.$this->l('Edit').' | '.$this->l('Delete').' | |
|---|---|---|---|---|
| '.$this->l('No tab').' | ||||