* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6850 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminScenes extends AdminTab { protected $maxImageSize = 1000000; public function __construct() { $this->table = 'scene'; $this->className = 'Scene'; $this->lang = true; $this->edit = true; $this->delete = true; $this->fieldImageSettings = array( array('name' => 'image', 'dir' => 'scenes'), array('name' => 'thumb', 'dir' => 'scenes/thumbs') ); $this->fieldsDisplay = array( 'id_scene' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Image Maps'), 'width' => 150), 'active' => array('title' => $this->l('Activated'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) ); parent::__construct(); } public function afterImageUpload() { /* Generate image with differents size */ if (!($obj = $this->loadObject(true))) return; if ($obj->id AND (isset($_FILES['image']) OR isset($_FILES['thumb']))) { $imagesTypes = ImageType::getImagesTypes('scenes'); foreach ($imagesTypes AS $k => $imageType) { if ($imageType['name'] == 'large_scene' AND isset($_FILES['image'])) imageResize($_FILES['image']['tmp_name'], _PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])); elseif ($imageType['name'] == 'thumb_scene') { if (isset($_FILES['thumb']) AND !$_FILES['thumb']['error']) $tmpName = $_FILES['thumb']['tmp_name']; else $tmpName = $_FILES['image']['tmp_name']; imageResize($tmpName, _PS_SCENE_THUMB_IMG_DIR_.$obj->id.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])); } } } return true; } /** * Build a categories tree * * @param array $indexedCategories Array with categories where product is indexed (in order to check checkbox) * @param array $categories Categories to list * @param array $current Current category * @param integer $id_category Current category id */ public function recurseCategoryForInclude($indexedCategories, $categories, $current, $id_category = 1, $id_category_default = NULL, $has_suite = array()) { global $done; static $irow; $id_obj = (int)(Tools::getValue($this->id)); if (!isset($done[$current['infos']['id_parent']])) $done[$current['infos']['id_parent']] = 0; $done[$current['infos']['id_parent']] += 1; $todo = sizeof($categories[$current['infos']['id_parent']]); $doneC = $done[$current['infos']['id_parent']]; $level = $current['infos']['level_depth'] + 1; echo '