<?php
/**
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author    PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

class SampleDataCustomHtml
{
	public function initData()
	{
		$result = true;
		$id_shop = Configuration::get('PS_SHOP_DEFAULT');
		
		$block1 = Tools::file_get_contents(dirname(__FILE__).'/block1.html');
		$block2 = Tools::file_get_contents(dirname(__FILE__).'/block2.html');
		$block3 = Tools::file_get_contents(dirname(__FILE__).'/block3.html');
		$block4 = Tools::file_get_contents(dirname(__FILE__).'/block4.html');
		$block5 = Tools::file_get_contents(dirname(__FILE__).'/block5.html');
		$block6 = Tools::file_get_contents(dirname(__FILE__).'/block6.html');
		$block7 = Tools::file_get_contents(dirname(__FILE__).'/block7.html');
		
		$result &= Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'owlcustomhtml` (`id_owlcustomhtml`, `hook`, `active`) 
			VALUES
			(1, "displayTopHome", 1),
			(2, "displayBottomFooter", 1),
			(3, "displayFooter", 1),
			(4, "displayHome", 1),
			(5, "displayHookSpecial", 1),
			(6, "displayHomeLeft", 1),
			(7, "displayTopFooter", 1);');
		
		$result &= Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'owlcustomhtml_shop` (`id_owlcustomhtml`, `id_shop`,`active`) 
			VALUES 
			(1,'.$id_shop.', 1),
			(2,'.$id_shop.', 1),
			(3,'.$id_shop.', 1),
			(4,'.$id_shop.', 1),
			(5,'.$id_shop.', 1),
			(6,'.$id_shop.', 1),
			(7,'.$id_shop.', 1);');
			
		foreach (Language::getLanguages(false) as $lang)
		{
			$result &= Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'owlcustomhtml_lang` (`id_owlcustomhtml`, `id_shop`, `id_lang`, `title`, `content`) 
			VALUES 
			("1", "'.$id_shop.'","'.$lang['id_lang'].'","Top Banner", \''.$block1.'\'),
			("2", "'.$id_shop.'","'.$lang['id_lang'].'","Copy Right + Payment", \''.$block2.'\'),
			("3", "'.$id_shop.'","'.$lang['id_lang'].'","Customer Links", \''.$block3.'\'),
			("4", "'.$id_shop.'","'.$lang['id_lang'].'","Home Banner", \''.$block4.'\'),
			("5", "'.$id_shop.'","'.$lang['id_lang'].'","Free Shipping", \''.$block5.'\'),
			("6", "'.$id_shop.'","'.$lang['id_lang'].'","Hotline", \''.$block6.'\'),
			("7", "'.$id_shop.'","'.$lang['id_lang'].'","About Us", \''.$block7.'\');');
		}
		return $result;
	}
}