Explorar el Código

renomage chcreateur

cedric hace 3 años
commit
de6f050e39
Se han modificado 52 ficheros con 3267 adiciones y 0 borrados
  1. 11 0
      .php-cs-fixer.php
  2. 604 0
      chcreateur.php
  3. 242 0
      classes/chcreaimages.php
  4. 62 0
      classes/chcreaimagetype.php
  5. 590 0
      classes/chcreapost.php
  6. 31 0
      config/define.inc.php
  7. 13 0
      config_fr.xml
  8. 509 0
      controllers/admin/AdminChcreateur.php
  9. 57 0
      controllers/front/archive.php
  10. 76 0
      controllers/front/single.php
  11. 89 0
      db/dbfiles.php
  12. BIN
      img/1/4.jpg
  13. 1 0
      img/1/fileType
  14. BIN
      img/1/gallery_default-4.jpg
  15. BIN
      img/1/gallery_default-noscreateursillustration1.jpg
  16. BIN
      img/1/noscreateursillustration1.jpg
  17. BIN
      img/1/post_default-4.jpg
  18. 1 0
      img/2/fileType
  19. BIN
      img/2/gallery_default-noscreateursillustration2.jpg
  20. BIN
      img/2/gallery_medium-noscreateursillustration2.jpg
  21. BIN
      img/2/gallery_small-noscreateursillustration2.jpg
  22. BIN
      img/2/noscreateursillustration2.jpg
  23. BIN
      img/2/post_default-noscreateursillustration2.jpg
  24. 1 0
      img/3/fileType
  25. BIN
      img/3/gallery_default-noscreateursillustration1.jpg
  26. BIN
      img/3/gallery_medium-noscreateursillustration1.jpg
  27. BIN
      img/3/gallery_small-noscreateursillustration1.jpg
  28. BIN
      img/3/noscreateursillustration1.jpg
  29. BIN
      img/3/post_default-noscreateursillustration1.jpg
  30. 1 0
      img/4/fileType
  31. BIN
      img/4/gallery_default-noscreateursillustration1.jpg
  32. BIN
      img/4/gallery_medium-noscreateursillustration1.jpg
  33. BIN
      img/4/gallery_small-noscreateursillustration1.jpg
  34. BIN
      img/4/noscreateursillustration1.jpg
  35. BIN
      img/4/post_default-noscreateursillustration1.jpg
  36. 78 0
      js/chslider.js
  37. 8 0
      js/validator.min.js
  38. BIN
      logo.png
  39. 194 0
      views/templates/admin/chcreateur/helpers/form/form.tpl
  40. 73 0
      views/templates/front/archive.tpl
  41. 74 0
      views/templates/front/chselection.tpl
  42. 38 0
      views/templates/front/comment-list.tpl
  43. 90 0
      views/templates/front/comment.tpl
  44. 12 0
      views/templates/front/custom-nav.tpl
  45. 78 0
      views/templates/front/left-list.tpl
  46. 30 0
      views/templates/front/pagination.tpl
  47. 39 0
      views/templates/front/post-audio.tpl
  48. 33 0
      views/templates/front/post-gallery.tpl
  49. 43 0
      views/templates/front/post-video.tpl
  50. 136 0
      views/templates/front/single.tpl
  51. 2 0
      views/templates/front/test.tpl
  52. 51 0
      views/templates/front/vignette.tpl

+ 11 - 0
.php-cs-fixer.php

@@ -0,0 +1,11 @@
+<?php
+
+return (new PhpCsFixer\Config())
+	->setRules([
+		'@PSR12' => true,
+		'array_indentation' => true,
+	])
+	->setIndent("\t")
+	->setLineEnding("\n")
+	->setFinder($finder)
+;

+ 604 - 0
chcreateur.php

@@ -0,0 +1,604 @@
+<?php
+
+if (!defined('_PS_VERSION_')) {
+	exit;
+}
+
+include_once _PS_MODULE_DIR_.'chcreateur/config/define.inc.php';
+include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreaimagetype.php';
+include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreapost.php';
+
+use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
+
+class Chcreateur extends Module implements WidgetInterface
+{
+	public $dbfiles = '/db/dbfiles.php';
+
+	public function __construct()
+	{
+		$this->name = 'chcreateur';
+		$this->tab = 'front_office_features';
+		$this->version = '1.0.0';
+		$this->author = 'Cedric Hansen';
+		$this->need_instance = 0;
+		$this->ps_versions_compliancy = [
+			'min' => '1.6.0',
+			'max' => '1.7.9',
+		];
+		$this->bootstrap = true;
+		parent::__construct();
+
+		$this->displayName = $this->l('CH createur');
+		$this->description = $this->l("Presentation d'une createur ");
+
+		$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
+	}
+
+	/**
+	 * @return [type]
+	 */
+	public function install()
+	{
+		if (Shop::isFeatureActive()) {
+			Shop::setContext(Shop::CONTEXT_ALL);
+		}
+
+		return (
+			parent::install()
+			&& $this->registerHook('displayBlockPosition2')
+			&& $this->registerHook('displayHeader')
+			&& $this->registerHook('ModuleRoutes')
+			&& $this->Register_SQL()
+			&& $this->_installTab()
+			&& Configuration::updateValue('CHCREATEUR_TITLE', 'Nos createurs')
+			&& Configuration::updateValue('CHCREATEUR_DESCRIPTION', 'Une description', true)
+		);
+	}
+
+	/**
+	 * @return [type]
+	 */
+	public function Register_SQL()
+	{
+		$querys = array();
+		if (file_exists(dirname(__FILE__).$this->dbfiles)) {
+			require_once(dirname(__FILE__).$this->dbfiles);
+			if (isset($querys) && !empty($querys)) {
+				foreach ($querys as $query) {
+					if (!Db::getInstance()->Execute($query)) {
+						return false;
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+		/**
+     * Installation du controller dans la backoffice
+     * @return boolean
+     */
+    protected function _installTab()
+    {
+        $tab = new Tab();
+        $tab->class_name = 'AdminChcreateur';
+        $tab->module = $this->name;
+        $tab->id_parent = (int)Tab::getIdFromClassName('IMPROVE');
+        $tab->icon = 'chat';
+        $languages = Language::getLanguages();
+        foreach ($languages as $lang) {
+            $tab->name[$lang['id_lang']] = $this->l('Notre createur');
+        }
+        try {
+            $tab->save();
+        } catch (Exception $e) {
+            echo $e->getMessage();
+            return false;
+        }
+
+        return true;
+    }
+
+	/**
+	 * @return [type]
+	 */
+	public function uninstall()
+	{
+		return (
+			parent::uninstall()
+			//&& $this->UnRegister_SQL()
+			//&& Configuration::deleteByName('CHCREATEUR_NAME')
+		);
+	}
+
+	/**
+	 * @return [type]
+	 */
+	public function UnRegister_SQL()
+	{
+		$querys_u = array();
+		if (file_exists(dirname(__FILE__).$this->dbfiles)) {
+			require_once(dirname(__FILE__).$this->dbfiles);
+			if (isset($querys_u) && !empty($querys_u)) {
+				foreach ($querys_u as $query_u) {
+					if (!Db::getInstance()->Execute($query_u)) {
+						return false;
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * @param mixed $params
+	 * 
+	 * @return $array
+	 */
+	public function hookModuleRoutes($params)
+    {
+		$chcreateurroutes = array(
+			'chcreateur-archive-module' => [
+				'controller' => 'archive',
+				'rule' => 'noscreateurs',
+				'keywords' => [],
+				'params' => [
+					'fc' => 'module',
+					'module' => 'chcreateur',
+				]
+			],
+			'chcreateur-single-module' => [
+				'controller' => 'single',
+				'rule' => 'noscreateurs/{id}_{rewrite}',
+				'keywords' => [
+					'id' =>   array('regexp' => '[0-9]+','param' => 'id'),
+                    'rewrite' =>   array('regexp' => '[_a-zA-Z0-9-\pL]*','param' => 'rewrite'),
+				],
+				'params' => [
+					'fc' => 'module',
+					'module' => 'chcreateur',
+				]
+			]
+		);
+	
+		return $chcreateurroutes;
+	}
+
+
+
+	public function postProcess()
+	{
+		$output = '';
+
+		//print_r($_POST);
+		//print_r($_GET);
+
+		// this part is executed only when the form is submitted
+		if (Tools::isSubmit('submit' . $this->name)) {
+			// retrieve the value set by the user
+			$config_TITLE = (string) Tools::getValue('CHCREATEUR_TITLE');
+			$config_DESCRIPTION = (string) Tools::getValue('CHCREATEUR_DESCRIPTION');
+
+
+			// check that the value is valid
+			if (empty($config_TITLE) || !Validate::isGenericName($config_TITLE)) {
+				// invalid value, show an error
+				$output = $this->displayError($this->l('Invalid Configuration value'));
+			} else {
+				// value is ok, update it and display a confirmation message
+				Configuration::updateValue('CHCREATEUR_TITLE', $config_TITLE);
+				Configuration::updateValue('CHCREATEUR_DESCRIPTION', $config_DESCRIPTION, true);
+
+				$output = $this->displayConfirmation($this->l('Settings updated'));
+			}
+		}
+		if (Tools::isSubmit('updatechcrea_image_type') || Tools::getValue('addnew')) {
+			return $output . $this->renderImageForm();
+		}
+		if (Tools::isSubmit('SubmitImageForm')) {
+			if (Tools::getValue('id_image_type')) {
+				$obj = new chcreaimagetypeclass(Tools::getValue('id_image_type'));
+			} else {
+				$obj = new chcreaimagetypeclass();
+			}
+
+			foreach (chcreaimagetypeclass::$definition['fields'] as $key => $value) {
+				$obj->$key = Tools::getValue($key);
+			}
+
+			if (Tools::getValue('id_image_type')) {
+				if ($obj->update()) {
+					return $this->displayConfirmation($this->l('Settings Updated'));
+				} else {
+					return $this->displayError($this->l('Unable to update settings'));
+				}
+			} else {
+				if ($obj->add()) {
+					return $this->displayConfirmation($this->l('Settings Created'));
+				} else {
+					return $this->displayError($this->l('Unable to create settings'));
+				}
+			}
+		}
+	}
+
+	/**
+	 * @return string
+	 * @throws PrestaShopDatabaseException
+	 * @throws PrestaShopException
+	 */
+	public function getContent()
+	{
+		//$lien = Context::getContext()->link->getModuleLink('chcreateur', 'archive', array('idPayment' => 1337));
+		//print($lien);
+		$html  = $this->postProcess();
+		$html .= $this->displayForm();
+		$html .= $this->displayList();
+
+		return $html;
+	}
+
+	/**
+	 * Get configuration form
+	 * @return string
+	 * @throws PrestaShopDatabaseException
+	 * @throws PrestaShopException
+	 */
+	protected function renderImageForm()
+	{
+		$fields_form = [
+			'form' => [
+				'description' => $this->l('Format des images generées pour les templates'),
+				'legend' => [
+					'title' => $this->l('Configure Image'),
+					'icon' => 'icon-cogs'
+				],
+
+				'input' => [
+					[
+						'type' => 'hidden',
+						'label' => $this->l('Enable for id'),
+						'name' => 'id_image_type',
+						'required' => true,
+					],
+					[
+						'type' => 'hidden',
+						'label' => $this->l('Enable for shop'),
+						'name' => 'id_shop',
+						'required' => true,
+					],
+					[
+						'type' => 'text',
+						'label' => $this->l('Name'),
+						'name' => 'name',
+						'required' => false,
+					],
+					[
+					  'type' => 'text',
+					  'label' => $this->l('Width of picture'),
+					  'name' => 'width',
+					  'required' => true,
+					],
+					[
+					  'type' => 'text',
+					  'label' => $this->l('Height of picture'),
+					  'name' => 'height',
+					  'required' => true,
+					],
+					[
+						'type' => 'switch',
+						'label' => $this->l('Status'),
+						'name' => 'active',
+						'required' => false,
+						'class' => 't',
+						'is_bool' => true,
+						'values' => array(
+							array(
+								'id' => 'active',
+								'value' => 1,
+								'label' => $this->l('Enabled')
+							),
+							array(
+								'id' => 'active',
+								'value' => 0,
+								'label' => $this->l('Disabled')
+							)
+						)
+					],
+				],
+				'submit' => [
+					'title' => $this->l('Save'),
+					'icon' => 'icon-save',
+					'class' => 'button btn btn-default pull-right',
+				]
+			],
+		];
+
+		$helper = new HelperForm();
+		//$helper->show_toolbar = true;
+		$helper->show_cancel_button = true;
+		$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
+		$helper->default_form_language = $lang->id;
+		$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
+		$helper->identifier = "image_type";
+		$helper->submit_action = 'SubmitImageForm';
+		$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
+		$helper->token = Tools::getAdminTokenLite('AdminModules');
+		$helper->tpl_vars = array(
+			'fields_value' => $this->getAddFieldsValues(),
+			'languages' => $this->context->controller->getLanguages(),
+			'id_language' => $this->context->language->id
+		);
+
+		return $helper->generateForm([$fields_form]);
+	}
+
+	public function getAddFieldsValues()
+	{
+		$fields = array();
+
+		$id_image_type = (int) Tools::getValue('id_image_type');
+		if ($id_image_type == 0) {
+			$obj = new Chcreaimagetypeclass();
+			print("id_image_type:".$obj->id);
+			print("</br>");
+		} else {
+			$obj = new Chcreaimagetypeclass($id_image_type);
+		}
+
+		$fields = [
+			'id_image_type' => Tools::getValue('id_image_type', $obj->id),
+			'name' => Tools::getValue('name', $obj->name),
+			'width' => Tools::getValue('width', $obj->width),
+			'height' => Tools::getValue('height', $obj->height),
+			'active' => Tools::getValue('active', $obj->active),
+			'id_shop' => Tools::getValue('id_shop', $obj->id_shop),
+		];
+
+		return $fields;
+	}
+
+	public function displayForm()
+	{
+		// Init Fields form array
+		$form = [
+			'form' => [
+				'legend' => [
+					'title' => $this->l('Settings'),
+				],
+				'input' => [
+					[
+						'type' => 'text',
+						'label' => $this->l('Title'),
+						'name' => 'CHCREATEUR_TITLE',
+						'size' => 128,
+						'required' => true,
+					],
+					[
+						'type' => 'textarea',
+						'label' => $this->l('Description'),
+						'name' => 'CHCREATEUR_DESCRIPTION',
+						'size' => 800,
+						'required' => true,
+						],
+				],
+				'submit' => [
+					'title' => $this->l('Save'),
+					'class' => 'btn btn-default pull-right',
+				],
+			],
+
+		];
+
+		$helper = new HelperForm();
+
+		// Module, token and currentIndex
+		$helper->table = $this->table;
+		$helper->name_controller = $this->name;
+		$helper->token = Tools::getAdminTokenLite('AdminModules');
+		$helper->currentIndex = AdminController::$currentIndex . '&' . http_build_query(['configure' => $this->name]);
+		$helper->submit_action = 'submit' . $this->name;
+
+		// Default language
+		$helper->default_form_language = (int) Configuration::get('PS_LANG_DEFAULT');
+
+		// Load current value into the form
+		$helper->fields_value['CHCREATEUR_TITLE'] = Tools::getValue('CHCREATEUR_TITLE', Configuration::get('CHCREATEUR_TITLE'));
+		$helper->fields_value['CHCREATEUR_DESCRIPTION'] = Tools::getValue('CHCREATEUR_DESCRIPTION', Configuration::get('CHCREATEUR_DESCRIPTION'));
+
+		return $helper->generateForm([$form]);
+	}
+
+
+	public function displayList()
+	{
+		$fields_list = [
+			'id_image_type' => [
+				'title' => $this->l('Id'),
+				//'width' => 140,
+				'type'  => 'text',
+			],
+			'name' => [
+				'title' => $this->l('Name'),
+				//'width' => '100%',
+				'type'  => 'texte',
+			],
+			'width' => [
+				'title' => $this->l('Width'),
+				//'width' => 140,
+				'type'  => 'texte',
+			],
+			'height' => [
+				'title' => $this->l('height'),
+				//'width' => 140,
+				'type'  => 'texte',
+			],
+			'active' => [
+				'title' => $this->l('active'),
+				//'width' => 30,
+				'type'  => 'bool',
+				'active' => 'status',
+				'icon' => [
+					0 => 'disabled.gif',
+					1 => 'enabled.gif',
+				  'default' => 'disabled.gif'
+				],
+			],
+		];
+
+		$helper = new HelperList();
+
+		$helper->shopLinkType = '';
+
+		$helper->simple_header = false;
+		// Actions to be displayed in the "Actions" column
+		$helper->actions = array('edit', 'delete');
+		$helper->show_toolbar = true;
+		$helper->identifier = 'id_image_type';
+		$helper->toolbar_btn['new'] =  [
+		  'href' => Context::getContext()->link->getAdminLink('AdminModules').'&addnew=true&configure='.$this->name,
+		  'desc' => $this->l('Add new')
+		];
+		$helper->title = 'List Image Type';
+		$helper->table = Chcreaimagetypeclass::$definition['table'];
+		$helper->className = Chcreaimagetypeclass::class; //Classe de l'objet
+		$helper->token = Tools::getAdminTokenLite('AdminModules');
+
+
+		//$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
+		//AdminController::$currentIndex.'&configure='.$this->name;
+		$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
+
+
+
+		return $helper->generateList(Chcreaimagetypeclass::GetAllImageTypes(), $fields_list);
+	}
+
+	public function initToolbar()
+	{
+		parent::initToolbar();
+
+		$this->toolbar_btn['new'] = array(
+			'href' => $this->context->link->getAdminLink('some link'),
+			'desc' => $this->l('some description')
+		);
+	}
+
+
+	/*
+	public function renderList()
+	{
+		$this->addRowAction('edit');
+		$this->addRowAction('delete');
+		return parent::renderList();
+	}
+	*/
+
+	/**
+	 * @param null $hookName
+	 * @param array $configuration
+	 *
+	 * @return [type]
+	 */
+	public function renderWidget($hookName = null, array $configuration = [])
+	{
+		if ($hookName  == 'displayxipblogleft') {
+			$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
+			return $this->fetch('module:'.$this->name.'/views/templates/front/left-list.tpl');
+
+		} elseif ( $hookName == 'displayBlockPosition2' ) {
+			$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
+			//print_r($this->getWidgetVariables($hookName, $configuration));
+			//print($this->name);
+			//return "voila";
+			return $this->fetch('module:'.$this->name.'/views/templates/front/vignette.tpl');
+		} else {
+			$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
+			//print_r($this->getWidgetVariables($hookName, $configuration));
+			//print($this->name);
+			//return "voila";
+			return $this->fetch('module:'.$this->name.'/views/templates/front/'.$this->name.'.tpl');
+		}
+	}
+
+	public function getWidgetVariables($hookName = null, array $configuration = [])
+	{
+		$id_lang             = (int)$this->context->language->id;
+		//$xipbdp_title        = Configuration::get(self::$xipblogshortname.'xipbdp_title', $id_lang);
+		// $xipbdp_subtext      = Configuration::get(self::$xipblogshortname.'xipbdp_subtext', $id_lang);
+		// $xipbdp_postcount    = Configuration::get(self::$xipblogshortname.'xipbdp_postcount');
+
+		//Media::addJsDef(array('xipbdp_numcolumn'=>$xipbdp_numcolumn));
+		$chcreaposts = array();
+		$chcreaposts = Chcreapost::getAllcreateurs(6);
+		
+		// print('<Pre>'.print_r($chcreaposts,true).'</pre>');
+		// exit();
+
+
+		
+
+		return array(
+			'chcrea_title'      => Configuration::get('CHCREATEUR_TITLE'),
+			'chcrea_desc'       => Configuration::get('CHCREATEUR_DESCRIPTION'),
+			'hookName'         => $hookName,
+			'chcreaposts'       => $chcreaposts,
+			'vignettes_nbr' => count($chcreaposts),
+		);
+	}
+
+	public static function getBaseLink($id_shop = null, $ssl = null, $relative_protocol = false)
+    {
+        static $force_ssl = null;
+
+        if ($ssl === null) {
+            if ($force_ssl === null) {
+                $force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
+            }
+            $ssl = $force_ssl;
+        }
+
+        if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null) {
+            $shop = new Shop($id_shop);
+        } else {
+            $shop = Context::getContext()->shop;
+        }
+
+        if ($relative_protocol) {
+            $base = '//'.($ssl ? $shop->domain_ssl : $shop->domain);
+        } else {
+            $base = (($ssl) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
+        }
+
+        return $base.$shop->getBaseURI();
+    }
+
+
+    public static function XipBlogPostLink($params = array())
+    {
+        $url_format = Configuration::get(self::$xipblogshortname."url_format");
+        if(isset($params['id']) && !isset($params['rewrite'])) {
+            $params['rewrite'] = xippostsclass::get_the_rewrite($params['id']);
+        }
+        if(!isset($params['id']) && isset($params['rewrite'])) {
+            $params['id'] = xippostsclass::get_the_id($params['rewrite']);
+        }
+        if(!isset($params['page_type'])) {
+            $params['page_type'] = 'post';
+        }
+        if($url_format == 'preid_seo_url') {
+            $rule = 'xipblog-single-module';
+            return self::XipBlogLink($rule, $params);
+        } elseif ($url_format == 'postid_seo_url') {
+            $rule = 'xipblog-single-aftrid-module';
+            return self::XipBlogLink($rule, $params);
+        } elseif ($url_format == 'wthotid_seo_url') {
+            $rule = 'xipblog-single-wid-module';
+            return self::XipBlogLink($rule, $params);
+        } elseif ($url_format == 'default_seo_url') {
+            return self::GetLinkObject()->getModuleLink("xipblog", "single", $params);
+        } else {
+            $rule = 'xipblog-single-module';
+        }
+    }
+}

+ 242 - 0
classes/chcreaimages.php

@@ -0,0 +1,242 @@
+<?php
+
+include_once _PS_MODULE_DIR_.'chcreateur/config/define.inc.php';
+
+
+class Chcreaimages extends ObjectModel
+{
+    public $id;
+    public $id_images;
+    public $id_chcreaposts;
+    public $name;
+	public $type;
+
+    public static $definition = [
+		'table' => 'chcrea_images',
+		'primary' => 'id_images',
+		'multilang' => false,
+		'fields' => [
+            'id_chcreaposts' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt'],
+			'name' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => false],
+			'type' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => false],
+		],
+	];
+
+	public function __construct($id = null, $id_lang = null, $id_shop = null)
+	{
+		parent::__construct($id, $id_lang, $id_shop);
+	}
+
+	public function record()
+	{
+
+	}
+
+	public function addUnique()
+	{
+		$exist = $this->getByPosts();
+		if ( count($exist) > 0 ) {
+			$ids = [];
+			foreach($exist as $img) {
+				$ids[] = $img['id_images'];
+			}
+			$this->deleteSelection($ids);
+		}
+
+		return $this->add();
+	}
+
+
+	public function getByPosts()
+	{
+		$sql  = ' SELECT * ';
+		$sql .= ' FROM `'._DB_PREFIX_.'chcrea_images` ';
+		$sql .= ' WHERE `id_chcreaposts` = '.$this->id_chcreaposts;
+		$sql .= ' AND `type` = "'.$this->type.'"';
+
+		return Db::getInstance()->executeS($sql);
+	}
+
+	public function getGallery($id_chcreaposts)
+	{
+		$this->id_chcreaposts = $id_chcreaposts;
+		$this->type = 'gallery';
+
+		return $this->getByPosts();
+	}
+
+	public function getUrls($id_chcreaposts, $type = 'post')
+	{
+		$this->id_chcreaposts = $id_chcreaposts;
+		$this->type = $type;
+
+		$result = $this->getByPosts();
+		$imgs = [];  
+		foreach($result as $img) {
+			$imgs[] = chcrea_img_uri.$this->id_chcreaposts.'/'.$img['name'];
+		}
+		return $imgs;
+	}
+
+	public function getAllUrls($id_chcreaposts, $type = 'post')
+	{
+		$this->id_chcreaposts = $id_chcreaposts;
+		$this->type = $type;
+
+		$result = $this->getByPosts();
+		$imgs = [];  
+
+		$GetAllImageTypes = Chcreaimagetypeclass::GetAllImageTypes($this->type);
+		
+
+		if ( count($result) == 1 ) {
+			if (isset($GetAllImageTypes) && !empty($GetAllImageTypes)) {
+				foreach ($GetAllImageTypes as $imagetype) {
+					$name = $imagetype['name'].'-'.$result[0]['name'];
+					$imgs[0][$imagetype['name']] = chcrea_img_uri.$this->id_chcreaposts.'/'.$name;
+					if (!$this->ImageExists($name)) {
+						$imgs[0][$imagetype['name']] = chcrea_img_uri.$this->id_chcreaposts.'/'.$imagetype['name'].'-noimage.jpg';
+					}
+				}
+			}
+		}
+		if ( count($result) > 1 ) {
+			if (isset($GetAllImageTypes) && !empty($GetAllImageTypes)) {
+				foreach($result as $key => $img) {
+					foreach ($GetAllImageTypes as $imagetype) {
+						$name = $imagetype['name'].'-'.$img['name'];
+						$imgs[$key][$imagetype['name']] = chcrea_img_uri.$this->id_chcreaposts.'/'.$name;
+						if (!$this->ImageExists($name)) {
+							$imgs[$key][$imagetype['name']] = chcrea_img_uri.$this->id_chcreaposts.'/'.$imagetype['name'].'-noimage.jpg';
+						}
+					}
+				}
+			}
+		}
+		return $imgs;
+	}
+
+	public function ImageExists($file = null)
+	{
+		if (null == $file) {
+			return false;
+		}
+		$image = chcrea_img_dir.$this->id_chcreaposts.'/'.$file;
+		if (file_exists($image)) {
+			return true;
+		}
+		return false;
+	}
+
+	public function getPath($dir=null)
+	{
+		if($dir == null) {
+			$dir = chcrea_img_dir.$this->id_chcreaposts.'/';
+			if ( !file_exists($dir) ) {
+				$oldmask = umask(000);
+				mkdir($dir                                                                                                                                                                                                                    );
+				chmod($dir, 0775);
+				umask($oldmask);
+			}
+		}
+		return $dir;
+	}
+
+	/**
+	 * @param mixed $name
+	 * @param mixed $dir=null
+	 * 
+	 * @return $array
+	 */
+	public function uploadGallery($name, $id_chcreaposts, $dir=null)
+	{
+		$this->id_chcreaposts = $id_chcreaposts;
+		$this->type = 'gallery';
+
+		$dir = $this->getPath($dir);
+
+		$results_imgs = false;
+		if (isset($_FILES[$name]) && isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name'])) {
+
+			$GetAllImageTypes = Chcreaimagetypeclass::GetAllImageTypes('gallery');
+
+			foreach ($_FILES[$name]['name'] as $fileskey => $filesvalue) {
+				// start upload
+				if (isset($_FILES[$name]) && isset($_FILES[$name]['tmp_name'][$fileskey]) && !empty($_FILES[$name]['tmp_name'][$fileskey])) {
+					$ext = substr($_FILES[$name]['name'][$fileskey], strrpos($_FILES[$name]['name'][$fileskey], '.') + 1);
+					$basename_file_name = basename($_FILES[$name]["name"][$fileskey]);
+					$strlen = strlen($basename_file_name);
+					$strlen_ext = strlen($ext);
+					$basename_file_name = substr($basename_file_name, 0, ($strlen-$strlen_ext));
+					$link_rewrite_file_name = Tools::link_rewrite($basename_file_name);
+					$file_name = $link_rewrite_file_name.'.'.$ext;
+					$path = $dir.$file_name;
+
+					if(move_uploaded_file($_FILES[$name]['tmp_name'][$fileskey], $path)) {
+						if(isset($GetAllImageTypes) && !empty($GetAllImageTypes)) {
+							foreach($GetAllImageTypes as $imagetype) {
+								ImageManager::resize(
+									$path, 
+									$dir.$imagetype['name'].'-'.$file_name, 
+									(int)$imagetype['width'], 
+									(int)$imagetype['height'], $ext
+								);
+							}
+						}
+						$this->name = $file_name;
+						if ( $this->add() ) {
+							$results_imgs = true;
+						}
+					}
+				}
+				// end upload
+			}
+			return $results_imgs;
+		} else {
+			return $results_imgs;
+		}
+	}
+
+		/**
+	 * @param mixed $name
+	 * @param mixed $dir=null
+	 * 
+	 * @return $string
+	 */
+	public function uploadMedia($name, $id_chcreaposts, $dir=null)
+	{
+		$this->id_chcreaposts = $id_chcreaposts;
+		$this->type = 'post';
+
+		$dir = $this->getPath($dir);
+
+		$file_name = false;
+		if (isset($_FILES[$name]) && isset($_FILES[$name]['tmp_name']) && !empty($_FILES[$name]['tmp_name'])) {
+			$ext = substr($_FILES[$name]['name'], strrpos($_FILES[$name]['name'], '.') + 1);
+			$basename_file_name = basename($_FILES[$name]["name"]);
+			$strlen = strlen($basename_file_name);
+			$strlen_ext = strlen($ext);
+			$basename_file_name = substr($basename_file_name, 0, ($strlen-$strlen_ext));
+			$link_rewrite_file_name = Tools::link_rewrite($basename_file_name);
+			$file_name = $link_rewrite_file_name.'.'.$ext;
+			$path = $dir.$file_name;
+			$GetAllImageTypes = Chcreaimagetypeclass::GetAllImageTypes('main');
+			if(!move_uploaded_file($_FILES[$name]['tmp_name'], $path)) {
+				return false;
+			} else {
+				if(isset($GetAllImageTypes) && !empty($GetAllImageTypes)) {
+					foreach($GetAllImageTypes as $imagetype) {
+						ImageManager::resize($path, $dir.$imagetype['name'].'-'.$file_name, (int)$imagetype['width'], (int)$imagetype['height'], $ext);
+					}
+				}
+				$this->name = $file_name;
+				if ( $this->addUnique() ) {
+					return true;
+				}
+				return false;
+			}
+		} else {
+			return $file_name;
+		}
+	}
+}

+ 62 - 0
classes/chcreaimagetype.php

@@ -0,0 +1,62 @@
+<?php
+
+class Chcreaimagetypeclass extends ObjectModel
+{
+	public $id;
+	public $id_chcrea_image_type;
+	public $name;
+	public $width;
+	public $height;
+	public $id_shop;
+	public $active;
+	public static $definition = array(
+		'table' => 'chcrea_image_type',
+		'primary' => 'id_image_type',
+		'multilang' => false,
+		'fields' => array(
+			'name' =>	array('type' => self::TYPE_STRING, 'validate' => 'isString'),
+			'width' =>	array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),
+			'height' =>	array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),
+			'id_shop' =>array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),
+			'active' =>	array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
+		),
+	);
+	public function __construct($id = null, $id_lang = null, $id_shop = null)
+	{
+        parent::__construct($id, $id_lang, $id_shop);
+    }
+    public function update($null_values = false)
+    {
+        if(!parent::update($null_values))
+            return false;
+        return true;
+    }
+    public function add($autodate = true, $null_values = false)
+    {
+    	$this->id_shop = (int)Context::getContext()->shop->id;
+        if(!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this))
+            return false;
+        return true;
+    }
+    public static function GetAllImageTypes($prefix = null)
+    {
+       $id_shop = (int)Context::getContext()->shop->id;
+       $sql = 'SELECT * FROM `'._DB_PREFIX_.'chcrea_image_type` ';
+       $sql .= ' WHERE id_shop = '.(int)$id_shop;
+
+		if ( $prefix != null ) {
+			$sql .= ' AND `name` like "%'.$prefix.'%"';
+		}
+       
+		$queryexec = Db::getInstance()->executeS($sql);
+       
+	   if(isset($queryexec) && !empty($queryexec)){
+       		return $queryexec;
+       }else{
+	       	$sql2 = 'SELECT * FROM `'._DB_PREFIX_.'chcrea_image_type` ';
+	       	$sql2 .= ' WHERE 1';
+	       	$queryexec2 = Db::getInstance()->executeS($sql2);
+	       	return $queryexec2;
+       }
+    }
+}

+ 590 - 0
classes/chcreapost.php

@@ -0,0 +1,590 @@
+<?php
+
+include_once _PS_MODULE_DIR_.'chcreateur/config/define.inc.php';
+include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreaimages.php';
+
+use PrestaShop\PrestaShop\Adapter\Category\CategoryProductSearchProvider;
+use PrestaShop\PrestaShop\Adapter\Image\ImageRetriever;
+use PrestaShop\PrestaShop\Adapter\Product\PriceFormatter;
+use PrestaShop\PrestaShop\Adapter\Product\ProductColorsRetriever;
+use PrestaShop\PrestaShop\Core\Product\ProductListingPresenter;
+use PrestaShop\PrestaShop\Core\Product\Search\ProductSearchContext;
+use PrestaShop\PrestaShop\Core\Product\Search\ProductSearchQuery;
+use PrestaShop\PrestaShop\Core\Product\Search\SortOrder;
+
+
+class Chcreapost extends ObjectModel
+{
+	public $id;
+	public $id_chcreaposts;
+	public $post_author;
+	public $post_date;
+	public $post_modified;
+	public $comment_status;
+	public $post_password;
+	public $post_format;
+	public $comment_count;
+	public $post_title;
+	public $post_excerpt;
+	public $post_content;
+	public $post_img;
+	public $link_rewrite;
+	public $position;
+	public $active;
+	public $video;
+	public $audio;
+	public $gallery;
+	public $meta_title;
+	public $meta_description;
+	public $meta_keyword;
+	public $related_products;
+	public static $definition = [
+		'table' => 'chcreaposts',
+		'primary' => 'id_chcreaposts',
+		'multilang' => true,
+		'fields' => [
+			'post_title' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => true],
+			'meta_title' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => true],
+			'post_excerpt' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => true],
+			'meta_description' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => true],
+			'meta_keyword' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => true],
+			'post_content' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml', 'lang' => true],
+			'link_rewrite' => ['type' => self::TYPE_STRING, 'validate' => 'isString', 'lang' => true],
+			'related_products' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'],
+			'video' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'],
+			'audio' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'],
+			'gallery' => ['type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'],
+			'post_password' => ['type' => self::TYPE_STRING, 'validate' => 'isString'],
+			'post_format' => ['type' => self::TYPE_STRING, 'validate' => 'isString'],
+			'post_date' => ['type' => self::TYPE_DATE, 'validate' => 'isString'],
+			'post_modified' => ['type' => self::TYPE_DATE, 'validate' => 'isString'],
+			'post_img' => ['type' => self::TYPE_DATE, 'validate' => 'isString'],
+			'post_author' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt'],
+			'comment_status' => ['type' => self::TYPE_STRING, 'validate' => 'isString'],
+			'comment_count' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt'],
+			'position' => ['type' => self::TYPE_INT, 'validate' => 'isunsignedInt'],
+			'active' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'],
+		],
+	];
+
+	public function __construct($id = null, $id_lang = null, $id_shop = null)
+	{
+		
+		
+		
+		// print("<pre>".print_r($_POST, true)."</pre>");
+		// exit();
+		
+		Shop::addTableAssociation('chcreaposts', ['type' => 'shop']);
+		parent::__construct($id, $id_lang, $id_shop);
+	}
+
+	/**
+	 * @param bool $null_values
+	 * 
+	 * @return [type]
+	 */
+	public function update($null_values = false)
+	{
+		 //print('<pre>'.print_r($_POST,true).'</pre>');
+		//  print('<pre>'.print_r($_FILES,true).'</pre>');
+		//  exit();
+
+		if (isset($_FILES['post_img'], $_FILES['post_img']['tmp_name']) && !empty($_FILES['post_img']['tmp_name'][0])) {
+			$Chcreaimages = new Chcreaimages();
+			if ( !$Chcreaimages->uploadMedia('post_img', $this->id) ) {
+				return false;
+			}
+		}
+		if (isset($_POST['related_products_temp']) && !empty($_POST['related_products_temp']) && is_array($_POST['related_products_temp'])) {
+			$this->related_products = @implode(',', $_POST['related_products_temp']);
+		}
+
+		if (isset($_POST['gallery_temp_delete']) && !empty($_POST['gallery_temp_delete'])) {
+			$gallery_temp_delete = @explode(',', $_POST['gallery_temp_delete']);
+			if ( count($gallery_temp_delete) > 0 ) {
+				$Chcreaimages = new Chcreaimages();
+				$Chcreaimages->deleteSelection($gallery_temp_delete);
+			}
+		}
+
+		if ( isset($_FILES['gallery_temp'], $_FILES['gallery_temp']['tmp_name']) && !empty($_FILES['gallery_temp']['tmp_name'][0]) ) {
+				$Chcreaimages = new Chcreaimages();
+			if ( !$Chcreaimages->uploadGallery('gallery_temp', $this->id) ) {
+				return false;
+			}
+		}
+
+		$this->post_modified = date('Y-m-d H:i:s');
+
+		// if (empty($this->post_img) && isset($this->id)) {
+		// 	$chcreapost = new Chcreapost($this->id);
+		// 	$this->post_img = $chcreapost->post_img;
+		// }
+
+		return parent::update($null_values);
+	}
+
+	/**
+	 * @param bool $autodate
+	 * @param bool $null_values
+	 * 
+	 * @return [type]
+	 */
+	public function add($autodate = true, $null_values = false)
+	{
+		if (isset($_POST['related_products_temp']) && !empty($_POST['related_products_temp']) && is_array($_POST['related_products_temp'])) {
+			$this->related_products = @implode(',', $_POST['related_products_temp']);
+		}
+		$this->post_author = (int) Context::getContext()->employee->id;
+		$this->post_date = date('Y-m-d H:i:s');
+		$this->post_modified = date('Y-m-d H:i:s');
+
+		if ($this->position <= 0) {
+				$this->position = self::getHigherPosition() + 1;
+		}
+
+
+		if (!parent::add($autodate, $null_values)
+				|| !Validate::isLoadedObject($this)) {
+			return false;
+		}
+
+		if (isset($_FILES['post_img'], $_FILES['post_img']['tmp_name']) && !empty($_FILES['post_img']['tmp_name'][0])) {
+			$Chcreaimages = new Chcreaimages();
+			if ( !$Chcreaimages->uploadMedia('post_img', $this->id) ) {
+				return false;
+			}
+			
+		}
+		if ( isset($_FILES['gallery_temp'], $_FILES['gallery_temp']['tmp_name']) && !empty($_FILES['gallery_temp']['tmp_name'][0]) ) {
+			$Chcreaimages = new Chcreaimages();
+			if ( !$Chcreaimages->uploadGallery('gallery_temp', $this->id) ) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	public function getSrcFromIframe($video_temp)
+	{
+		$sContent = htmlspecialchars($video_temp);
+
+		$dom = new DomDocument;
+
+		@$dom->loadHTML( $video_temp );
+
+		$elems = $dom->getElementsByTagName('iframe');
+
+		if ( count($elems) < 0 ) {
+			return null;
+		}
+
+		foreach ( $elems as $elm ) {
+			if ( $elm->hasAttribute('src') )
+				$srcs[] = $elm->getAttribute('src');
+		}
+
+		return $srcs;
+	}
+
+	public static function getHigherPosition()
+    {
+        $sql = 'SELECT MAX(`position`)
+        FROM `'._DB_PREFIX_.'chcreaposts`';
+
+        $position = DB::getInstance()->getValue($sql);
+
+        return (is_numeric($position)) ? $position : -1;
+    }
+
+	/**
+	 * @return [type]
+	 */
+	public static function getAllSelections($limit=null)
+	{
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+		
+		//$sql  = ' SELECT xc.`id_chcreaposts`,xcl.`post_title`,xcl.`link_rewrite` ';
+		$sql  = ' SELECT * ';
+		$sql .= ' FROM `'._DB_PREFIX_.'chcreaposts` xc';
+		$sql .= ' INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.')';
+		$sql .= ' INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.')';
+		$sql .= ' WHERE xc.`active` = 1 ';
+		$sql .= ' ORDER BY xc.`position` ASC';
+		if ( $limit != null ) {
+			$sql .= ' LIMIT '.$limit;
+		}
+
+		$queryexec = Db::getInstance()->executeS($sql);
+
+		if (isset($queryexec) && !empty($queryexec)) {
+			$i = 0;
+			foreach ($queryexec as $qlvalue) {
+				if (isset($qlvalue) && !empty($qlvalue)) {
+					foreach ($qlvalue as $qkey => $qvalue) {
+						$results[$i][$qkey] = $qvalue;
+						// start Image
+						if ('post_img' == $qkey) {
+							$Chcreaimages = new Chcreaimages();
+							$tmp = $Chcreaimages->getAllUrls($qlvalue['id_chcreaposts'], 'post');
+
+							$results[$i]['post_img'] = array_shift($tmp);
+						}
+						// end Image
+						if ('post_author' == $qkey) {
+							$post_author_arr = new Employee((int) $qvalue);
+							$results[$i]['post_author_arr']['lastname'] = $post_author_arr->lastname;
+							$results[$i]['post_author_arr']['firstname'] = $post_author_arr->firstname;
+						}
+						// TODO
+						$results[$i]['link'] = self::getBaseLink($id_shop) . 'noscreateurs/' . $qlvalue['id_chcreaposts'] . '_' . $qlvalue['link_rewrite'];
+						//$results[$i]['post_tags'] = self::GetPostTagsResults($qlvalue['id_xipposts'], 'tag');
+						if (isset($qlvalue['audio']) && !empty($qlvalue['audio'])) {
+							$results[$i]['audio'] = self::getSrcFromIframe($qlvalue['audio']);
+						}
+						if (isset($qlvalue['video']) && !empty($qlvalue['video'])) {
+							$results[$i]['video'] = self::getSrcFromIframe($qlvalue['video']);
+						}
+
+						if ('gallery' == $qkey) {
+							$Chcreaimages = new Chcreaimages();
+							$results[$i]['gallery_lists'] = $Chcreaimages->getAllUrls($qlvalue['id_chcreaposts'], 'gallery');
+						}
+
+					}
+				}
+				++$i;
+			}
+		}
+
+		return $results;
+	}
+
+	public static function getSinglePost($id_chcreaposts = null, $post_type = 'post')
+	{
+		if (null == $id_chcreaposts) {
+			return false;
+		}
+		$results = [];
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+
+		$sql = 'SELECT * FROM `'._DB_PREFIX_.'chcreaposts` xc
+			   INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.')
+			   INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.')
+			   ';
+		$sql .= ' WHERE xc.id_chcreaposts = '.(int) $id_chcreaposts;
+
+		$queryexec = Db::getInstance()->getrow($sql);
+
+		if (isset($queryexec) && !empty($queryexec)) {
+			foreach ($queryexec as $qkey => $qvalue) {
+				$results[$qkey] = $qvalue;
+				// start Image
+				if ('post_img' == $qkey) {
+					$Chcreaimages = new Chcreaimages();
+					$tmp = $Chcreaimages->getAllUrls($id_chcreaposts, 'post');
+					$results['post_img'] = array_shift($tmp);
+				}
+				// end Image
+				if ( 'link_rewrite' == $qkey ) {
+					$results['link'] = self::getBaseLink($id_shop) . 'createur/' . $id_chcreaposts . '_' . $qvalue;
+				}
+				if ('post_author' == $qkey) {
+					$post_author_arr = new Employee((int) $qvalue);
+					$results['post_author_arr']['lastname'] = $post_author_arr->lastname;
+					$results['post_author_arr']['firstname'] = $post_author_arr->firstname;
+				}
+				if ('audio' == $qkey && !empty($qvalue)) {
+					$results['audio'] = self::getSrcFromIframe($qvalue);
+				}
+				if ('video' == $qkey && !empty($qvalue)) {
+					$results['video'] = self::getSrcFromIframe($qvalue);
+				}
+				if ('gallery' == $qkey) {
+					$Chcreaimages = new Chcreaimages();
+					$results['gallery_lists'] = $Chcreaimages->getAllUrls($id_chcreaposts, 'gallery');
+				}
+				if ('related_products' == $qkey) {
+					if ( !empty($qvalue) ) {
+						$prod_temp = @explode(',', $qvalue);
+						$results['related_products'] = self::getViewedProducts($prod_temp);	
+					} else {
+						unset($results['related_products']);
+					}
+				}
+			}
+		}
+		return $results;
+	}
+
+
+	public static function getsinglepath($id_chcreaposts = null, $post_type = 'post')
+	{
+		if (null == $id_chcreaposts) {
+			return false;
+		}
+		$pipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
+		$posts = self::get_the_title($id_chcreaposts, $post_type);
+		//$category_default = $posts['category_default'] ? $posts['category_default'] : null;
+		//$categories = self::get_the_category($category_default);
+		// TODO title categorie
+		$title = "Notre createur"; //$categories['name'] ? $categories['name'] : '';
+		//
+		$name = $posts['post_title'];
+		$params['id'] = $categories['id_xipcategory'] ? $categories['id_xipcategory'] : 0;
+		$params['rewrite'] = $categories['link_rewrite'] ? $categories['link_rewrite'] : '';
+		$params['page_type'] = 'category';
+		$params['subpage_type'] = $post_type ? $post_type : 'post';
+		$link = xipblog::XipBlogCategoryLink($params);
+		$meta_title = Configuration::get(xipblog::$xipblogshortname.'meta_title');
+		$meta_title = (isset($meta_title) ? $meta_title : 'Blog');
+		$blog_url = xipblog::XipBlogLink();
+		$full_paths = '<a href="'.$blog_url.'" title="'.$meta_title.'" data-gg="">'.$meta_title.'</a><span class="navigation-pipe">'.$pipe.'</span>';
+
+		$str = '<a href="'.$link.'" title="'.$title.'" data-gg="">'.$title.'</a><span class="navigation-pipe">'.$pipe.'</span>'.$name;
+
+		return $full_paths.$str;
+	}
+
+	public static function getTopPosition()
+	{
+		$sql = 'SELECT MAX(`position`)
+				FROM `'._DB_PREFIX_.'chcreaposts`';
+		$position = DB::getInstance()->getValue($sql);
+
+		return (is_numeric($position)) ? $position : -1;
+	}
+
+	public function updatePosition($way, $position)
+	{
+		if (!$res = Db::getInstance()->executeS(
+			'
+			SELECT `id_chcreaposts`, `position`
+			FROM `'._DB_PREFIX_.'chcreaposts`
+			ORDER BY `position` ASC'
+		)) {
+			return false;
+		}
+		if (!empty($res)) {
+			foreach ($res as $chcreaposts) {
+				if ((int) $chcreaposts['id_chcreaposts'] == (int) $this->id) {
+					$moved_chcreaposts = $chcreaposts;
+				}
+			}
+		}
+
+		if (!isset($moved_chcreaposts) || !isset($position)) {
+			return false;
+		}
+		$queryx = ' UPDATE `'._DB_PREFIX_.'chcreaposts`
+		SET `position`= `position` '.($way ? '- 1' : '+ 1').'
+		WHERE `position`
+		'.($way
+		? '> '.(int) $moved_chcreaposts['position'].' AND `position` <= '.(int) $position
+		: '< '.(int) $moved_chcreaposts['position'].' AND `position` >= '.(int) $position.'
+		');
+		$queryy = ' UPDATE `'._DB_PREFIX_.'chcreaposts`
+		SET `position` = '.(int) $position.'
+		WHERE `id_chcreaposts` = '.(int) $moved_chcreaposts['id_chcreaposts'];
+
+		return Db::getInstance()->execute($queryx)
+		&& Db::getInstance()->execute($queryy);
+	}
+
+
+	public static function get_the_title($id_chcreaposts = null, $post_type = 'post')
+	{
+		if (null == $id_chcreaposts) {
+			return false;
+		}
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+		$sql = 'SELECT xc.`id_chcreaposts`,xcl.`post_title`,xcl.`link_rewrite` FROM `'._DB_PREFIX_.'chcreaposts` xc
+		INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.')
+		INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.')
+		';
+		$sql .= ' WHERE xc.`post_type` = "'.($post_type ? pSQL($post_type) : 'post').'" AND xc.`id_chcreaposts` = '.$id_chcreaposts;
+
+		return Db::getInstance()->getrow($sql);
+	}
+
+	public static function get_the_id($rewrite = null, $post_type = 'post')
+	{
+		if (null == $rewrite) {
+			return false;
+		}
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+		$sql = 'SELECT xc.`id_chcreaposts` FROM `'._DB_PREFIX_.'chcreaposts` xc INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.') INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.') ';
+		$sql .= ' WHERE xc.`post_type` = "'.($post_type ? pSQL($post_type) : 'post').'" AND xcl.`link_rewrite` = "'.pSQL($rewrite).'" ';
+		$rslts = Db::getInstance()->getrow($sql);
+
+		return isset($rslts['id_chcreaposts']) ? $rslts['id_chcreaposts'] : null;
+	}
+
+	public function getNextPost($position)
+	{
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+		$sql = ' SELECT * FROM `'._DB_PREFIX_.'chcreaposts` xc ';
+		$sql .= ' INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.')';
+		$sql .= ' INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.')';
+		$sql .= ' WHERE xc.`position` > '.$position;
+		$sql .= ' AND xc.`active` = 1';
+		$sql .= ' ORDER BY xc.`position` ASC';
+		$rslt = Db::getInstance()->getrow($sql);
+		if (empty($rslt)) {
+			return null;
+		}
+		$rslt['link'] = '/createur/'.$rslt['id_chcreaposts'].'_'.$rslt['link_rewrite'];
+
+		return $rslt;
+	}
+
+	public function getPreviousPost($position)
+	{
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+		$sql = ' SELECT * FROM `'._DB_PREFIX_.'chcreaposts` xc ';
+		$sql .= ' INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.')';
+		$sql .= ' INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.')';
+		$sql .= ' WHERE xc.`position` < '.$position;
+		$sql .= ' AND xc.`active` = 1';
+		$sql .= ' ORDER BY xc.`position` DESC';
+
+
+		//print($sql);
+
+		$rslt = Db::getInstance()->getrow($sql);
+		if (empty($rslt)) {
+			return null;
+		}
+		$rslt['link'] = '/createur/'.$rslt['id_chcreaposts'].'_'.$rslt['link_rewrite'];
+
+		return $rslt;
+	}
+
+	public static function PostExists($id_chcreaposts = null, $post_type = 'post')
+	{
+		if (null == $id_chcreaposts || 0 == $id_chcreaposts) {
+			return false;
+		}
+		$sql = 'SELECT xc.`id_chcreaposts` FROM `'._DB_PREFIX_.'chcreaposts` xc WHERE xc.`post_type` = "'.($post_type ? $post_type : 'post').'" AND xc.active = 1 AND xc.`id_chcreaposts` = '.$id_chcreaposts;
+		$rslts = Db::getInstance()->getrow($sql);
+
+		return (isset($rslts['id_chcreaposts']) && !empty($rslts['id_chcreaposts'])) ? true : false;
+	}
+
+	public static function get_the_rewrite($id = null, $post_type = 'post')
+	{
+		if (null == $id) {
+			return false;
+		}
+		$id_lang = (int) Context::getContext()->language->id;
+		$id_shop = (int) Context::getContext()->shop->id;
+		$sql = 'SELECT xcl.`link_rewrite` FROM `'._DB_PREFIX_.'chcreaposts` xc INNER JOIN `'._DB_PREFIX_.'chcreaposts_lang` xcl ON (xc.`id_chcreaposts` = xcl.`id_chcreaposts` AND xcl.`id_lang` = '.$id_lang.') INNER JOIN `'._DB_PREFIX_.'chcreaposts_shop` xcs ON (xc.`id_chcreaposts` = xcs.`id_chcreaposts` AND xcs.`id_shop` = '.$id_shop.') ';
+		$sql .= ' WHERE xc.`post_type` = "'.($post_type ? $post_type : 'post').'" AND xc.`id_chcreaposts` = "'.$id.'" ';
+		$rslts = Db::getInstance()->getrow($sql);
+
+		return isset($rslts['link_rewrite']) ? $rslts['link_rewrite'] : null;
+	}
+
+	public static function ImageExists($file = null)
+	{
+		if (null == $file) {
+			return false;
+		}
+		$image = chcrea_img_dir.$file;
+		if (file_exists($image)) {
+			return true;
+		}
+
+		return false;
+	}
+
+	public static function PostCountUpdate($id = null)
+	{
+		if (null == $id || 0 == $id) {
+			return false;
+		}
+		$sql = 'UPDATE '._DB_PREFIX_.'chcreaposts as xc SET xc.comment_count = (xc.comment_count+1) where xc.id_chcreaposts = '.(int) $id;
+		if (Db::getInstance()->execute($sql)) {
+			return true;
+		}
+
+		return false;
+	}
+
+
+	/**
+	 * @param mixed $productIds
+	 * 
+	 * @return [type]
+	 */
+	protected function getViewedProducts($productIds)
+	{
+		if (!empty($productIds)) {
+			$context = Context::getContext();
+			$assembler = new ProductAssembler($context);
+
+			$presenterFactory = new ProductPresenterFactory($context);
+			$presentationSettings = $presenterFactory->getPresentationSettings();
+			$presenter = new ProductListingPresenter(
+				new ImageRetriever(
+					$context->link
+				),
+				$context->link,
+				new PriceFormatter(),
+				new ProductColorsRetriever(),
+				$context->getTranslator()
+			);
+
+			$products_for_template = [];
+
+			if (is_array($productIds)) {
+				foreach ($productIds as $productId) {
+					// if ($this->currentProductId !== $productId) {
+					$products_for_template[] = $presenter->present(
+						$presentationSettings,
+						$assembler->assembleProduct(['id_product' => $productId]),
+						$context->language
+					);
+					// }
+				}
+			}
+			return $products_for_template;
+		}
+		return false;
+	}
+
+
+	public static function getBaseLink($id_shop = null, $ssl = null, $relative_protocol = false)
+	{
+		static $force_ssl = null;
+
+		if ($ssl === null) {
+			if ($force_ssl === null) {
+				$force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
+			}
+			$ssl = $force_ssl;
+		}
+
+		if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null) {
+			$shop = new Shop($id_shop);
+		} else {
+			$shop = Context::getContext()->shop;
+		}
+
+		if ($relative_protocol) {
+			$base = '//'.($ssl ? $shop->domain_ssl : $shop->domain);
+		} else {
+			$base = (($ssl) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
+		}
+
+		return $base.$shop->getBaseURI();
+	}
+}

+ 31 - 0
config/define.inc.php

@@ -0,0 +1,31 @@
+<?php
+if (!defined('chcrea_dir')) {
+	define('chcrea_dir', _PS_MODULE_DIR_.'chcreateur/');
+}
+if (!defined('chcrea_theme_dir')) {
+	define('chcrea_theme_dir', _PS_MODULE_DIR_.'chcreateur/views/templates/front/');
+}
+if (!defined('chcrea_uri')) {
+	define('chcrea_uri', __PS_BASE_URI__.'modules/chcreateur/');
+}
+if (!defined('chcrea_img_dir')) {
+	define('chcrea_img_dir', _PS_MODULE_DIR_.'chcreateur/img/');
+}
+if (!defined('chcrea_img_uri')) {
+	define('chcrea_img_uri', __PS_BASE_URI__.'modules/chcreateur/img/');
+}
+if (!defined('chcrea_css_dir')) {
+	define('chcrea_css_dir', _PS_MODULE_DIR_.'chcreateur/css/');
+}
+if (!defined('chcrea_css_uri')) {
+	define('chcrea_css_uri', __PS_BASE_URI__.'modules/chcreateur/css/');
+}
+if (!defined('chcrea_js_dir')) {
+	define('chcrea_js_dir', _PS_MODULE_DIR_.'chcreateur/js/');
+}
+if (!defined('chcrea_js_uri')) {
+	define('chcrea_js_uri', __PS_BASE_URI__.'modules/chcreateur/js/');
+}
+if (!defined('chcrea_tpl_dir')) {
+	define('chcrea_tpl_dir','chcreateur/views/templates/front/');
+}

+ 13 - 0
config_fr.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<module>
+    <name>chselection</name>
+    <displayName><![CDATA[CH selection]]></displayName>
+    <version><![CDATA[1.0.0]]></version>
+    <description><![CDATA[Presentation d&#039;une selection ]]></description>
+    <author><![CDATA[Cedric Hansen]]></author>
+    <tab><![CDATA[front_office_features]]></tab>
+	<confirmUninstall><![CDATA[Are you sure you want to uninstall?]]></confirmUninstall>
+    <is_configurable>1</is_configurable>
+    <need_instance>0</need_instance>
+	<limited_countries></limited_countries>
+</module>

+ 509 - 0
controllers/admin/AdminChcreateur.php

@@ -0,0 +1,509 @@
+<?php
+
+include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreapost.php';
+include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreaimages.php';
+
+
+
+class AdminChcreateurController extends ModuleAdminController
+{
+	public function __construct()
+	{
+		$this->table = 'chcreaposts';
+		$this->className = 'Chcreapost';
+		$this->name = 'AdminChcreateur';
+		$this->lang = true;
+		$this->deleted = false;
+		$this->module = 'chcreateur';
+		$this->position_identifier = 'id_chcreaposts';
+		$this->allow_export = false;
+		$this->bootstrap = true;
+		if (Shop::isFeatureActive()) {
+			Shop::addTableAssociation($this->table, ['type' => 'shop']);
+		}
+		parent::__construct();
+
+		$this->fields_list = [
+			'id_chcreaposts' => [
+				'title' => $this->l('Id'),
+				'width' => 100,
+				'type' => 'text',
+			],
+			'id_temp' => [
+				'title' => 'Image',
+				'align' => 'center',
+				'callback' => 'getImage',
+
+			],
+			'post_title' => [
+				'title' => $this->l('Post Title'),
+				'width' => 60,
+				'type' => 'text',
+			],
+			'post_excerpt' => [
+				'title' => $this->l('Excerpt'),
+				'width' => 220,
+				'type' => 'text',
+			],
+			'link_rewrite' => [
+				'title' => $this->l('URL Rewrite'),
+				'width' => 220,
+				'type' => 'text',
+			],
+			'post_format' => [
+				'title' => $this->l('Format'),
+				'width' => 20,
+				'type' => 'text',
+			],
+			'position' => [
+				'title' => $this->l('Position'),
+				'align' => 'left',
+				'filter_key' => 'a!position',
+				'position' => 'position',
+				// 'orderby' => false
+			],
+			/*
+			'post_date' => [
+				'title' => $this->l('Date'),
+				'align' => 'text-right',
+				'type' => 'datetime',
+				'filter_key' => 'post_date',
+			],
+			*/
+			'active' => [
+				'title' => $this->l('Status'),
+				'width' => 60,
+				'align' => 'center',
+				'active' => 'status',
+				'type' => 'bool',
+				'orderby' => false,
+			],
+		];
+		$this->bulk_actions = [
+			'delete' => [
+				'text' => $this->l('Delete selected'),
+				'icon' => 'icon-trash',
+				'confirm' => $this->l('Delete selected items?'),
+			],
+		];
+		parent::__construct();
+	}
+
+	public function getImage($id, $col)
+	{
+		$Chcreaimages = new Chcreaimages();
+		$imgs = $Chcreaimages->getUrls($id);
+		if ( count($imgs) < 1  ) {
+			$html = '';
+		} else {
+			$html = '<a href="#"><img src="'.$imgs[0].'" height="50px" ></a>';
+		}
+		return $html;
+	}
+
+	public function __initToolbar()
+	{
+		parent::initToolbar();
+		/*
+		$this->toolbar_btn['custom'] = array(
+				'href' => '',
+				'desc' => 'Un nouveau'
+		);
+		*/
+		// print_r($this->toolbar_btn);exit();
+	}
+
+	public function init()
+	{
+		parent::init();
+		$this->_join = 'LEFT JOIN '._DB_PREFIX_.'chcreaposts_shop sbp ON a.id_chcreaposts=sbp.id_chcreaposts && sbp.id_shop IN('.implode(',', Shop::getContextListShopID()).')';
+		$this->_select = 'a.`id_chcreaposts` as `id_temp`'; 
+		$this->_orderBy = 'a.position';
+	}
+
+	public function setMedia($isNewTheme = false)
+	{
+		parent::setMedia();
+		$this->addJqueryUi('ui.widget');
+		$this->addJqueryPlugin('tagify');
+		$this->addJqueryPlugin('select2');
+
+		//$this->context->controller->addJS(chcrea_js_dir.'validator.min.js');
+	}
+
+	public function renderForm()
+	{
+		$id_chcreaposts = Tools::getValue('id_chcreaposts');
+		$audio_temp = '';
+		$video_temp = '';
+		$gallery_temp = [];
+		$gallery_temp_str = '';
+		$post_img_temp = '';
+		$prod_temp = '';
+		$gallery_url = chcrea_img_uri;
+
+		if (isset($id_chcreaposts) && !empty($id_chcreaposts)) {
+			$Chcreapost = new Chcreapost($id_chcreaposts);
+			if (isset($Chcreapost->audio) && !empty($Chcreapost->audio)) {
+				$audio_temp = @explode(',', $Chcreapost->audio);
+			}
+			if (isset($Chcreapost->related_products) && !empty($Chcreapost->related_products)) {
+				$prod_temp = @explode(',', $Chcreapost->related_products);
+			}
+			if (isset($Chcreapost->video) && !empty($Chcreapost->video)) {
+				//$video_temp = @explode(',', $Chcreapost->video);
+				$video_temp = $Chcreapost->video;
+			}
+			// if (isset($Chcreapost->gallery) && !empty($Chcreapost->gallery)) {
+			// 	$gallery_temp = @explode(',', $Chcreapost->gallery);
+			// 	$gallery_temp_str = $Chcreapost->gallery;
+			// }
+			// if (isset($Chcreapost->post_img) && !empty($Chcreapost->post_img)) {
+			// 	$post_img_temp = '<img src="'.chcrea_img_uri.$Chcreapost->post_img.'" height="110" width="auto"><br>';
+			// }
+			$Chcreaimages = new Chcreaimages();
+			$imgs = $Chcreaimages->getUrls($id_chcreaposts);
+			if ( is_array($imgs) ){
+				foreach($imgs as $img) {
+					$post_img_temp .= '<img src="'.$img.'" height="110" width="auto"><br>';
+				}
+			}
+			$gallery_url = chcrea_img_uri.'/'. $id_chcreaposts .'/';
+			$Chcreaimages = new Chcreaimages();
+			$imgs = $Chcreaimages->getGallery($id_chcreaposts);
+			foreach($imgs as $value) {
+
+				$gallery_temp[$value['id_images']] = $value['name'];
+			}
+
+			// print("<pre>".print_r($gallery_temp,true)."</pre>");
+			// exit();
+
+
+		}
+		$this->fields_form = [
+			'description' => "Le format des images : 1200 x 678",
+			'legend' => [
+				'title' => $this->l('Add New Post'),
+			],
+			'input' => [
+				/*
+				[
+					'type' => 'radio',
+					'label' => $this->l('Post Format'),
+					'name' => 'post_format',
+					'required' => false,
+					'class' => 't',
+					'is_bool' => true,
+					'values' => [
+						[
+							'id' => 'standrad',
+							'value' => 'standrad',
+							'label' => $this->l('Standard'),
+						],
+						[
+							'id' => 'gallery',
+							'value' => 'gallery',
+							'label' => $this->l('Gallery'),
+						],
+						[
+							'id' => 'video',
+							'value' => 'video',
+							'label' => $this->l('Video'),
+						],
+						[
+							'id' => 'audio',
+							'value' => 'audio',
+							'label' => $this->l('Audio'),
+						],
+					],
+				],
+				*/
+				[
+					'type' => 'text',
+					'label' => $this->l('Post Title'),
+					'name' => 'post_title',
+					'id' => 'name', // for copyMeta2friendlyURL compatibility
+					'class' => 'copyMeta2friendlyURL',
+					'desc' => $this->l('Enter Your Blog Post Title'),
+					'lang' => true,
+				],
+				[
+					'type' => 'textarea',
+					'label' => $this->l('Post Excerpt'),
+					'name' => 'post_excerpt',
+					'desc' => $this->l('Enter Your Blog Post Excerpt'),
+					'lang' => true,
+				],
+				[
+					'type' => 'textarea',
+					'label' => $this->l('Post Content'),
+					'name' => 'post_content',
+					'desc' => $this->l('Enter Your Blog Post Content'),
+					'lang' => true,
+					'autoload_rte' => true,
+				],
+				[
+					'type' => 'text',
+					'label' => $this->l('Meta Title'),
+					'name' => 'meta_title',
+					'desc' => $this->l('Enter Your Post Meta Title for SEO'),
+					'lang' => true,
+				],
+				[
+					'type' => 'textarea',
+					'label' => $this->l('Meta Description'),
+					'name' => 'meta_description',
+					'desc' => $this->l('Enter Your Post Meta Description for SEO'),
+					'lang' => true,
+				],
+				[
+					'type' => 'tags',
+					'label' => $this->l('Meta Keyword'),
+					'name' => 'meta_keyword',
+					'desc' => $this->l('Enter Your Post Meta Keyword for SEO. Separate by comma(,)'),
+					'lang' => true,
+				],
+				
+				[
+					'type' => 'file',
+					'label' => "Meta Image </br> 1200 x 678",
+					'name' => 'post_img',
+					'desc' => $post_img_temp.$this->l('Format Please Upload Feature Image From Your Computer.'),
+				],
+				
+				[
+					'type' => 'select_multiple',
+					// 'type' => 'select',
+					'label' => $this->l('Select Related Products'),
+					'name' => 'related_products_temp',
+					'defaults' => $prod_temp,
+					'options' => [
+						'query' => self::getallproducts(),
+						'id' => 'id',
+						'name' => 'name',
+					],
+				],
+				[
+					'type' => 'gallery',
+					'label' => "Image dans l'article </br> 1200 x 678",
+					'name' => 'gallery_temp',
+					'defaults' => $gallery_temp,
+					'defaults_str' => $gallery_temp_str,
+					'url' => $gallery_url,
+					'desc' => $this->l('Please give Image url for Gallery post. Separate by comma(,). You can add Any Kind of Image URL.'),
+				],
+				/*
+				[
+					// 'type' => 'textarea',
+					'type' => 'textarea',
+					'label' => $this->l('Video'),
+					'name' => 'video_temp',
+					'defaults' => $video_temp,
+					'desc' => $this->l('Please give video iframe url for video post. Separate by comma(,). You can add youtube or vimeo video url.'),
+				],
+				*/
+				[
+					// 'type' => 'textarea',
+					'type' => 'textarea',
+					'label' => $this->l('Video'),
+					'name' => 'video',
+					//'defaults' => $video_temp,
+					'desc' => $this->l('Please give video iframe url for video post. Separate by comma(,). You can add youtube or vimeo video url.'),
+				],
+				[
+					'type' => 'textarea',
+					//'type' => 'text_multiple',
+					'label' => $this->l('Audio'),
+					'name' => 'audio',
+					//'name' => 'audio_temp',
+					//'defaults' => $audio_temp,
+					'desc' => $this->l('Please give Audio url for Audio post. Separate by comma(,). You can add any kind of an audio source.'),
+				],
+				[
+					'type' => 'text',
+					'label' => $this->l('URL Rewrite'),
+					'name' => 'link_rewrite',
+					'desc' => $this->l('Enter Your Post Url for SEO'),
+					'lang' => true,
+				],
+				[
+					'type' => 'select',
+					'label' => $this->l('Comment Status'),
+					'name' => 'comment_status',
+					'options' => [
+						'query' => [
+							[
+								'id' => 'open',
+								'name' => 'Open',
+							],
+							[
+								'id' => 'close',
+								'name' => 'Closed',
+							],
+							[
+								'id' => 'disable',
+								'name' => 'Disabled',
+							],
+						],
+						'id' => 'id',
+						'name' => 'name',
+					],
+				],
+				[
+					'type' => 'switch',
+					'label' => $this->l('Status'),
+					'name' => 'active',
+					'required' => false,
+					'class' => 't',
+					'is_bool' => true,
+					'values' => [
+						[
+							'id' => 'active',
+							'value' => 1,
+							'label' => $this->l('Enabled'),
+						],
+						[
+							'id' => 'active',
+							'value' => 0,
+							'label' => $this->l('Disabled'),
+						],
+					],
+				],
+			],
+			'submit' => [
+				'title' => $this->l('Save'),
+				'class' => 'btn btn-default pull-right',
+			],
+		];
+		if (Shop::isFeatureActive()) {
+			$this->fields_form['input'][] = [
+				'type' => 'shop',
+				'label' => $this->l('Shop association:'),
+				'name' => 'checkBoxShopAsso',
+			];
+		}
+		if (!($Chcreapost = $this->loadObject(true))) {
+			return;
+		}
+		$this->setdefaultvalue($Chcreapost);
+		$this->fields_form['submit'] = [
+			'title' => $this->l('Save   '),
+			'class' => 'btn btn-default pull-right',
+		];
+		$this->tpl_form_vars = [
+			'active' => $this->object->active,
+			'PS_ALLOW_ACCENTED_CHARS_URL', (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'),
+		];
+		Media::addJsDef(['PS_ALLOW_ACCENTED_CHARS_URL' => (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')]);
+
+		// print('<pre>'.print_r($this->fields_form,true).'</pre>');exit();
+		// print('<pre>'.print_r($this->override_folder,true).'</pre>');exit();
+
+		return parent::renderForm();
+	}
+
+	public function setdefaultvalue($obj)
+	{
+		if (isset($obj->post_format) && !empty($obj->post_format)) {
+			$this->fields_value['post_format'] = $obj->post_format;
+		} else {
+			$this->fields_value['post_format'] = 'standrad';
+		}
+		if (isset($obj->active) && !empty($obj->active)) {
+			$this->fields_value['active'] = $obj->active;
+		} else {
+			$this->fields_value['active'] = 1;
+		}
+	}
+
+	public function renderList()
+	{
+		if (isset($this->_filter) && '' == trim($this->_filter)) {
+			$this->_filter = $this->original_filter;
+		}
+		$this->addRowAction('edit');
+		$this->addRowAction('delete');
+
+		return parent::renderList();
+	}
+
+	public static function getallproducts()
+	{
+		$rslt = [];
+		$rslt[0]['id'] = 0;
+		$rslt[0]['name'] = 'Select Products';
+		$id_lang = (int) Context::getContext()->language->id;
+		$sql = 'SELECT p.`id_product`, pl.`name`
+				FROM `'._DB_PREFIX_.'product` p
+				'.Shop::addSqlAssociation('product', 'p').'
+				LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
+				WHERE pl.`id_lang` = '.(int) $id_lang.' ORDER BY pl.`name`';
+		$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
+		if (isset($products)) {
+			$i = 1;
+			foreach ($products as $r) {
+				$rslt[$i]['id'] = $r['id_product'];
+				$rslt[$i]['name'] = $r['name'];
+				++$i;
+			}
+		}
+
+		return $rslt;
+	}
+
+	public function processPosition()
+	{
+		// ------------------------------------------------------------------------------
+		// error_log("-----:function:".__FUNCTION__, 0);
+
+		     
+        print_r($_POST);
+        exit();
+
+		if ('1' !== $this->tabAccess['edit']) {
+			$this->errors[] = Tools::displayError('You do not have permission to edit this.');
+		} elseif (!Validate::isLoadedObject($object = new Chcreapost((int) Tools::getValue($this->identifier, Tools::getValue('id_chcreaposts', 1))))) {
+			$this->errors[] = Tools::displayError('An error occurred while updating the status for an object.').' <b>'.
+			$this->table.'</b> '.Tools::displayError('(cannot load object)');
+		}
+		if (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) {
+			$this->errors[] = Tools::displayError('Failed to update the position.');
+		} else {
+			$object->regenerateEntireNtree();
+			Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_chcreaposts = (int) Tools::getValue($this->identifier)) ? ('&'.$this->identifier.'='.$id_chcreaposts) : '').'&token='.Tools::getAdminTokenLite('Adminxipcategory'));
+		}
+	}
+
+	public function ajaxProcessUpdatePositions()
+	{
+		$id_chcreaposts = (int) Tools::getValue('id');
+		$way = (int) Tools::getValue('way');
+		$positions = Tools::getValue($this->table);
+
+		if (is_array($positions)) {
+			foreach ($positions as $key => $value) {
+				$pos = explode('_', $value);
+				if ((isset($pos[1], $pos[2])) && ($pos[2] == $id_chcreaposts)) {
+					$position = $key + 1;
+
+					break;
+				}
+			}
+		}
+		$Chcreapost = new Chcreapost($id_chcreaposts);
+
+		if (Validate::isLoadedObject($Chcreapost)) {
+			if (isset($position) && $Chcreapost->updatePosition($way, $position)) {
+				Hook::exec('action'.$this->className.'Update');
+
+				exit(true);
+			}
+
+			exit('{"hasError" : true, errors : "Can not update Chcreapost position"}');
+		}
+
+		exit('{"hasError" : true, "errors" : "This Chcreapost can not be loaded"}');
+	}
+
+}

+ 57 - 0
controllers/front/archive.php

@@ -0,0 +1,57 @@
+<?php
+
+//use PrestaShop\PrestaShop\Core\Product\Search\Pagination;
+include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreapost.php';
+
+
+class ChcreateurArchiveModuleFrontController extends ModuleFrontController
+{
+
+	public function __construct()
+	{
+	    parent::__construct();
+	    $this->controller_type = 'modulefront';
+		$this->page_name = $this->module->name.'-archive';
+	}
+
+	public function init()
+	{
+		parent::init();
+	}
+
+	public function setMedia($isNewTheme = false)
+	{
+		parent::setMedia();
+		$this->context->controller->addJS(chcrea_js_dir.'chslider.js');
+	}
+
+	public function initContent()
+	{
+		parent::initContent();
+
+		$id_lang = (int)Context::getContext()->language->id;
+
+		$chcreavars = [];
+		$chcreavars['name'] = configuration::get('CHSELECTION_TITLE');
+		$chcreavars['description'] = configuration::get('CHSELECTION_DESCRIPTION');
+		
+		$this->context->smarty->assign('chvars', $chcreavars);
+		$this->context->smarty->assign('chposts', Chcreapost::getAllSelections());
+
+		$this->setTemplate('module:chcreateur/views/templates/front/archive.tpl');
+	}
+
+	public function getBreadcrumbLinks()
+    {
+        $breadcrumb = parent::getBreadcrumbLinks();
+        $breadcrumb['links'][] = [
+            'title' => Configuration::get(strtoupper($this->module->name).'_TITLE'),
+            'url' => '/noscreateurs',
+        ];
+
+        return $breadcrumb;
+    }
+
+
+}
+

+ 76 - 0
controllers/front/single.php

@@ -0,0 +1,76 @@
+<?php
+
+include_once dirname(__FILE__).'/../../classes/chcreapost.php';
+
+class ChcreateursingleModuleFrontController extends ModuleFrontController
+{
+
+	public function __construct()
+	{
+	    parent::__construct();
+	    $this->controller_type = 'modulefront';
+		$this->page_name = $this->module->name.'-single';
+	}
+
+	public function init()
+	{
+		parent::init();
+
+		$rewrite = Tools::getValue('rewrite');
+        $this->id_chcreaposts = Tools::getValue('id');
+		$this->chcreapost = Chcreapost::getSinglePost($this->id_chcreaposts);
+	}
+
+	public function setMedia($isNewTheme = false)
+	{
+		parent::setMedia();
+		$this->context->controller->addJS(chcrea_js_dir.'chslider.js');
+	}
+
+	public function initContent()
+	{
+		parent::initContent();
+
+		$chcreavars = [];
+		$chcreavars['name'] = $this->chcreapost['meta_title'];
+		$chcreavars['description'] = $this->chcreapost['meta_description'];
+		$chcreavars['class'] = $this->module->name.'_post';
+		
+		$this->context->smarty->assign('chvars', $chcreavars);
+		$this->context->smarty->assign('chpost', $this->chcreapost);
+
+		$this->context->smarty->assign('disable_blog_com', true);
+
+		$postNext 	  = Chcreapost::getNextPost($this->chcreapost['position']);
+		$postPrevieus = Chcreapost::getPreviousPost($this->chcreapost['position']);
+
+		//print("next/previous:".$postNext." ".$postPrevieus);
+
+		if (is_array($postNext) && count($postNext) > 0) {
+			$this->context->smarty->assign('link_post_next', $postNext['link']);
+		}
+		if (is_array($postPrevieus) && count($postPrevieus) > 0) {
+			$this->context->smarty->assign('link_post_previeus', $postPrevieus['link']);
+		}
+
+		$this->setTemplate('module:'.$this->module->name.'/views/templates/front/single.tpl');
+
+	}
+
+    public function getBreadcrumbLinks()
+    {
+        $breadcrumb = parent::getBreadcrumbLinks();
+        $breadcrumb['links'][] = [
+            'title' => Configuration::get(strtoupper($this->module->name).'_TITLE'),
+            'url' => '/noscreateurs',
+        ];
+        $breadcrumb['links'][] = [
+            'title' => $this->chcreapost['post_title'],
+            'url' => $this->chcreapost['link'],
+        ];
+        return $breadcrumb;
+    }
+
+
+}
+

+ 89 - 0
db/dbfiles.php

@@ -0,0 +1,89 @@
+<?php
+
+$querys = array();
+
+$querys[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."chcreaposts` (
+  `id_chcreaposts` INT UNSIGNED NOT NULL AUTO_INCREMENT,
+  `post_author` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
+  `post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `comment_status` varchar(20) NOT NULL DEFAULT 'open',
+  `post_password` varchar(20) NOT NULL DEFAULT '',
+  `post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `post_format` varchar(20) NOT NULL DEFAULT 'post',
+  `post_img` varchar(300) NOT NULL DEFAULT '',
+  `video` longtext NOT NULL,
+  `audio` longtext NOT NULL,
+  `gallery` longtext NOT NULL,
+  `related_products` longtext NOT NULL,
+  `comment_count` bigint(20) NOT NULL DEFAULT '0',
+  `position`int(10) NOT NULL ,
+  `active` int(10) NOT NULL,
+  PRIMARY KEY (`id_chcreaposts`)
+) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
+
+$querys[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."chcreaposts_lang` (
+  `id_chcreaposts` INT UNSIGNED NOT NULL AUTO_INCREMENT,
+  `id_lang` int(10) unsigned NOT NULL,
+  `post_title` text NOT NULL,
+  `meta_title` varchar(300) NOT NULL DEFAULT '',
+  `meta_description` longtext NOT NULL,
+  `meta_keyword` longtext NOT NULL,
+  `post_content` longtext NOT NULL,
+  `post_excerpt` text NOT NULL,
+  `link_rewrite` varchar(400) NOT NULL DEFAULT '',
+   PRIMARY KEY (`id_chcreaposts`, `id_lang`)
+) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
+
+$querys[] = "CREATE TABLE IF NOT EXISTS `" . _DB_PREFIX_ . "chcreaposts_shop` (
+	`id_chcreaposts` int(11) NOT NULL,
+	`id_shop` int(11) unsigned NOT NULL,
+	PRIMARY KEY (`id_chcreaposts`,`id_shop`)
+)ENGINE=" . _MYSQL_ENGINE_ . " DEFAULT CHARSET=utf8" ;
+
+$querys[] = "CREATE TABLE  IF NOT EXISTS `"._DB_PREFIX_."chcrea_images` (
+  `id_images` INT UNSIGNED NOT NULL AUTO_INCREMENT,
+  `id_chcreaposts` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
+  `name` varchar(300) NOT NULL,
+  `type` varchar(20) NOT NULL DEFAULT 'post',
+   PRIMARY KEY (`id_images`)
+) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";
+
+
+$querys[] = "CREATE TABLE  IF NOT EXISTS `"._DB_PREFIX_."chcrea_image_type`(
+  `id_image_type` INT UNSIGNED NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) DEFAULT NULL,
+  `width` int(11) UNSIGNED NOT NULL DEFAULT '0',
+  `height` int(11) UNSIGNED NOT NULL DEFAULT '0',
+  `id_shop` int(11) UNSIGNED NOT NULL DEFAULT '0',
+  `active` int(11) UNSIGNED NOT NULL DEFAULT '1',
+  PRIMARY KEY (`id_image_type`)
+) ENGINE=" . _MYSQL_ENGINE_ . " DEFAULT CHARSET=utf8";
+
+$querys[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'chcrea_comments`(
+  `id_comments` INT UNSIGNED NOT NULL AUTO_INCREMENT,
+  `name` varchar(256) DEFAULT NULL,
+  `email` varchar(90) DEFAULT NULL,
+  `subject` varchar(256) DEFAULT NULL,
+  `website` varchar(128) DEFAULT NULL,
+  `content` text,
+  `id_parent` int(11) DEFAULT NULL,
+  `id_chcreaposts` int(11) DEFAULT NULL,
+  `id_customer` int(11) DEFAULT NULL,
+  `id_guest` int(11) DEFAULT NULL,
+  `active` int(11) DEFAULT NULL,
+  `position` int(11) DEFAULT NULL,
+  `uniqueid` int(11) DEFAULT NULL,
+  `created` datetime NOT NULL,
+  `updated` datetime NOT NULL,
+  PRIMARY KEY (`id_comments`)
+) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8' ;
+
+$querys_u = array();
+
+$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcreaposts`';
+$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcreaposts_lang`';
+$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcreaposts_shop`';
+$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcrea_images`';
+$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcrea_image_type`';
+$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcrea_comments`';
+

BIN
img/1/4.jpg


+ 1 - 0
img/1/fileType

@@ -0,0 +1 @@
+jpg

BIN
img/1/gallery_default-4.jpg


BIN
img/1/gallery_default-noscreateursillustration1.jpg


BIN
img/1/noscreateursillustration1.jpg


BIN
img/1/post_default-4.jpg


+ 1 - 0
img/2/fileType

@@ -0,0 +1 @@
+jpg

BIN
img/2/gallery_default-noscreateursillustration2.jpg


BIN
img/2/gallery_medium-noscreateursillustration2.jpg


BIN
img/2/gallery_small-noscreateursillustration2.jpg


BIN
img/2/noscreateursillustration2.jpg


BIN
img/2/post_default-noscreateursillustration2.jpg


+ 1 - 0
img/3/fileType

@@ -0,0 +1 @@
+jpg

BIN
img/3/gallery_default-noscreateursillustration1.jpg


BIN
img/3/gallery_medium-noscreateursillustration1.jpg


BIN
img/3/gallery_small-noscreateursillustration1.jpg


BIN
img/3/noscreateursillustration1.jpg


BIN
img/3/post_default-noscreateursillustration1.jpg


+ 1 - 0
img/4/fileType

@@ -0,0 +1 @@
+jpg

BIN
img/4/gallery_default-noscreateursillustration1.jpg


BIN
img/4/gallery_medium-noscreateursillustration1.jpg


BIN
img/4/gallery_small-noscreateursillustration1.jpg


BIN
img/4/noscreateursillustration1.jpg


BIN
img/4/post_default-noscreateursillustration1.jpg


+ 78 - 0
js/chslider.js

@@ -0,0 +1,78 @@
+$(document).ready(function() {
+	var $newSlideConf = $('.post_gallery');
+	var items       = parseInt($newSlideConf.attr('data-items'));
+	var speed     	= parseInt($newSlideConf.attr('data-speed'));
+	var autoPlay    = parseInt($newSlideConf.attr('data-autoplay'));
+	var time    	= parseInt($newSlideConf.attr('data-time'));
+	var loop 		= parseInt($newSlideConf.attr('data-loop'));
+	var arrow       = parseInt($newSlideConf.attr('data-arrow'));
+	var pagination  = parseInt($newSlideConf.attr('data-pagination'));
+	var move        = parseInt($newSlideConf.attr('data-move'));
+	var pausehover  = parseInt($newSlideConf.attr('data-pausehover'));
+	var md          = parseInt($newSlideConf.attr('data-md'));
+	var sm          = parseInt($newSlideConf.attr('data-sm'));
+	var xs          = parseInt($newSlideConf.attr('data-xs'));
+	var xxs         = parseInt($newSlideConf.attr('data-xxs'));
+
+	if(autoPlay==1) {
+		if(time){
+			autoPlay = time;
+		}else{
+			autoPlay = '3000';
+		}
+	}else{
+		autoPlay = false;
+	}
+	if(pausehover){pausehover = true}else{pausehover=false}
+	if(move){move = false}else{move=true}
+	if(arrow){arrow =true}else{arrow=false}
+	if(pagination==1){pagination = true}else{pagination=false}
+	if(loop==1){loop = true}else{loop=false}
+
+	var newSlide = $(".post_gallery .newSlide");
+	newSlide.owlCarousel({
+		autoplay : autoPlay ,
+		smartSpeed: speed,
+		loop: loop,
+		autoplayHoverPause: pausehover,
+		scrollPerPage: move,
+		nav: arrow,
+		dots : pagination,
+		responsive:{
+			0:{
+				items:xxs,
+			},
+			480:{
+				items:xs,
+			},
+			768:{
+				items:sm,
+				nav:false,
+			},
+			992:{
+				items:md,
+			},
+			1200:{
+				items:items,
+			}
+		}
+	});
+	checkClasses();
+    newSlide.on('translated.owl.carousel', function(event) {
+        checkClasses();
+    });
+
+    function checkClasses(){
+		var total = $('.post_gallery .newSlide .owl-stage .owl-item.active').length;
+        $('.post_gallery ').each(function(){
+			$(this).find('.owl-item').removeClass('firstActiveItem');
+			$(this).find('.owl-item').removeClass('lastActiveItem');
+			$(this).find('.owl-item.active').each(function(index){
+				if (index === 0) { $(this).addClass('firstActiveItem'); }
+				if (index === total - 1 && total>1) {
+					$(this).addClass('lastActiveItem');
+				}
+			})
+        });
+    }
+});

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 8 - 0
js/validator.min.js


BIN
logo.png


+ 194 - 0
views/templates/admin/chcreateur/helpers/form/form.tpl

@@ -0,0 +1,194 @@
+{extends file="helpers/form/form.tpl"}
+{block name="input"}
+	{if $input.type == 'gallery'}
+		{* start gallery *}
+		<div class="text_{$input.name}_multiple_parent">
+			{if isset($input.defaults) && !empty($input.defaults)}
+				<input type="hidden" name="{$input.name}_delete" class="{$input.name}_delete_class" id="{$input.name}_delete_id"
+					value="{* {if isset($input.defaults_str)}{$input.defaults_str}{/if} *}">
+				{foreach from=$input.defaults key=$key item=$defaul}
+					<div id="{$input.name}_{$key}" class="row {$input.name}_class_parent">
+						<div class="col-sm-3">
+							<img src="{$input.url}{$defaul}" width="90" height="auto" style="margin:0 0 5px 0;">
+						</div>
+					<div class="col-sm-3"> 
+							<button type="button" class="btn btn-default {$input.name}_cros_class" data-val="{$key}" style="margin:auto 0">
+							<i class="icon-trash"></i> Delete</button>
+						</div>
+					</div>
+				{/foreach}
+			{else}
+				<div class="row {$input.name}_class_parent">
+					<div class="col-sm-6">
+						<div class="dummyfile input-group">
+							<span class="input-group-addon"><i class="icon-file"></i></span>
+							<input id="post_gallery_show" type="text" name="show[]" readonly="" class="{$input.name}_class_input">
+							<span class="input-group-btn">
+								<button id="post_gallery-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default {$input.name}_open_file">
+									<i class="icon-folder-open"></i> Ajouter un fichier</button>
+								<input id="post_gallery" type="file" class="{$input.name}_class" name="{$input.name}[]" style="display:none;">
+							</span>
+						</div>
+					</div>
+					<div class="col-sm-3">
+					<div class="input-group">
+						<button type="button" class="btn btn-default {$input.name}_cros_class"><i class="icon-trash"></i> Delete</button>
+						</div>
+					</div>
+				</div>
+
+
+			{/if}
+			<div class="col-sm-12 input-group">
+				<button type="button" class="btn btn-default {$input.name}_add_class"><i class="process-icon-new"></i> Ajouter une image</button>
+			</div>
+
+			<script>
+				function adddeleteimages(id) {
+					if (typeof id !== 'undefined') {
+						if($("#{$input.name}_delete_id").val() == ''){
+						$("#{$input.name}_delete_id").val(id);
+					} else {
+						$("#{$input.name}_delete_id").val($("#{$input.name}_delete_id").val()+','+id);
+					}
+				}
+				}
+				$(".{$input.name}_add_class").on("click",function() {
+				$(this).before('\
+					<div class="row {$input.name}_class_parent">\
+						<div class="col-sm-6">\
+							<div class="dummyfile input-group">\
+								<span class="input-group-addon"><i class="icon-file"></i></span>\
+								<input id="post_gallery_show" type="text" name="show[]" readonly="" class="{$input.name}_class_input">\
+								<span class="input-group-btn">\
+									<button id="post_gallery-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default {$input.name}_open_file">\
+										<i class="icon-folder-open"></i> Ajouter un fichier</button>\
+									<input id="post_gallery" type="file" class="{$input.name}_class" name="{$input.name}[]" style="display:none;">\
+								</span>\
+							</div>\
+						</div>\
+						<div class="col-sm-3">\
+						<div class="input-group">\
+							<button type="button" class="btn btn-default {$input.name}_cros_class"><i class="icon-trash"></i> Delete</button>\
+							</div>\
+						</div>\
+					</div>');
+				
+				});
+
+				
+				$(".text_{$input.name}_multiple_parent").on("click",".{$input.name}_open_file",function() {
+						$(this).next().trigger('click');
+
+
+					});
+
+					$(".text_{$input.name}_multiple_parent").on("change",".{$input.name}_class",function() {
+						var name = $(this).val().split(/[\\/]/);
+						$(this).closest(".{$input.name}_class_parent").find(".{$input.name}_class_input").val(name[name.length - 1]);
+					});
+
+				$(".text_{$input.name}_multiple_parent").on("click",".{$input.name}_cros_class",function() {
+						adddeleteimages($(this).data("val"));
+						$(this).closest(".{$input.name}_class_parent").remove();
+				});
+			</script>
+		</div>
+		{* End gallery *}
+	{elseif $input.type == 'text_multiple'}
+		{* start text multiple *}
+		<div class="text_{$input.name}_multiple_parent">
+			{if isset($input.defaults) && !empty($input.defaults)}
+				{foreach $input.defaults AS $defaul}
+					<div class="row {$input.name}_class_parent">
+						<div class="col-sm-9">
+							<input type="text" class="{$input.name}_class" name="{$input.name}[]" value="{$defaul}">
+						</div>
+						<div class="col-sm-3">
+							<button type="button" class="btn btn-default {$input.name}_cros_class">X</button>
+						</div>
+					</div>
+				{/foreach}
+			{else}
+				<div class="row {$input.name}_class_parent">
+					<div class="col-sm-9">
+						<input type="text" class="{$input.name}_class" name="{$input.name}[]">
+					</div>
+				</div>
+			{/if}
+			<button type="button" class="btn btn-default {$input.name}_add_class"><i class="icon-folder-open"></i> Ajouter un fichier</button>
+
+			
+			<script>
+				$(".{$input.name}_add_class").on("click",function() {
+				$(this).before('<div class="row {$input.name}_class_parent"><div class="col-sm-9"><input type="text" class="{$input.name}_class" name="{$input.name}[]"></div><div class="col-sm-3"><button type="button" class="btn btn-default {$input.name}_cros_class">X</button></div></div>');
+				});
+				$(".text_{$input.name}_multiple_parent").on("click",".{$input.name}_cros_class",function() {
+				// console.log($(this).closest(".{$input.name}_class_parent"));
+				$(this).closest(".{$input.name}_class_parent").remove();
+				});
+			</script>
+		</div>
+		{* end text multiple *}
+	{elseif $input.type == 'select_multiple'}
+		<div class="text_{$input.name}_multiple_parent">
+			{if isset($input.defaults) && !empty($input.defaults)}
+				{foreach $input.defaults AS $defaul}
+					<div class="row {$input.name}_class_parent" style="margin-top:5px;">
+						<div class="col-sm-9">
+							{*$input|print_r*}
+							{*<input type="text" class="{$input.name}_class" name="{$input.name}[]">*}
+							<select name="{$input.name}[]" class="{$input.name}_class">
+								{foreach $input.options.query as $option}
+									<option value="{$option.id}" {if $option.id == $defaul} selected="selected" {/if}>{$option.name}
+									</option>
+
+								{/foreach}
+							</select>
+						</div>
+						<div class="col-sm-3">
+							<button type="button" class="btn btn-default {$input.name}_cros_class" style="margin:auto 0">
+							<i class="icon-trash"></i> Delete</button>
+						</div>
+					</div>
+				{/foreach}
+			{else}
+				<div class="row {$input.name}_class_parent">
+					<div class="col-sm-9">
+						{*$input|print_r*}
+						{*<input type="text" class="{$input.name}_class" name="{$input.name}[]">*}
+						<select name="{$input.name}[]" class="{$input.name}_class">
+							{foreach $input.options.query as $option}
+								<option value="{$option.id}">{$option.name}</option>
+							{/foreach}
+						</select>
+					</div>
+				</div>
+			{/if}
+			<button type="button" class="btn btn-default {$input.name}_add_class"  style="margin-top:5px;"><i class="icon-folder-open"></i> Ajouter un produit</button>
+			<script>
+				var options = '<div class="row {$input.name}_class_parent" style="margin-top:5px;">';
+				options += '<div class="col-sm-9">';
+				options += '<select name="{$input.name}[]" class="{$input.name}_class">';
+				{foreach $input.options.query as $option}
+					options +='<option value="{$option.id}">{$option.name}</option>';
+				{/foreach}
+				options += '</select></div>';
+				options += '<div class="col-sm-3">';
+				options += '<button type="button" class="btn btn-default {$input.name}_cros_class"><i class="icon-trash"></i> Delete</button></div></div>';
+				$(".{$input.name}_add_class").on("click",function() {
+				$(this).before(options);
+				});
+				$(".text_{$input.name}_multiple_parent").on("click",".{$input.name}_cros_class",function() {
+				$(this).closest(".{$input.name}_class_parent").remove();
+				});
+			</script>
+
+
+
+
+		</div>
+	{else}
+		{$smarty.block.parent}
+	{/if}
+{/block}

+ 73 - 0
views/templates/front/archive.tpl

@@ -0,0 +1,73 @@
+{extends file='page.tpl'}
+
+{block name='page_header_container'}{/block}
+
+{block name="page_content_container"}
+	<section id="content" class="page-content">
+    {if isset($chposts) && !empty($chposts)}
+        <div class="chselection_post">
+            <div class="chselection_post_inner">
+                {foreach from=$chposts item=chselection}
+                    <article id="blog_post" class="blog_post blog_post_{$chselection.post_format} clearfix">
+                        <div class="blog_post_content">
+                            <div class="blog_post_content_top col-lg-12 col-md-12 col-xs-12">
+                                <div class="post_thumbnail">
+
+                                    {if isset($chselection.video) & !empty($chselection.video) }
+                                        {if $chselection.video|@count > 1 }
+                                            {assign var="class" value='newSlide owl-carousel'}
+                                        {else}
+                                            {assign var="class" value=''}
+                                        {/if}
+                                        {include file="module:chselection/views/templates/front/post-video.tpl" postvideos=$chselection.video width='870' height="482" class=$class arrow="0"}
+                                    {elseif isset($chselection.audio) & !empty($chselection.audio) }
+                                        {if $chselection.audio|@count > 1 }
+                                            {assign var="class" value='newSlide owl-carousel'}
+                                        {else}
+                                            {assign var="class" value=''}
+                                        {/if}
+                                        {include file="module:chselection/views/templates/front/post-audio.tpl" postaudio=$chselection.audio class=$class arrow="0"}
+                                    {elseif  isset($chselection.gallery_lists) & !empty($chselection.gallery_lists) }
+                                        {if $chselection.gallery_lists|@count > 1 }
+                                            {assign var="class" value='carousel'}
+                                        {else}
+                                            {assign var="class" value=''}
+                                        {/if}
+                                        {include file="module:chselection/views/templates/front/post-gallery.tpl" gallery_lists=$chselection.gallery_lists imagesize="gallery_default" class=$class arrow="0"}
+                                    {else}
+                                        <img class="img-responsive" src="{$chselection.post_img.post_default}" alt="{$chselection.post_title}">
+                                    {/if}
+
+                                </div>
+                            </div>
+    
+                            <div class="blog_post_content_bottom col-lg-12 col-md-12 col-xs-12">
+
+                           
+                            <h3 class="post_title"><a href="{$chselection.link}">{$chselection.post_title}</a></h3>
+    
+
+                      
+              
+
+                                <div class="post_content">
+                                    {if isset($chselection.post_excerpt) && !empty($chselection.post_excerpt)}
+                                        {$chselection.post_excerpt|truncate:500:'...'|escape:'html':'UTF-8'}
+                                    {else}
+                                        {$chselection.post_content|truncate:400:'...'|escape:'html':'UTF-8'}
+                                    {/if}
+                                </div>
+                                <div class="readmorenoir">
+                                    <a class="read_more" href="{$chselection.link}">{l s='Continue' mod='xipblog'}</a>
+                                </div>
+                            </div>
+    
+                        </div>
+                    </article>
+                {/foreach}
+            </div>
+        </div>
+        {/if}
+    </section>
+
+{/block}

+ 74 - 0
views/templates/front/chselection.tpl

@@ -0,0 +1,74 @@
+
+<div class="home_blog_post_area {$hookName}">
+	<div class="home_blog_post">
+		<div class="page_title_area">
+			{if isset($chsel_title)}
+				<h3 class="page-heading">
+					<em>{$chsel_title}</em>
+					<span class="heading_carousel_arrow"></span>
+				</h3>
+			{/if}
+			{if isset($chsel_desc)}
+				<p class="page_subtitle">{$chsel_desc}</p>
+			{/if}
+			<div class="heading-line d_none"><span></span></div>
+		</div>
+
+		<div class="row home_blog_post_inner carousel">
+		{if (isset($chselposts) && !empty($chselposts))}
+			{foreach from=$chselposts item=chselpost}
+				<article class="blog_post col-xs-12 col-sm-4">
+					<div class="blog_post_content">
+						<div class="blog_post_content_top">
+							<div class="post_thumbnail">
+								
+									<img class="xipblog_img img-responsive" src="{$chselpost.post_img_default}" alt="{$chselpost.post_title}">
+									<div class="blog_mask">
+										<div class="blog_mask_content">
+											<a class="thumbnail_lightbox" href="{$chselpost.post_img_default}">
+												<i class="icon_plus"></i>
+											</a>
+										</div>
+									</div>
+							
+							</div>
+						</div>
+
+						<div class="blog_post_content_bottom">
+							<h3 class="post_title"><a href="{$chselpost.link}">{$chselpost.post_title}</a></h3>
+							<div class="post_meta clearfix">
+								<p class="meta_author">
+									{* <i class="icon-user"></i> *}
+									{l s='Posted by' mod='xipblog'}
+									<span>{$chselpost.post_author_arr.firstname} {$chselpost.post_author_arr.lastname}</span>
+								</p>
+								<p class="meta_date">
+									{* <i class="icon-calendar"></i> *}
+									{$chselpost.post_date|date_format:"%b %d, %Y"}
+								</p>
+
+							</div>
+							
+							<div class="post_content">
+								{if isset($chselpost.post_excerpt) && !empty($chselpost.post_excerpt)}
+									<p>{$chselpost.post_excerpt|truncate:100:' ...'|escape:'html':'UTF-8'}</p>
+								{else}
+									<p>{$chselpost.post_content|truncate:100:' ...'|escape:'html':'UTF-8'}</p>
+								{/if}
+							</div>
+							<div class="content_more">
+								<a class="read_more" href="{$chselpost.link}">{l s='Continue' mod='xipblog'}</a>
+							</div>
+						</div>
+						
+					</div>
+				</article>
+			{/foreach}
+		{else}
+			<p>{l s='No Blog Post Found' mod='xipblog'}</p>
+		{/if}
+		</div>
+
+
+	</div>
+</div>

+ 38 - 0
views/templates/front/comment-list.tpl

@@ -0,0 +1,38 @@
+<div class="comments_area" id="comments">
+    <h2 class="comments_title">
+        {l s='All comments' mod='xipblog'}
+    </h2>
+    <ol class="comment_list">
+		{foreach from=$xipblog_commets item=xipblog_commet}
+        <li class="comment" id="comment_{$xipblog_commet.id_xip_comments}">
+            <article class="comment_body">
+				<div class="comment_author vcard">
+				    <img alt="" class="xipblog_img avatar avatar-70 photo" height="70" src="http://2.gravatar.com/avatar/597a1e6b0dfdf57f53ef8fb80fa190d7?s=70&d=mm&r=g" width="70">
+				</div>
+				<div class="comment_content">
+					<div class="comment_meta">
+					    <div class="comment_meta_author">
+					    	<b class="fn">{$xipblog_commet.name}</b>
+					    </div>
+					    <div class="comment_meta_date">
+					    	<time datetime="2016-03-07T04:33:23+00:00">
+					    	    {$xipblog_commet.created|date_format:"%e %B, %Y"}
+					    	</time>
+					    </div>
+					    <div class="reply">
+					        <a aria-label="Reply to raihan@sntbd.com" class="comment-reply-link" href="#" onclick='return addComment.moveForm( "div-comment-3", "3", "respond", "38" )' rel="nofollow">
+					            Reply
+					        </a>
+					    </div>
+					</div>
+					<div class="comment_content_bottom">
+						<p>
+							{$xipblog_commet.content}
+						</p>
+					</div>
+				</div>
+            </article>
+        </li>
+		{/foreach}
+    </ol>
+</div>

+ 90 - 0
views/templates/front/comment.tpl

@@ -0,0 +1,90 @@
+<div class="comment_respond clearfix m_bottom_50" id="respond">
+    <h3 class="comment_reply_title" id="reply-title">
+        Leave a Reply
+        <small>
+            <a href="/wp_showcase/wp-supershot/?p=38#respond" id="cancel-comment-reply-link" rel="nofollow" style="display:none;">
+                Cancel reply
+            </a>
+        </small>
+    </h3>
+    <form class="comment_form" action="" method="post" id="xipblogs_commentfrom" role="form" data-toggle="validator">
+    	<div class="form-group xipblogs_message"></div>
+    	<div class="form-group xipblog_name_parent">
+    	  <label for="xipblog_name">Your Name:</label>
+    	  <input type="text"  id="xipblog_name" name="xipblog_name" class="form-control xipblog_name" required>
+    	</div>
+    	<div class="form-group xipblog_email_parent">
+    	  <label for="xipblog_email">Your Email:</label>
+    	  <input type="email"  id="xipblog_email" name="xipblog_email" class="form-control xipblog_email" required>
+    	</div>
+    	<div class="form-group xipblog_website_parent">
+    	  <label for="xipblog_website">Website Url:</label>
+    	  <input type="url"  id="xipblog_website" name="xipblog_website" class="form-control xipblog_website">
+    	</div>
+    	<div class="form-group xipblog_subject_parent">
+    	  <label for="xipblog_subject">Subject:</label>
+    	  <input type="text"  id="xipblog_subject" name="xipblog_subject" class="form-control xipblog_subject" required>
+    	</div>
+    	<div class="form-group xipblog_content_parent">
+    	  <label for="xipblog_content">Comment:</label>
+    	  <textarea rows="15" cols="" id="xipblog_content" name="xipblog_content" class="form-control xipblog_content" required></textarea>
+    	</div>
+    	<input type="hidden" class="xipblog_id_parent" id="xipblog_id_parent" name="xipblog_id_parent" value="0">
+    	<input type="hidden" class="xipblog_id_post" id="xipblog_id_post" name="xipblog_id_post" value="{$xipblogpost.id_xipposts}">
+    	<input type="submit" class="btn btn-default pull-left xipblog_submit_btn" value="Submit Button">
+    </form>
+</div>
+{xipblog_js name="single_comment_form"}
+<script type="text/javascript">
+// disabled
+$('.xipblog_submit_btn').on("click",function(e) {
+	e.preventDefault();
+	if(!$(this).hasClass("disabled")){
+		var data = new Object();
+		$('[id^="xipblog_"]').each(function()
+		{
+			id = $(this).prop("id").replace("xipblog_", "");
+			data[id] = $(this).val();
+		});
+		function logErrprMessage(element, index, array) {
+		  $('.xipblogs_message').append('<span class="xipblogs_error">'+element+'</span>');
+		}
+		function xipremove() {
+		  $('.xipblogs_error').remove();
+		  $('.xipblogs_success').remove();
+		}
+		function logSuccessMessage(element, index, array) {
+		  $('.xipblogs_message').append('<span class="xipblogs_success">'+element+'</span>');
+		}
+		$.ajax({
+			url: xprt_base_dir + 'modules/xipblog/ajax.php',
+			data: data,
+			type:'post',
+			dataType: 'json',
+			beforeSend: function(){
+				xipremove();
+				$(".xipblog_submit_btn").val("Please wait..");
+				$(".xipblog_submit_btn").addClass("disabled");
+			},
+			complete: function(){
+				$(".xipblog_submit_btn").val("Submit Button");
+				$(".xipblog_submit_btn").removeClass("disabled");	
+			},
+			success: function(data){
+				xipremove();
+				if(typeof data.success != 'undefined'){
+					data.success.forEach(logSuccessMessage);
+				}
+				if(typeof data.error != 'undefined'){
+					data.error.forEach(logErrprMessage);
+				}
+			},
+			error: function(data){
+				xipremove();
+				$('.xipblogs_message').append('<span class="error">Something Wrong ! Please Try Again. </span>');
+			},
+		});	
+	}
+});
+</script>
+{/xipblog_js}

+ 12 - 0
views/templates/front/custom-nav.tpl

@@ -0,0 +1,12 @@
+<div class="bottom-custom-nav-content clearfix">
+  
+  <div class="col-md-4">
+    {if isset($link_post_previeus) && !empty($link_post_previeus)}<a class="button_previeus" href="{$link_post_previeus}">{l s="Previeus"}</a>{/if}
+  </div>
+  <div class="col-md-4 content_back">
+    <a class="button_previeus" href="javascript:history.back(1);">{l s="Back"}</a>
+  </div>
+  <div class="col-md-4">
+    {if isset($link_post_next) && !empty($link_post_next)}<a class="button_next" href="{$link_post_next}">{l s="Next"}</a>{/if}
+  </div>
+</div>

+ 78 - 0
views/templates/front/left-list.tpl

@@ -0,0 +1,78 @@
+<div class="left_blog_post_area {$xipbdp_designlayout} {$hookName}">
+	<div class="left_blog_post">
+		<div class="page_title_area">
+			{if isset($xipbdp_title)}
+				<h3 class="page-heading">
+					<em>{$xipbdp_title}</em>
+					<span class="heading_carousel_arrow"></span>
+				</h3>
+			{/if}
+			{if isset($xipbdp_subtext)}
+				<p class="page_subtitle">{$xipbdp_subtext}</p>
+			{/if}
+			<div class="heading-line d_none"><span></span></div>
+		</div>
+		<div class="row left_blog_post_inner carousel">
+		{if (isset($xipblogposts) && !empty($xipblogposts))}
+			{foreach from=$xipblogposts item=xipblgpst}
+				<article class="left_blog_post_article"> <!-- col-xs-12 col-sm-12"> -->
+					<div class="blog_post_content">
+						<div class="blog_post_content_top">
+							<div class="post_thumbnail">
+					
+									<img class="xipblog_img img-responsive" src="{$xipblgpst.post_img_home_default}" alt="{$xipblgpst.post_title}">
+									<div class="blog_mask">
+										<div class="blog_mask_content">
+											<a class="thumbnail_lightbox" href="{$xipblgpst.post_img_large}">
+												<i class="icon_plus"></i>
+											</a>
+										</div>
+									</div>
+								
+							</div>
+						</div>
+						<div class="blog_post_content_bottom">
+							<h3 class="post_title"><a href="{$xipblgpst.link}">{$xipblgpst.post_title}</a></h3>
+							{*
+							<div class="post_meta clearfix">
+								<p class="meta_author">
+									<i class="icon-user"></i>
+									{l s='Posted by' mod='xipblog'}
+									<span>{$xipblgpst.post_author_arr.firstname} {$xipblgpst.post_author_arr.lastname}</span>
+								</p>
+								
+								<p class="meta_date">
+									<i class="icon-calendar"></i>
+									{$xipblgpst.post_date|date_format:"%b %d, %Y"}
+								</p>
+								
+								<p class="meta_category">
+									<i class="icon-tag"></i>
+									{l s='IN' mod='xipblog'}
+									<a href="{$xipblgpst.category_default_arr.link}">{$xipblgpst.category_default_arr.name}</a>
+								</p>
+							</div>
+							*}
+							
+							<div class="post_content">
+								{if isset($xipblgpst.post_excerpt) && !empty($xipblgpst.post_excerpt)}
+									<p>{$xipblgpst.post_excerpt|truncate:100:' ...'|escape:'html':'UTF-8'}</p>
+								{else}
+									<p>{$xipblgpst.post_content|truncate:100:' ...'|escape:'html':'UTF-8'}</p>
+								{/if}
+							</div>
+							{*
+							<div class="content_more">
+								<a class="read_more" href="{$xipblgpst.link}">{l s='Continue' mod='xipblog'}</a>
+							</div>
+							*}
+						</div>
+					</div>
+				</article>
+			{/foreach}
+		{else}
+			<p>{l s='No Blog Post Found' mod='xipblog'}</p>
+		{/if}
+		</div>
+	</div>
+</div>

+ 30 - 0
views/templates/front/pagination.tpl

@@ -0,0 +1,30 @@
+<nav class="bottom-pagination-content clearfix">
+  <div class="col-md-4">
+    {l s='Showing %from%-%to% of %total% item(s)' d='Shop.Theme.Catalog' sprintf=['%from%' => $pagination.items_shown_from ,'%to%' => $pagination.items_shown_to, '%total%' => $pagination.total_items]}
+  </div>
+  <div class="pagination">
+    <ul class="page-list clearfix">
+      {foreach from=$pagination.pages item="page"}
+        <li {if $page.current} class="active current" {/if}>
+          {if $page.type === 'spacer'}
+            <span class="spacer">&hellip;</span>
+          {else}
+            <a
+              rel="{if $page.type === 'previous'}prev{elseif $page.type === 'next'}next{else}nofollow{/if}"
+              href="{$page.url}"
+              class="{if $page.type === 'previous'}previous {elseif $page.type === 'next'}next {/if}{['disabled' => !$page.clickable, 'js-blog-link' => true]|classnames}"
+            >
+              {if $page.type === 'previous'}
+                <i class="icon-angle-left"></i>
+              {elseif $page.type === 'next'}
+                <i class="icon-angle-right"></i>
+              {else}
+                {$page.page}
+              {/if}
+            </a>
+          {/if}
+        </li>
+      {/foreach}
+    </ul>
+  </div>
+</nav>

+ 39 - 0
views/templates/front/post-audio.tpl

@@ -0,0 +1,39 @@
+<!-- <div class="post_gallery_content"> -->
+
+<div class="post_gallery post_format_items"
+	data-items="1"
+	data-speed="1500"
+	data-autoplay="0"
+	data-loop="1"
+	data-time="3000"
+	data-arrow="{$arrow}"
+	data-pagination="1"
+	data-move="1"
+	data-pausehover="1"
+	data-md="1"
+	data-sm="1"
+	data-xs="1"
+	data-xxs="1">
+	
+
+
+	<div class="post_format_items {if isset($class) && $class}{$class}{/if}">
+		{if isset($postaudio) && $postaudio}
+			{foreach from=$postaudio item=videourl}
+				<div class="item post_video ">
+					<div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
+						<iframe src="{$videourl}" title="Dailymotion"
+							style="width:100%;height:100%;position:absolute;left:0px;top:0px;overflow:hidden" frameborder="0"
+							type="text/html" width="100%" height="100%" allowfullscreen>
+						</iframe>
+					</div>
+				</div>
+			{/foreach}
+		{/if}
+	</div>
+
+</div>
+
+
+	
+	<!-- </div> -->

+ 33 - 0
views/templates/front/post-gallery.tpl

@@ -0,0 +1,33 @@
+
+
+<!-- <div class="post_gallery_content"> -->
+
+<div class="post_gallery post_format_items {if isset($class) && $class}{$class}{/if}"
+data-items="1"
+data-speed="1500"
+data-autoplay="1"
+data-loop="1"
+data-time="3000"
+data-arrow="{$arrow}"
+data-pagination="1"
+data-move="1"
+data-pausehover="1"
+data-md="1"
+data-sm="1"
+data-xs="1"
+data-xxs="1">
+
+{if isset($gallery_lists) && $gallery_lists}
+	<div class="newSlide owl-carousel">
+		{foreach from=$gallery_lists  key=num item=galleryimg} {*  item=galleryimg*}
+			<div class="post_gallery_img item">
+			{*<a href="{$xpblgpst.link}">*}
+				<img class="xipblog_img responsive-{$num}" src="{$galleryimg.$imagesize}" alt="">
+			{*</a>*}
+			</div>
+		{/foreach}
+	</div>
+{/if}
+</div>
+
+<!-- </div> -->

+ 43 - 0
views/templates/front/post-video.tpl

@@ -0,0 +1,43 @@
+
+
+
+<!-- <div class="post_gallery_content"> -->
+
+<div class="post_gallery post_format_items"
+	data-items="1"
+	data-speed="1500"
+	data-autoplay="0"
+	data-loop="1"
+	data-time="3000"
+	data-arrow="{$arrow}"
+	data-pagination="1"
+	data-move="1"
+	data-pausehover="1"
+	data-md="1"
+	data-sm="1"
+	data-xs="1"
+	data-xxs="1">
+	
+
+
+	<div class="post_format_items {if isset($class) && $class}{$class}{/if}">
+		{if isset($postvideos) && $postvideos}
+			{foreach from=$postvideos item=videourl}
+				<div class="item post_video ">
+					<div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
+						<iframe src="{$videourl}" title="Dailymotion"
+							style="width:100%;height:100%;position:absolute;left:0px;top:0px;overflow:hidden" frameborder="0"
+							type="text/html" width="100%" height="100%" allowfullscreen>
+						</iframe>
+					</div>
+				</div>
+			{/foreach}
+		{/if}
+	</div>
+
+</div>
+
+
+	
+	<!-- </div> -->
+

+ 136 - 0
views/templates/front/single.tpl

@@ -0,0 +1,136 @@
+{extends file='page.tpl'}
+
+{block name='page_header_container'}{/block}
+{block name='head_seo_title'} {$page.meta.title} - {$chpost.post_title} {/block}
+
+{block name='head' append}
+    <meta property="og:url"                content="{$urls.current_url}" />
+    <meta property="og:type"               content="article" />
+    <meta property="og:title"              content="{$page.meta.title} - {$chpost.post_title}" />
+    <meta property="og:description"        content="{$chpost.meta_description nofilter}" />
+	{if isset($chpost.gallery_lists) & !empty($chpost.gallery_lists) }
+		{$firstData = $chpost.gallery_lists|reset}
+		<meta property="og:image"          content="{$urls.shop_domain_url}{$firstData.gallery_default}" />
+	{elseif isset($chpost.post_img.post_default) }
+		<meta property="og:image"          content="{$urls.shop_domain_url}{$chpost.post_img.post_default}" />
+	{/if}
+   
+{/block}
+
+{block name="page_content_container"}
+	<section id="content" class="page-content">
+		<div class="{$chvars.class}_area single">
+			<div class="{$chvars.class}_inner">
+				<article id="blog_post" class="blog_post">
+					<div class="blog_post_content">
+						<div class="blog_post_content_top">
+							<div class="post_thumbnail">
+								
+								{if isset($chpost.video) & !empty($chpost.video)}
+									{if $chpost.video|@count > 1 }
+										{assign var="class" value='newSlide owl-carousel'}
+									{else}
+										{assign var="class" value=''}
+									{/if}
+									{include file="module:chselection/views/templates/front/post-video.tpl" postvideos=$chpost.video width='870' height="482" class=$class arrow="1"}
+								{elseif isset($chpost.audio) & !empty($chpost.audio) }
+									{if $chpost.audio|@count > 1 }
+										{assign var="class" value='newSlide owl-carousel'}
+									{else}
+										{assign var="class" value=''}
+									{/if}
+									{include file="module:chselection/views/templates/front/post-audio.tpl" postaudio=$chpost.audio width='870' height="482" class=$class arrow="1"}
+								{elseif isset($chpost.gallery_lists) & !empty($chpost.gallery_lists) }
+									{if $chpost.gallery_lists|@count > 1 }
+										{assign var="class" value='carousel'}
+									{else}
+										{assign var="class" value=''}
+									{/if}
+									{include file="module:chselection/views/templates/front/post-gallery.tpl" gallery_lists=$chpost.gallery_lists imagesize="gallery_default" class=$class arrow="1"}
+								{else}
+									<img class="chselection_img img-responsive" src="{$chpost.post_img.post_default}" alt="{$chpost.post_title}">
+								{/if}
+								
+							</div>
+						</div>
+
+						<div class="blog_post_content_bottom">
+							<h1 class="post_title">{$chpost.post_title}</h1>
+							<div class="post_meta clearfix">
+								<div class="meta_author">
+									{* <i class="icon-user"></i> *}
+									<span>{l s='By' mod='chselection'} {$chpost.post_author_arr.firstname} {$chpost.post_author_arr.lastname}</span>
+								</div>
+								<div class="post_meta_date">
+									{* <i class="icon-calendar"></i> *}
+									{$chpost.post_date|date_format:"%b %dTH, %Y"}
+								</div>
+								<div class="meta_comment">
+									{* <i class="icon-eye"></i> *}
+									<span>{l s='Views' mod='chselection'} ({$chpost.comment_count})</span>
+								</div>
+							</div>
+							<div class="post_content">
+								{$chpost.post_content nofilter}
+							</div>
+						</div>
+
+						{if isset($chpost.related_products)}
+							<section class="featured-products clearfix">
+								{*<h2>{l s='Viewed products' d='Modules.Viewedproduct.Shop'}</h2>*}
+								{assign var="larg" value=$chpost.related_products|@count}
+								<div class="products">
+						
+									{foreach from=$chpost.related_products item="product"}
+										<div class="blog_product col-lg-3">
+											{include file="catalog/_partials/miniatures/product.tpl" product=$product}
+										</div>
+									{/foreach}
+								</div>
+							</section>
+						{/if}
+
+					</div>
+				</article>
+			</div>
+		</div>
+		{include file="module:chselection/views/templates/front/custom-nav.tpl"}
+	</section>
+{*
+{if ($chpost.comment_status == 'open') || ($chpost.comment_status == 'close')}
+	{include file="module:chselection/views/templates/front/comment-list.tpl"}
+{/if}
+{if (isset($disable_blog_com) && $disable_blog_com == 1) && ($chpost.comment_status == 'open')}
+	
+	{include file="module:chselection/views/templates/front/comment.tpl"}
+{/if}
+*}
+
+{/block}
+{*
+{block name="left_column"}
+	{assign var="layout_column" value=$layout|replace:'layouts/':''|replace:'.tpl':''|strval}
+	{if ($layout_column == 'layout-left-column')}
+		<div id="left-column" class="sidebar col-xs-12 col-sm-4 col-md-3">
+			{if ($chselection_column_use == 'default_ps')}
+				{hook h="displaychselectionleft"}
+			{else}
+				{hook h="displayLeftColumn"}
+			{/if}
+		</div>
+	{/if}
+{/block}
+{block name="right_column"}
+	{assign var="layout_column" value=$layout|replace:'layouts/':''|replace:'.tpl':''|strval}
+	{if ($layout_column == 'layout-right-column')}
+		<div id="right-column" class="sidebar col-xs-12 col-sm-4 col-md-3">
+			{if ($chselection_column_use == 'own_ps')}
+				{hook h="displaychselectionright"}
+			{else}
+				{hook h="displayRightColumn"}
+			{/if}
+		</div>
+	{/if}
+{/block}
+*}
+

+ 2 - 0
views/templates/front/test.tpl

@@ -0,0 +1,2 @@
+<p>nb nb nb nbnb </p>
+{debug}

+ 51 - 0
views/templates/front/vignette.tpl

@@ -0,0 +1,51 @@
+<!-- Block mymodule -->
+<div id="chcmsvignette_block_home" class="block">
+<div class="block-content clearfix">
+    {*$chselposts|print_r*}
+    {foreach from=$chselposts item=vignette name=vignloop}
+      {if isset($vignette.post_img.post_default) }
+        {assign var="counter" value=$smarty.foreach.vignloop.iteration}
+
+        {if $vignettes_nbr == 3 || $vignettes_nbr == 6}
+          {assign var="larg" value="4"}
+        {/if}
+        {if $vignettes_nbr == 5 and $counter < 3}
+          {assign var="larg" value="6"}
+        {/if}
+        {if $vignettes_nbr == 5 and $counter > 2}
+          {assign var="larg" value="4"}
+        {/if}
+        {if $vignettes_nbr == 4 || $vignettes_nbr == 2 || $vignettes_nbr == 1 }
+          {assign var="larg" value="6"}
+        {/if}
+
+        <div class="block_content vignette_content col1 col-lg-{$larg} col-md-{$larg} col-xs-12">
+          <div class="vignette_cadre">
+          <section class="vignette_section">
+            <a href="/selection/{$vignette.id_chselposts}_{$vignette.link_rewrite}">
+            <div class="titre">
+              <h3>{$vignette.post_title}</h3>
+            </div>
+
+              <div class="vignettage">
+                <div class="vignette surimpression">
+                  <p>{$vignette.post_excerpt}</p>
+                </div>
+              </div>
+              <div class="thumbnail">
+              {if $larg == 4 }
+                <img src="{$urls.base_url}{$vignette.post_img.post_petit}" alt="{$vignette.post_excerpt}" title="{$vignette.post_excerpt}" />
+               {else}
+                <img src="{$urls.base_url}{$vignette.post_img.post_default}" alt="{$vignette.post_excerpt}" title="{$vignette.post_excerpt}" />
+              {/if}
+              </div>
+            </a>
+          </section>
+          </div>
+        </div>
+      {/if}
+    {/foreach}
+
+</div>
+</div>
+<!-- /Block mymodule -->

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio