* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php'); class AdminAttributes extends AdminTab { public function __construct() { $this->table = 'attribute'; $this->className = 'Attribute'; $this->lang = true; $this->edit = true; $this->delete = true; $this->fieldImageSettings = array('name' => 'texture', 'dir' => 'co'); parent::__construct(); } /** * Display form * * @global string $currentIndex Current URL in order to keep current Tab */ public function displayForm($token = NULL) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) return; $color = ($obj->color ? $obj->color : 0); $attributes_groups = AttributeGroup::getAttributesGroups($this->_defaultFormLanguage); $strAttributesGroups = ''; echo '
'.($obj->id ? '' : '').'
'.$this->l('Attribute').'
'; foreach ($this->_languages as $language) echo '
* '.$this->l('Invalid characters:').' <>;=#{} 
'; $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name'); echo '
*
*

'.$this->l('HTML colors only (e.g.,').' "lightblue", "#CC6600")

'.$this->l('Upload color texture from your computer').'
'.$this->l('This will override the HTML color!').'

'.(file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$obj->id.'.jpg') ? ' '.$this->l('delete').'' : $this->l('None') ).'

* '.$this->l('Required field').'
'; } /** * Manage page processing * * @global string $currentIndex Current URL in order to keep current Tab */ public function postProcess($token = NULL) { global $currentIndex; if (Tools::getValue('submitDel'.$this->table)) { if ($this->tabAccess['delete'] === '1') { if (isset($_POST[$this->table.$_POST['groupid'].'Box'])) { $object = new $this->className(); if ($object->deleteSelection($_POST[$this->table.$_POST['groupid'].'Box'])) Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.($token ? $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(); } }