* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7690 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminAliases extends AdminTab { function __construct() { $this->table = 'alias'; $this->className = 'Alias'; $this->edit = true; $this->delete = true; $this->fieldsDisplay = array( 'alias' => array('title' => $this->l('Aliases'), 'width' => 160), 'search' => array('title' => $this->l('Search'), 'width' => 40), 'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) ); parent::__construct(); } public function postProcess() { if (isset($_POST['submitAdd'.$this->table])) { $search = strval(Tools::getValue('search')); $string = strval(Tools::getValue('alias')); $aliases = explode(',', $string); if (empty($search) OR empty($string)) $this->_errors[] = $this->l('aliases and result are both required'); if (!Validate::isValidSearch($search)) $this->_errors[] = $search.' '.$this->l('is not a valid result'); foreach ($aliases AS $alias) if (!Validate::isValidSearch($alias)) $this->_errors[] = $alias.' '.$this->l('is not a valid alias'); if (!sizeof($this->_errors)) { foreach ($aliases AS $alias) { $obj = new Alias(NULL, trim($alias), trim($search)); $obj->save(); } } } else parent::postProcess(); } public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) return; echo '
'; } }