* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 7310 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminImages extends AdminTab { private $start_time = 0; private $max_execution_time = 7200; public function __construct() { $this->table = 'image_type'; $this->className = 'ImageType'; $this->lang = false; $this->edit = true; $this->delete = true; $this->fieldsDisplay = array( 'id_image_type' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Name'), 'width' => 140, 'size' => 16), 'width' => array('title' => $this->l('Width'), 'align' => 'right', 'suffix' => ' px', 'width' => 50, 'size' => 5), 'height' => array('title' => $this->l('Height'), 'align' => 'right', 'suffix' => ' px', 'width' => 50, 'size' => 5) ); parent::__construct(); } public function displayList() { parent::displayList(); $this->displayRegenerate(); $this->displayMoveImages(); } public function postProcess() { if (Tools::getValue('submitRegenerate'.$this->table)) { if ($this->tabAccess['edit'] === '1') { if ($this->_regenerateThumbnails(Tools::getValue('type'), Tools::getValue('erase'))) Tools::redirectAdmin(self::$currentIndex.'&conf=9'.'&token='.$this->token); } else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); }elseif (Tools::getValue('submitMoveImages'.$this->table)) $this->_moveImagesToNewFileSystem(); else parent::postProcess(); } protected function _childValidation() { if (!Tools::getValue('id_image_type') AND Validate::isImageTypeName($typeName = Tools::getValue('name')) AND ImageType::typeAlreadyExists($typeName)) $this->_errors[] = Tools::displayError('This name already exists.'); } public function displayForm($isMainTab = true) { parent::displayForm(); if (!($obj = $this->loadObject(true))) return; echo $obj->id ? $this->displayWarning($this->l('After modification, do not forget to regenerate thumbnails')) : ''; echo '
'; } /** * Display form for thumbnails regeneration */ public function displayRegenerate() { $types = array( 'categories' => $this->l('Categories'), 'manufacturers' => $this->l('Manufacturers'), 'suppliers' => $this->l('Suppliers'), 'scenes' => $this->l('Scenes'), 'products' => $this->l('Products'), 'stores' => $this->l('Stores') ); echo '