Example #1
1
 public function renderContent($args, $setting)
 {
     $t = array('name' => '', 'image_folder_path' => '', 'limit' => 12, 'columns' => 4);
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $setting = array_merge($t, $setting);
     $oimages = array();
     if ($setting['image_folder_path']) {
         $path = _PS_ROOT_DIR_ . '/' . trim($setting['image_folder_path']) . '/';
         $path = str_replace("//", "/", $path);
         if (is_dir($path)) {
             $images = glob($path . '*.*');
             $exts = array('jpg', 'gif', 'png');
             foreach ($images as $cnt => $image) {
                 $ext = Tools::substr($image, Tools::strlen($image) - 3, Tools::strlen($image));
                 if (in_array(Tools::strtolower($ext), $exts)) {
                     if ($cnt < (int) $setting['limit']) {
                         $i = str_replace("\\", "/", '' . $setting['image_folder_path'] . "/" . basename($image));
                         $i = str_replace("//", "/", $i);
                         $oimages[] = $url . $i;
                     }
                 }
             }
         }
     }
     $images = array();
     $setting['images'] = $oimages;
     $output = array('type' => 'image', 'data' => $setting);
     return $output;
 }
Example #2
1
    public function getContent()
    {
        // If we try to update the settings
        $output = '';
        if (isset($_POST['submitModule'])) {
            Configuration::updateValue('blocksocial_facebook', $_POST['facebook_url'] != '' ? $_POST['facebook_url'] : '');
            Configuration::updateValue('blocksocial_twitter', $_POST['twitter_url'] != '' ? $_POST['twitter_url'] : '');
            Configuration::updateValue('blocksocial_rss', $_POST['rss_url'] != '' ? $_POST['rss_url'] : '');
            $output = '<div class="conf confirm">' . $this->l('Configuration updated') . '</div>';
        }
        return '
		<h2>' . $this->displayName . '</h2>
		' . $output . '
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">				
				<label for="facebook_url">' . $this->l('Facebook URL: ') . '</label>
				<input type="text" id="facebook_url" name="facebook_url" value="' . Tools::safeOutput(Configuration::get('blocksocial_facebook') != "" ? Configuration::get('blocksocial_facebook') : "") . '" />
				<div class="clear">&nbsp;</div>		
				<label for="twitter_url">' . $this->l('Twitter URL: ') . '</label>
				<input type="text" id="twitter_url" name="twitter_url" value="' . Tools::safeOutput(Configuration::get('blocksocial_twitter') != "" ? Configuration::get('blocksocial_twitter') : "") . '" />
				<div class="clear">&nbsp;</div>		
				<label for="rss_url">' . $this->l('RSS URL: ') . '</label>
				<input type="text" id="rss_url" name="rss_url" value="' . Tools::safeOutput(Configuration::get('blocksocial_rss') != "" ? Configuration::get('blocksocial_rss') : "") . '" />
				<div class="clear">&nbsp;</div>						
				<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>';
    }
Example #3
0
        public function getData($params, $table = 'leobtslidermini')
        {
            $this->context = Context::getContext();
            $id_shop = $this->context->shop->id;
            $id_lang = $this->context->language->id;
            $slideminirs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
				SELECT hs.`id_' . $table . '_slides` as id_slide,
						   hssl.`image`,
						   hss.`position`,
						   hss.`active`,
						   hssl.`title`,
						   hssl.`url`,
						   hssl.`legend`,
						   hssl.`description`
				FROM ' . _DB_PREFIX_ . $table . ' hs
				LEFT JOIN ' . _DB_PREFIX_ . $table . '_slides hss ON (hs.id_leobtslidermini_slides = hss.id_' . $table . '_slides)
				LEFT JOIN ' . _DB_PREFIX_ . $table . '_slides_lang hssl ON (hss.id_leobtslidermini_slides = hssl.id_' . $table . '_slides)
				WHERE (id_shop = ' . (int) $id_shop . ')
				AND hssl.id_lang = ' . (int) $id_lang . ' AND hss.`active` = 1
				ORDER BY hss.position DESC');
            $iwidth = $params->get('imgwidth', 960);
            $iheight = $params->get('imgheight', 360);
            $twidth = $params->get('thumbwidth', 160);
            $theight = $params->get('thumbheight', 90);
            $site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'modules/' . $this->module . '/images/';
            foreach ($slideminirs as $i => $slideminir) {
                $slideminir['image'] = $site_url . $slideminir['image'];
                $slideminirs[$i]['mainimage'] = $this->renderThumb($slideminir['image'], $iwidth, $iheight);
                $slideminirs[$i]['thumbnail'] = $this->renderThumb($slideminir['image'], $twidth, $theight);
            }
            return $slideminirs;
        }
Example #4
0
    public function getContent()
    {
        // If we try to update the settings
        if (isset($_POST['submitModule'])) {
            Configuration::updateValue('blockcontactinfos_company', (isset($_POST['company']) and $_POST['company'] != '') ? $_POST['company'] : Configuration::get('PS_SHOP_NAME'));
            Configuration::updateValue('blockcontactinfos_address', (isset($_POST['address']) and $_POST['address'] != '') ? $_POST['address'] : '');
            Configuration::updateValue('blockcontactinfos_phone', (isset($_POST['phone']) and $_POST['phone'] != '') ? $_POST['phone'] : '');
            Configuration::updateValue('blockcontactinfos_email', (isset($_POST['email']) and $_POST['email'] != '') ? $_POST['email'] : Configuration::get('PS_SHOP_EMAIL'));
            echo '<div class="conf confirm"><img src="../img/admin/ok.gif"/>' . $this->l('Configuration updated') . '</div>';
        }
        $content = '
		<h2>' . $this->displayName . '</h2>
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">	
				<p><label for="company">' . $this->l('Company name') . ' :</label>
				<input type="text" id="company" name="company" value="' . Configuration::get('blockcontactinfos_company') . '" /></p>
				<p><label for="address">' . $this->l('Address') . ' :</label>
				<textarea id="address" name="address">' . Configuration::get('blockcontactinfos_address') . '</textarea></p>
				<p><label for="phone">' . $this->l('Phone number') . ' :</label>
				<input type="text" id="phone" name="phone" value="' . Configuration::get('blockcontactinfos_phone') . '" /></p>
				<p><label for="email">' . $this->l('Email') . ' :</label>
				<input type="text" id="email" name="email" value="' . Configuration::get('blockcontactinfos_email') . '" />	</p>
				<div class="clear">&nbsp;</div>
				<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>
		<div class="clear">&nbsp;</div>
		<fieldset>
			<legend>Addons</legend>
			' . $this->l('This module has been developped by PrestaShop and can only be sold through') . ' <a href="http://addons.prestashop.com">addons.prestashop.com</a>.<br />
			' . $this->l('Please report all bugs to') . ' <a href="mailto:addons@prestashop.com">addons@prestashop.com</a> ' . $this->l('or using our') . ' <a href="http://addons.prestashop.com/contact-form.php">' . $this->l('contact form') . '</a>.
		</fieldset>';
        return $content;
    }
Example #5
0
 /**
  *
  */
 public function renderContent($setting)
 {
     $t = array('name' => '', 'image' => '', 'imagesize' => '80x80', 'alignment' => '', 'animation' => '', 'ispopup' => '1', 'imageurl' => '', 'icon' => '', 'widget_heading' => '', 'icon_position' => 'left');
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $setting = array_merge($t, $setting);
     $size = explode('x', $setting['imagesize']);
     //$setting['thumbnailurl'] = $url.'modules/pspagebuilder/images/'.$setting['imagefile'];
     //$setting['imageurl'] = $url.'modules/pspagebuilder/images/'.$setting['imagefile'];
     $setting['thumbnailurl'] = '';
     $setting['imageurl'] = '';
     if (count($size) == 2 && empty($setting['icon'])) {
         $cache = _PS_CACHE_DIR_ . 'pspagebuilder/';
         if (!file_exists($cache . $setting['imagefile'])) {
             if (!is_dir($cache)) {
                 mkdir($cache, 0777);
             }
             if (ImageManager::resize(_PAGEBUILDER_IMAGE_DIR_ . $setting['imagefile'], $cache . $setting['imagefile'], $size[0], $size[1])) {
                 $setting['thumbnailurl'] = $url . 'cache/pspagebuilder/' . $setting['imagefile'];
             }
         } else {
             $setting['thumbnailurl'] = $url . 'cache/pspagebuilder/' . $setting['imagefile'];
         }
     }
     $setting['content'] = $this->getValueByLang($setting, 'content');
     $output = array('type' => 'ourservice', 'data' => $setting);
     return $output;
 }
 public function renderContent($args, $setting)
 {
     $link = new Link();
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $smallimage = $setting['smallimage'] ? $setting['smallimage'] : 'small' . '_default';
     $thickimage = $setting['thickimage'] ? $setting['thickimage'] : 'thickbox' . '_default';
     switch ($setting['ip_source']) {
         case 'ip_pproductids':
             if (empty($setting['ip_pproductids'])) {
                 return false;
             }
             if ($pproductids = $setting['ip_pproductids']) {
                 $results = $this->getImagesByProductId($pproductids, 0, $setting['ip_limit'], (int) Context::getContext()->language->id);
                 $setting['images'] = $results;
             }
             break;
         case 'ip_pcategories':
             $catids = isset($setting['categories']) && $setting['categories'] ? $setting['categories'] : array();
             if ($catids) {
                 $categories = implode(",", $catids);
                 $results = $this->getImagesByCategory($categories, 0, $setting['ip_limit'], (int) Context::getContext()->language->id);
                 $setting['images'] = $results;
             }
             break;
     }
     $setting['thickimage'] = $thickimage;
     $setting['smallimage'] = $smallimage;
     $output = array('type' => 'imageproduct', 'data' => $setting);
     return $output;
 }
Example #7
0
    public function getContent()
    {
        $html = '';
        // If we try to update the settings
        if (Tools::isSubmit('submitModule')) {
            Configuration::updateValue('blockcontact_telnumber', Tools::getValue('telnumber'));
            Configuration::updateValue('blockcontact_email', Tools::getValue('email'));
            $html .= '<div class="confirm">' . $this->l('Configuration updated') . '</div>';
        }
        $html .= '
		<h2>' . $this->displayName . '</h2>
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>			
				<label for="telnumber">' . $this->l('Telephone number:') . '</label>
				<input type="text" id="telnumber" name="telnumber" value="' . (Configuration::get('blockcontact_telnumber') != '' ? Tools::safeOutput(Configuration::get('blockcontact_telnumber')) : '') . '" />
				<div class="clear">&nbsp;</div>
				<label for="email">' . $this->l('Email:') . '</label>
				<input type="text" id="email" name="email" value="' . (Configuration::get('blockcontact_email') != '' ? Tools::safeOutput(Configuration::get('blockcontact_email')) : '') . '" />
				<div class="clear">&nbsp;</div>
				<div class="margin-form">
					<input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
				</div>
			</fieldset>
		</form>';
        return $html;
    }
Example #8
0
 /**
  *
  */
 public function renderContent($setting)
 {
     $t = array('name' => '', 'image' => '', 'imagesize' => '', 'alignment' => '', 'animation' => '', 'ispopup' => '1', 'imageurl' => '');
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $setting = array_merge($t, $setting);
     $size = explode('x', $setting['size']);
     $setting['thumbnailurl'] = _PAGEBUILDER_IMAGE_URL_ . $setting['imagefile'];
     $setting['imageurl'] = _PAGEBUILDER_IMAGE_URL_ . $setting['imagefile'];
     if (count($size) == 2) {
         $cache = _PS_CACHE_DIR_ . 'pspagebuilder/';
         if (!file_exists($cache . $setting['imagefile'])) {
             if (!is_dir($cache)) {
                 mkdir($cache, 0755);
             }
             if (ImageManager::resize(_PAGEBUILDER_IMAGE_DIR_ . $setting['imagefile'], $cache . $setting['imagefile'], $size[0], $size[1])) {
                 $setting['thumbnailurl'] = $url . 'cache/pspagebuilder/' . $setting['imagefile'];
             }
         } else {
             $setting['thumbnailurl'] = $url . 'cache/pspagebuilder/' . $setting['imagefile'];
         }
     }
     $output = array('type' => 'image', 'data' => $setting);
     return $output;
 }
Example #9
0
    public function getContent()
    {
        // If we try to update the settings
        if (isset($_POST['submitModule'])) {
            Configuration::updateValue('blocksocial_facebook', $_POST['facebook_url'] != '' ? $_POST['facebook_url'] : '');
            Configuration::updateValue('blocksocial_twitter', $_POST['twitter_url'] != '' ? $_POST['twitter_url'] : '');
            Configuration::updateValue('blocksocial_rss', $_POST['rss_url'] != '' ? $_POST['rss_url'] : '');
            echo '<div class="conf confirm"><img src="../img/admin/ok.gif"/>' . $this->l('Configuration updated') . '</div>';
        }
        return '
		<h2>' . $this->displayName . '</h2>
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">				
				<label for="facebook_url">' . $this->l('Facebook URL : ') . '</label>
				<input type="text" id="facebook_url" name="facebook_url" value="' . (Configuration::get('blocksocial_facebook') != "" ? Configuration::get('blocksocial_facebook') : "") . '" />
				<div class="clear">&nbsp;</div>		
				<label for="twitter_url">' . $this->l('Twitter URL : ') . '</label>
				<input type="text" id="twitter_url" name="twitter_url" value="' . (Configuration::get('blocksocial_twitter') != "" ? Configuration::get('blocksocial_twitter') : "") . '" />
				<div class="clear">&nbsp;</div>		
				<label for="rss_url">' . $this->l('RSS URL : ') . '</label>
				<input type="text" id="rss_url" name="rss_url" value="' . (Configuration::get('blocksocial_rss') != "" ? Configuration::get('blocksocial_rss') : "") . '" />
				<div class="clear">&nbsp;</div>						
				<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>
		<div class="clear">&nbsp;</div>
		<fieldset>
			<legend>Addons</legend>
			' . $this->l('This module has been developped by PrestaShop and can only be sold through') . ' <a href="http://addons.prestashop.com">addons.prestashop.com</a>.<br />
			' . $this->l('Please report all bugs to') . ' <a href="mailto:addons@prestashop.com">addons@prestashop.com</a> ' . $this->l('or using our') . ' <a href="http://addons.prestashop.com/contact-form.php">' . $this->l('contact form') . '</a>.
		</fieldset>';
    }
Example #10
0
    public function getContent()
    {
        $html = '';
        // If we try to update the settings
        if (isset($_POST['submitModule'])) {
            Configuration::updateValue('blockcontactinfos_company', isset($_POST['company']) && $_POST['company'] != '' ? $_POST['company'] : Configuration::get('PS_SHOP_NAME'));
            Configuration::updateValue('blockcontactinfos_address', isset($_POST['address']) && $_POST['address'] != '' ? $_POST['address'] : '');
            Configuration::updateValue('blockcontactinfos_phone', isset($_POST['phone']) && $_POST['phone'] != '' ? $_POST['phone'] : '');
            Configuration::updateValue('blockcontactinfos_email', isset($_POST['email']) && $_POST['email'] != '' ? $_POST['email'] : Configuration::get('PS_SHOP_EMAIL'));
            $html .= '<div class="confirm">' . $this->l('Configuration updated') . '</div>';
        }
        $html .= '
		<h2>' . $this->displayName . '</h2>
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>	
				<p><label for="company">' . $this->l('Company name') . ' :</label>
				<input type="text" id="company" name="company" value="' . Tools::safeOutput(Configuration::get('blockcontactinfos_company')) . '" /></p>
				<p><label for="address">' . $this->l('Address') . ' :</label>
				<textarea id="address" name="address" cols="60" rows="4">' . Tools::safeOutput(Configuration::get('blockcontactinfos_address')) . '</textarea></p>
				<p><label for="phone">' . $this->l('Phone number') . ' :</label>
				<input type="text" id="phone" name="phone" value="' . Tools::safeOutput(Configuration::get('blockcontactinfos_phone')) . '" /></p>
				<p><label for="email">' . $this->l('Email') . ' :</label>
				<input type="text" id="email" name="email" value="' . Tools::safeOutput(Configuration::get('blockcontactinfos_email')) . '" />	</p>
				<div class="margin-form">
					<input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
				</div>
			</fieldset>
		</form>
		';
        return $html;
    }
 public function renderView()
 {
     $link = $this->context->link;
     $quicktools = array();
     $quicktools[] = array('title' => $this->l('Categories'), 'href' => $link->getAdminLink('AdminLeoblogCategories'), 'icon' => 'icon-desktop', 'class' => '');
     $quicktools[] = array('title' => $this->l('Add Category'), 'href' => $link->getAdminLink('AdminLeoblogCategories'), 'icon' => 'icon-list', 'class' => '');
     $quicktools[] = array('title' => $this->l('Blogs'), 'href' => $link->getAdminLink('AdminLeoblogBlogs'), 'icon' => 'icon-list', 'class' => '');
     $quicktools[] = array('title' => $this->l('Add Blog'), 'href' => $link->getAdminLink('AdminLeoblogBlogs') . '&addleoblog_blog', 'icon' => 'icon-list', 'class' => '');
     $quicktools[] = array('title' => $this->l('Comments'), 'href' => $link->getAdminLink('AdminLeoblogBlogs') . '&listcomments', 'icon' => 'icon-list', 'class' => '');
     $onoff = array(array('id' => 'indexation_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'indexation_off', 'value' => 0, 'label' => $this->l('Disabled')));
     //$obj           = new Leoblogcat();
     //$menus         = $obj->getDropdown(null, $obj->id_parent);
     $templates = LeoBlogHelper::getTemplates();
     $url_rss = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'modules/leoblog/rss.php';
     $form = '';
     $this->fields_form[0]['form'] = array('tinymce' => true, 'legend' => array('title' => $this->l('General Setting'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'select', 'label' => $this->l('Theme - Template'), 'name' => 'template', 'options' => array('query' => $templates, 'id' => 'template', 'name' => 'template'), 'default' => 'default'), array('type' => 'text', 'label' => $this->l('Root Link Title'), 'name' => 'blog_link_title', 'required' => true, 'lang' => true, 'desc' => $this->l('Make Link Title For Blog Root Link, Example http://domain/blog'), 'default' => 'Blog'), array('type' => 'text', 'label' => $this->l('Root Friendly URL'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true, 'desc' => $this->l('Make seo start with this, Example http://domain/blog'), 'default' => 'blog'), array('type' => 'text', 'label' => $this->l('Meta Title'), 'name' => 'meta_title', 'lang' => true, 'cols' => 40, 'rows' => 10, 'default' => 'Blog', 'desc' => $this->l('Display browser title on frontpage blog')), array('type' => 'textarea', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'cols' => 40, 'rows' => 10, 'default' => '', 'desk' => $this->l('Display meta descrition on frontpage blog') . 'note: note &lt;&gt;;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'default' => '', 'lang' => true, 'desc' => array($this->l('Invalid characters:') . ' &lt;&gt;;=#{}', $this->l('To add "tags" click in the field, write something, and then press "Enter."'))), array('type' => 'switch', 'label' => $this->l('Enable Rss:'), 'name' => 'indexation', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '', 'values' => $onoff, 'desc' => $url_rss), array('type' => 'text', 'label' => $this->l('Rss Limit Items'), 'name' => 'rss_limit_item', 'default' => '20', 'desc' => 'Set Maximun shows in rss'), array('type' => 'text', 'label' => $this->l('Rss Title'), 'name' => 'rss_title_item', 'default' => 'RSS FEED', 'desc' => 'Set title in rss')), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-danger'));
     $this->fields_form[1]['form'] = array('tinymce' => true, 'default' => '', 'legend' => array('title' => $this->l('Listing Blog Setting'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'switch', 'label' => $this->l('Show Category Info:'), 'name' => 'listing_show_categoryinfo', 'required' => false, 'class' => 't', 'desc' => $this->l('Display category information in listing blogs'), 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Sub Categories:'), 'name' => 'listing_show_subcategories', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff, 'desc' => $this->l('Display subcategory in listing blog')), array('type' => 'text', 'label' => $this->l('Leading Column:'), 'name' => 'listing_leading_column', 'required' => false, 'class' => 't', 'default' => '1'), array('type' => 'text', 'label' => $this->l('Leading Limit Items:'), 'name' => 'listing_leading_limit_items', 'required' => false, 'class' => 't', 'default' => '2'), array('type' => 'text', 'label' => $this->l('Leading Image Width:'), 'name' => 'listing_leading_img_width', 'required' => false, 'class' => 't', 'default' => '690'), array('type' => 'text', 'label' => $this->l('Leading Image Height:'), 'name' => 'listing_leading_img_height', 'required' => false, 'class' => 't', 'default' => '300'), array('type' => 'text', 'label' => $this->l('Secondary Column:'), 'name' => 'listing_secondary_column', 'required' => false, 'class' => 't', 'default' => '3'), array('type' => 'text', 'label' => $this->l('Secondary Limit Items:'), 'name' => 'listing_secondary_limit_items', 'required' => false, 'class' => 't', 'default' => '6'), array('type' => 'text', 'label' => $this->l('Secondary Image Width:'), 'name' => 'listing_secondary_img_width', 'required' => false, 'class' => 't', 'default' => '390'), array('type' => 'text', 'label' => $this->l('Secondary Image Height:'), 'name' => 'listing_secondary_img_height', 'required' => false, 'class' => 't', 'default' => '220'), array('type' => 'switch', 'label' => $this->l('Show Title:'), 'name' => 'listing_show_title', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Description:'), 'name' => 'listing_show_description', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Readmore:'), 'name' => 'listing_show_readmore', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Image:'), 'name' => 'listing_show_image', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Author:'), 'name' => 'listing_show_author', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Category:'), 'name' => 'listing_show_category', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Created Date:'), 'name' => 'listing_show_created', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Hits:'), 'name' => 'listing_show_hit', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Counter:'), 'name' => 'listing_show_counter', 'required' => false, 'class' => 't', 'default' => '1', 'values' => $onoff)), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-danger'));
     $this->fields_form[2]['form'] = array('tinymce' => true, 'default' => '', 'legend' => array('title' => $this->l('Item Blog Setting'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'text', 'label' => $this->l('Item Image Width:'), 'name' => 'item_img_width', 'required' => false, 'class' => 't', 'default' => '690'), array('type' => 'text', 'label' => $this->l('Item Image Height:'), 'name' => 'item_img_height', 'required' => false, 'class' => 't', 'default' => '350'), array('type' => 'switch', 'label' => $this->l('Show Description:'), 'name' => 'item_show_description', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Image:'), 'name' => 'item_show_image', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Author:'), 'name' => 'item_show_author', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Category:'), 'name' => 'item_show_category', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Created Date:'), 'name' => 'item_show_created', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Hits:'), 'name' => 'item_show_hit', 'required' => false, 'class' => 't', 'is_bool' => true, 'default' => '1', 'values' => $onoff), array('type' => 'switch', 'label' => $this->l('Show Counter:'), 'name' => 'item_show_counter', 'required' => false, 'class' => 't', 'default' => '1', 'values' => $onoff), array('type' => 'textarea', 'label' => $this->l('Social Sharing CODE'), 'name' => 'social_code', 'required' => false, 'default' => '', 'desc' => 'put sharing social code from sharethis service....to replace current sharing social.'), array('type' => 'select', 'label' => $this->l('Comment Engine:'), 'name' => 'item_comment_engine', 'id' => 'item_comment_engine', 'options' => array('query' => array(array('id' => 'local', 'name' => $this->l('Local')), array('id' => 'facebook', 'name' => $this->l('Facebook')), array('id' => 'diquis', 'name' => $this->l('Diquis'))), 'id' => 'id', 'name' => 'name'), 'default' => 'local'), array('type' => 'text', 'label' => $this->l('Limit Local Comment'), 'name' => 'item_limit_comments', 'required' => false, 'class' => 't', 'default' => '10'), array('type' => 'text', 'label' => $this->l('Diquis Account:'), 'name' => 'item_diquis_account', 'required' => false, 'class' => 't', 'default' => 'demo4leotheme', 'desc' => '<a target="_blank" href="https://disqus.com/admin/signup/">' . $this->l('Sign Up Diquis') . '</a>'), array('type' => 'text', 'label' => $this->l('Facebook Application ID:'), 'name' => 'item_facebook_appid', 'required' => false, 'class' => 't', 'default' => '100858303516', 'desc' => '<a target="_blank" href="http://developers.facebook.com/docs/reference/plugins/comments/">' . $this->l('Register A Comment Box, Then Get Application ID in Script Or Register Facebook Application ID to moderate comments') . '</a>'), array('type' => 'text', 'label' => $this->l('Facebook Width:'), 'name' => 'item_facebook_width', 'required' => false, 'class' => 't', 'default' => '600')), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-danger'));
     $data = LeoBlogConfig::getConfigValue('cfg_global');
     $obj = new stdClass();
     if ($data && ($tmp = unserialize($data))) {
         foreach ($tmp as $key => $value) {
             # validate module
             $obj->{$key} = $value;
         }
     }
     $fields_value = $this->getConfigFieldsValues($obj);
     $helper = new HelperForm($this);
     $this->setHelperDisplay($helper);
     $helper->fields_value = $fields_value;
     $helper->tpl_vars = $this->tpl_form_vars;
     !is_null($this->base_tpl_form) ? $helper->base_tpl = $this->base_tpl_form : '';
     if ($this->tabAccess['view']) {
         $helper->tpl_vars['show_toolbar'] = false;
         $helper->tpl_vars['submit_action'] = 'saveConfiguration';
         if (Tools::getValue('back')) {
             $helper->tpl_vars['back'] = '';
         } else {
             $helper->tpl_vars['back'] = '';
         }
     }
     $form = $helper->generateForm($this->fields_form);
     $template = $this->createTemplate('panel.tpl');
     $comments = LeoBlogComment::getComments(null, 10, $this->context->language->id);
     $blogs = LeoBlogBlog::getListBlogs(null, $this->context->language->id, 0, 10, 'hits', 'DESC');
     $template->assign(array('quicktools' => $quicktools, 'showed' => 1, 'comment_link' => $link->getAdminLink('AdminLeoblogComments'), 'blog_link' => $link->getAdminLink('AdminLeoblogBlogs'), 'blogs' => $blogs, 'count_blogs' => LeoBlogBlog::countBlogs(null, $this->context->language->id), 'count_cats' => Leoblogcat::countCats(), 'count_comments' => LeoBlogComment::countComments(), 'latest_comments' => $comments, 'globalform' => $form));
     return $template->fetch();
 }
Example #12
0
 public function renderView()
 {
     $link = $this->context->link;
     $quicktools = array();
     $quicktools[] = array('title' => $this->l('Categories'), 'href' => $link->getAdminLink('AdminLeoblogCategories'), 'icon' => 'icon-desktop', 'class' => '');
     $quicktools[] = array('title' => $this->l('Add Category'), 'href' => $link->getAdminLink('AdminLeoblogCategories'), 'icon' => 'icon-list', 'class' => '');
     $quicktools[] = array('title' => $this->l('Blogs'), 'href' => $link->getAdminLink('AdminLeoblogBlogs'), 'icon' => 'icon-list', 'class' => '');
     $quicktools[] = array('title' => $this->l('Add Blog'), 'href' => $link->getAdminLink('AdminLeoblogBlogs') . '&addleoblog_blog', 'icon' => 'icon-list', 'class' => '');
     $quicktools[] = array('title' => $this->l('Comments'), 'href' => $link->getAdminLink('AdminLeoblogBlogs') . '&listcomments', 'icon' => 'icon-list', 'class' => '');
     $onoff = array(array('id' => 'indexation_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'indexation_off', 'value' => 0, 'label' => $this->l('Disabled')));
     $obj = new Leoblogcat();
     $menus = $obj->getDropdown(null, $obj->id_parent);
     $templates = LeoBlogHelper::getTemplates();
     $url_rss = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'modules/leoblog/rss.php';
     $form = '';
     $this->fields_form[0]['form'] = array('tinymce' => true, 'legend' => array('title' => $this->l('General Setting'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'html', 'html_content' => 'Please access <a href="http://apollotheme.com/" target="_blank" title="apollo site">Apollotheme.com</a> to buy professional version to use this '), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/how-to-buy-pro-version/" target="_blank" title="How to buy">How to buy Professional Version</a>'), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/different-between-free-pro-version/" target="_blank" title="Why should use">Why should use Professional Version</a>')), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-danger'));
     $this->fields_form[1]['form'] = array('tinymce' => true, 'default' => '', 'legend' => array('title' => $this->l('Listing Blog Setting'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'html', 'html_content' => 'Please access <a href="http://apollotheme.com/" target="_blank" title="apollo site">Apollotheme.com</a> to buy professional version to use this '), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/how-to-buy-pro-version/" target="_blank" title="How to buy">How to buy Professional Version</a>'), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/different-between-free-pro-version/" target="_blank" title="Why should use">Why should use Professional Version</a>')), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-danger'));
     $this->fields_form[2]['form'] = array('tinymce' => true, 'default' => '', 'legend' => array('title' => $this->l('Item Blog Setting'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'html', 'html_content' => 'Please access <a href="http://apollotheme.com/" target="_blank" title="apollo site">Apollotheme.com</a> to buy professional version to use this '), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/how-to-buy-pro-version/" target="_blank" title="How to buy">How to buy Professional Version</a>'), array('type' => 'html', 'html_content' => '<a target="_blank" href="http://apollotheme.com/different-between-free-pro-version/" target="_blank" title="Why should use">Why should use Professional Version</a>')), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-danger'));
     $data = LeoBlogConfig::getConfigValue('cfg_global');
     $obj = new stdClass();
     if ($data && ($tmp = unserialize($data))) {
         foreach ($tmp as $key => $value) {
             $obj->{$key} = $value;
         }
     }
     $fields_value = $this->getConfigFieldsValues($obj);
     $helper = new HelperForm($this);
     $this->setHelperDisplay($helper);
     $helper->fields_value = $fields_value;
     $helper->tpl_vars = $this->tpl_form_vars;
     !is_null($this->base_tpl_form) ? $helper->base_tpl = $this->base_tpl_form : '';
     if ($this->tabAccess['view']) {
         $helper->tpl_vars['show_toolbar'] = false;
         $helper->tpl_vars['submit_action'] = 'saveConfiguration';
         if (Tools::getValue('back')) {
             $helper->tpl_vars['back'] = '';
         } else {
             $helper->tpl_vars['back'] = '';
         }
     }
     $form = $helper->generateForm($this->fields_form);
     $template = $this->createTemplate('panel.tpl');
     $comments = LeoBlogComment::getComments(null, 10, $this->context->language->id);
     $blogs = LeoBlogBlog::getListBlogs(null, $this->context->language->id, 0, 10, 'hits', 'DESC');
     $template->assign(array('quicktools' => $quicktools, 'showed' => 1, 'comment_link' => $link->getAdminLink('AdminLeoblogComments'), 'blog_link' => $link->getAdminLink('AdminLeoblogBlogs'), 'blogs' => $blogs, 'count_blogs' => LeoBlogBlog::countBlogs(null, $this->context->language->id), 'count_cats' => Leoblogcat::countCats(), 'count_comments' => LeoBlogComment::countComments(), 'latest_comments' => $comments, 'globalform' => $form));
     return $template->fetch();
 }
Example #13
0
        /**
         * Constructor
         */
        public function LofParams($name, $hookAssign = array())
        {
            global $cookie;
            $this->name = $name;
            $this->hookAssign = $hookAssign;
            $id_lang = intval($cookie->id_lang);
            $this->site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
            $result = Db::getInstance()->ExecuteS('
		SELECT c.name,IFNULL(' . ($id_lang ? 'cl' : 'c') . '.`value`, c.`value`) AS value
		FROM `' . _DB_PREFIX_ . 'configuration` c
		' . ($id_lang ? 'LEFT JOIN `' . _DB_PREFIX_ . 'configuration_lang` cl ON (c.`id_configuration` = cl.`id_configuration` AND cl.`id_lang` = ' . intval($id_lang) . ')' : '') . '
		WHERE `name` LIKE \'' . pSQL($name) . '%\'');
            foreach ($result as $row) {
                $this->_data[$row["name"]] = $row["value"];
            }
            $this->Languages();
        }
Example #14
0
 public function renderContent($setting)
 {
     $t = array('name' => '', 'imageslist' => '', 'size' => '', 'columns' => 4, 'links' => '', 'type' => 'grid', 'images' => array(), 'id' => time());
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $setting = array_merge($t, $setting);
     $size = explode('x', $setting['size']);
     $tmp = explode(',', $setting['imageslist']);
     $links = preg_split('#\\s+#', trim($setting['links']));
     $output = array();
     foreach ($tmp as $key => $file) {
         $info = $this->renderImage($url, trim($file), $size);
         $info['link'] = isset($links[$key]) ? $links[$key] : '';
         $output[] = $info;
     }
     $setting['images'] = $output;
     $output = array('type' => 'gallery', 'data' => $setting);
     return $output;
 }
Example #15
0
 /**
  * Proccess module by hook
  * $pparams: param of module
  * $pos: position call
  */
 function processHook($pparams, $pos = "home")
 {
     global $smarty, $cookie;
     //load param
     $params = $this->_params;
     $this->site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $module_title = $params->get('module_title_' . $cookie->id_lang, 'Custom HTML');
     $show_title = $params->get('show_title', '');
     $class_prefix = $params->get('class_prefix', '');
     $content = str_replace('LOF_DEMO_CUSTOM_URL/', __PS_BASE_URI__, $params->get('content_' . $cookie->id_lang, ''));
     $objLang = new Language($cookie->id_lang);
     $defaultC = $this->contentDefault();
     if ($content == "") {
         $content = $objLang->iso_code == 'fr' ? $defaultC['fr'] : $defaultC['en'];
     }
     // template asignment variables
     $smarty->assign(array('pos' => $pos, 'module_title' => $module_title, 'show_title' => $show_title, 'class_prefix' => $class_prefix, 'content' => $content));
     return $this->display(__FILE__, 'tmpl/default.tpl');
 }
Example #16
0
 public function getFrontTree($parent = 1, $edit = false, $params = array())
 {
     $this->parserMegaConfig($params);
     if ($edit) {
         $this->edit_string = ' data-id="%s" data-group="%s"  data-cols="%s" ';
     } else {
         $this->is_live_edit = false;
         $this->model_menu_widget = new PsMegamenuWidget();
         $this->model_menu_widget->setTheme(Context::getContext()->shop->getTheme());
         $this->model_menu_widget->lang_id = Context::getContext()->language->id;
         $this->model_menu_widget->loadWidgets();
         $this->model_menu_widget->loadEngines();
     }
     $this->edit_string_col = ' data-colwidth="%s" data-class="%s" ';
     $childs = $this->getChild(null, null, null, true);
     foreach ($childs as $child) {
         $child['megaconfig'] = $this->hasMegaMenuConfig($child);
         $child['megamenu_id'] = $child['id_psmegamenu'];
         $child['title'] = htmlentities(Tools::stripslashes($child['title']), ENT_COMPAT, 'UTF-8');
         if (isset($child['megaconfig']->group)) {
             $child['is_group'] = $child['megaconfig']->group;
         }
         if (isset($child['megaconfig']->submenu) && $child['megaconfig']->submenu == 0) {
             $child['menu_class'] = $child['menu_class'] . ' disable-menu';
         }
         $this->children[$child['id_parent']][] = $child;
     }
     $parent = 1;
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $this->image_base_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST']) . _PSMEGAMENU_IMAGE_URL_;
     $this->shop_url = $this->image_base_url;
     $output = '';
     if ($this->hasChild($parent)) {
         $data = $this->getNodes($parent);
         $output = '<ul class="nav navbar-nav megamenu">';
         foreach ($data as $menu) {
             if (isset($menu['megaconfig']->align)) {
                 $menu['menu_class'] .= ' ' . $menu['megaconfig']->align;
             }
             if ($this->hasChild($menu['megamenu_id']) || $menu['type_submenu'] == 'html') {
                 $output .= '<li class="parent dropdown ' . $menu['menu_class'] . '" ' . $this->renderAttrs($menu) . '>
                 <a class="dropdown-toggle has-subhtml" data-toggle="dropdown" href="' . $this->getLink($menu) . '" target="' . $menu['target'] . '">';
                 if ($menu['icon_class']) {
                     $output .= '<span class="hasicon"><span class="' . $menu['icon_class'] . '"></span>';
                 } elseif ($menu['image'] && is_file(_PSMEGAMENU_IMAGE_DIR_ . $menu['image'])) {
                     $output .= '<span class="hasicon menu-icon" style="background:url(\'' . $this->image_base_url . $menu['image'] . '\') no-repeat;">';
                 }
                 $output .= '<span class="menu-title">' . $menu['title'] . '</span>';
                 if ($menu['text']) {
                     $output .= '<span class="sub-title">' . $menu['text'] . '</span>';
                 }
                 if ($menu['description']) {
                     $output .= '<span class="menu-desc">' . $menu['description'] . '</span>';
                 }
                 if ($menu['image'] && is_file(_PSMEGAMENU_IMAGE_DIR_ . $menu['image']) || $menu['icon_class']) {
                     $output .= '</span>';
                 }
                 $output .= '<b class="caret"></b></a>';
                 $output .= $this->genFrontTree($menu['megamenu_id'], 1, $menu);
                 $output .= '</li>';
             } elseif (!$this->hasChild($menu['megamenu_id']) && $menu['megaconfig'] && $menu['megaconfig']->rows) {
                 $output .= $this->genMegaMenuByConfig(1, $menu);
             } else {
                 $output .= '<li class="' . $menu['menu_class'] . '" ' . $this->renderAttrs($menu) . '>
                 <a href="' . $this->getLink($menu) . '" target="' . $menu['target'] . '">';
                 if ($menu['icon_class']) {
                     $output .= '<span class="hasicon"><span class="' . $menu['icon_class'] . '"></span>';
                 } elseif ($menu['image'] && is_file(_PSMEGAMENU_IMAGE_DIR_ . $menu['image'])) {
                     $output .= '<span class="hasicon menu-icon" style="background:url(\'' . $this->image_base_url . $menu['image'] . '\') no-repeat;">';
                 }
                 $output .= '<span class="menu-title">' . $menu['title'] . '</span>';
                 if ($menu['text']) {
                     $output .= '<span class="sub-title">' . $menu['text'] . '</span>';
                 }
                 if ($menu['description']) {
                     $output .= '<span class="menu-desc">' . $menu['description'] . '</span>';
                 }
                 if ($menu['image'] && is_file(_PSMEGAMENU_IMAGE_DIR_ . $menu['image']) || $menu['icon_class']) {
                     $output .= '</span>';
                 }
                 $output .= '</a></li>';
             }
         }
         $output .= '</ul>';
     }
     $this->menu_module = null;
     return $output;
 }
Example #17
0
 private function _prepareHook()
 {
     $slider = array();
     foreach ($this->_configs as $key => $config) {
         $slider[$key] = $this->getParams()->get($key, $config);
     }
     $source = $this->getParams()->get("source", 'images');
     $path = _PS_CACHEFS_DIRECTORY_ . $this->name;
     if (!file_exists($path)) {
         mkdir($path, 0777);
     }
     $site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'cache/cachefs/' . $this->name;
     $slides = LeoBaseSource::getSource($source)->setModuleName('leobtslider', $path, $site_url)->getData($this->getParams());
     if (!$slides) {
         return false;
     }
     //echo '<pre>'.print_r($slides,1); die;
     $this->smarty->assign('leobtslider_slides', $slides);
     $this->smarty->assign('leobtslider', $slider);
     $this->smarty->assign('leobtslider_modid', $this->id);
     return true;
 }
Example #18
0
 public static function getNestedCategories($images, $root_category = null, $id_lang = false, $active = true, $groups = null, $use_shop_restriction = true, $sql_filter = '', $sql_sort = '', $sql_limit = '')
 {
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     $themeName = Context::getContext()->shop->getTheme();
     $image_path = 'themes/' . $themeName . '/img/icontab/';
     if (isset($root_category) && !Validate::isInt($root_category)) {
         die(Tools::displayError());
     }
     if (!Validate::isBool($active)) {
         die(Tools::displayError());
     }
     if (isset($groups) && Group::isFeatureActive() && !is_array($groups)) {
         $groups = (array) $groups;
     }
     $cache_id = 'Category::getNestedCategories_' . md5((int) $root_category . (int) $id_lang . (int) $active . (int) $active . (isset($groups) && Group::isFeatureActive() ? implode('', $groups) : ''));
     if (!Cache::isStored($cache_id)) {
         $result = Db::getInstance()->executeS('
             SELECT c.*, cl.*
             FROM `' . _DB_PREFIX_ . 'category` c
             ' . ($use_shop_restriction ? Shop::addSqlAssociation('category', 'c') : '') . '
             LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON c.`id_category` = cl.`id_category`' . Shop::addSqlRestrictionOnLang('cl') . '
             ' . (isset($groups) && Group::isFeatureActive() ? 'LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON c.`id_category` = cg.`id_category`' : '') . '
             ' . (isset($root_category) ? 'RIGHT JOIN `' . _DB_PREFIX_ . 'category` c2 ON c2.`id_category` = ' . (int) $root_category . ' AND c.`nleft` >= c2.`nleft` AND c.`nright` <= c2.`nright`' : '') . '
             WHERE 1 ' . $sql_filter . ' ' . ($id_lang ? 'AND `id_lang` = ' . (int) $id_lang : '') . '
             ' . ($active ? ' AND c.`active` = 1' : '') . '
             ' . (isset($groups) && Group::isFeatureActive() ? ' AND cg.`id_group` IN (' . implode(',', $groups) . ')' : '') . '
             ' . (!$id_lang || isset($groups) && Group::isFeatureActive() ? ' GROUP BY c.`id_category`' : '') . '
             ' . ($sql_sort != '' ? $sql_sort : ' ORDER BY c.`level_depth` ASC') . '
             ' . ($sql_sort == '' && $use_shop_restriction ? ', category_shop.`position` ASC' : '') . '
             ' . ($sql_limit != '' ? $sql_limit : ''));
         $categories = array();
         $buff = array();
         if (!isset($root_category)) {
             $root_category = 1;
         }
         foreach ($result as $row) {
             //add image to a category
             if (array_key_exists($row['id_category'], $images)) {
                 # validate module
                 $row['image'] = $url . $image_path . $images[$row['id_category']];
             }
             $row['id_image'] = $row['id_category'] && file_exists(_PS_CAT_IMG_DIR_ . (int) $row['id_category'] . '.jpg') ? (int) $row['id_category'] : false;
             $current =& $buff[$row['id_category']];
             $current = $row;
             if ($row['id_category'] == $root_category) {
                 # validate module
                 $categories[$row['id_category']] =& $current;
             } else {
                 # validate module
                 $buff[$row['id_parent']]['children'][$row['id_category']] =& $current;
             }
         }
         Cache::store($cache_id, $categories);
     }
     return Cache::retrieve($cache_id);
 }
    public function getContent()
    {
        $html = '';
        if (Tools::isSubmit('submitModule')) {
            Configuration::updateValue('AUTHORIZE_AIM_LOGIN_ID', Tools::getvalue('authorizeaim_login_id'));
            Configuration::updateValue('AUTHORIZE_AIM_KEY', Tools::getvalue('authorizeaim_key'));
            Configuration::updateValue('AUTHORIZE_AIM_DEMO', Tools::getvalue('authorizeaim_demo_mode'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_VISA', Tools::getvalue('authorizeaim_card_visa'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_MASTERCARD', Tools::getvalue('authorizeaim_card_mastercard'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_DISCOVER', Tools::getvalue('authorizeaim_card_discover'));
            Configuration::updateValue('AUTHORIZE_AIM_CARD_AX', Tools::getvalue('authorizeaim_card_ax'));
            Configuration::updateValue('AUTHORIZE_AIM_HOLD_REVIEW_OS', Tools::getvalue('authorizeaim_hold_review_os'));
            $html .= $this->displayConfirmation($this->l('Configuration updated'));
        }
        // For Hold for Review
        $orderStates = OrderState::getOrderStates((int) $this->context->cookie->id_lang);
        $html .= '<h2>' . $this->displayName . '</h2>
		<fieldset><legend><img src="../modules/' . $this->name . '/logo.gif" alt="" /> ' . $this->l('Help') . '</legend>
			<a href="http://api.prestashop.com/partner/authorize.net/" target="_blank" style="float: right;"><img src="../modules/' . $this->name . '/logo_authorize.png" alt="" /></a>
			<h3>' . $this->l('In your PrestaShop admin panel') . '</h3>
			- ' . $this->l('Fill the  Login ID  provided by Authorize.net') . '<br />
			- ' . $this->l('Fill the key field with the transaction key provided by Authorize.net') . '<br />
			<span style="color: red;" >- ' . $this->l('Warning: Your website must possess a SSL certificate to use the Authorize.net AIM payment system. You are responsible for the safety of your customers\' bank information. PrestaShop cannot be blamed for any security issue on your website.') . '</span><br />
			<br />
		</fieldset><br />
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">
				<legend><img src="../img/admin/contact.gif" alt="" />' . $this->l('Settings') . '</legend>
				<label for="authorizeaim_login_id">' . $this->l('Login ID') . '</label>
				<div class="margin-form"><input type="text" size="20" id="authorizeaim_login_id" name="authorizeaim_login_id" value="' . Configuration::get('AUTHORIZE_AIM_LOGIN_ID') . '" /></div>
				<label for="authorizeaim_key">' . $this->l('Key') . '</label>
				<div class="margin-form"><input type="text" size="20" id="authorizeaim_login_id" name="authorizeaim_key" value="' . Configuration::get('AUTHORIZE_AIM_KEY') . '" /></div>
				<label for="authorizeaim_demo_mode">' . $this->l('Mode:') . '</label>
				<div class="margin-form" id="authorizeaim_demo">
					<input type="radio" name="authorizeaim_demo_mode" value="0" style="vertical-align: middle;" ' . (!Tools::getValue('authorizeaim_demo_mode', Configuration::get('AUTHORIZE_AIM_DEMO')) ? 'checked="checked"' : '') . ' />
					<span style="color: #080;">' . $this->l('Production') . '</span>
					<input type="radio" name="authorizeaim_demo_mode" value="1" style="vertical-align: middle;" ' . (Tools::getValue('authorizeaim_demo_mode', Configuration::get('AUTHORIZE_AIM_DEMO')) ? 'checked="checked"' : '') . ' />
					<span style="color: #900;">' . $this->l('Test') . '</span>
				</div>
				<label for="authorizeaim_cards">' . $this->l('Cards:') . '</label>
				<div class="margin-form" id="authorizeaim_cards">
					<input type="checkbox" name="authorizeaim_card_visa" ' . (Configuration::get('AUTHORIZE_AIM_CARD_VISA') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/visa.gif" alt="visa" />
					<input type="checkbox" name="authorizeaim_card_mastercard" ' . (Configuration::get('AUTHORIZE_AIM_CARD_MASTERCARD') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/mastercard.gif" alt="visa" />
					<input type="checkbox" name="authorizeaim_card_discover" ' . (Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/discover.gif" alt="visa" />
					<input type="checkbox" name="authorizeaim_card_ax" ' . (Configuration::get('AUTHORIZE_AIM_CARD_AX') ? 'checked="checked"' : '') . ' />
						<img src="../modules/' . $this->name . '/cards/ax.gif" alt="visa" />
				</div>

				<label for="authorizeaim_hold_review_os">' . $this->l('Order status:  "Hold for Review" ') . '</label>
				<div class="margin-form">
								<select id="authorizeaim_hold_review_os" name="authorizeaim_hold_review_os">';
        // Hold for Review order state selection
        foreach ($orderStates as $os) {
            $html .= '
				<option value="' . (int) $os['id_order_state'] . '"' . ((int) $os['id_order_state'] == (int) Configuration::get('AUTHORIZE_AIM_HOLD_REVIEW_OS') ? ' selected' : '') . '>' . Tools::stripslashes($os['name']) . '</option>' . "\n";
        }
        return $html . '</select></div>
				<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>';
    }
 public function processHook()
 {
     if (!$this->isCached('ecomblockmanufacturer.tpl', $this->getCacheId())) {
         $this->site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
         $manuf_page = $this->getConfigValue('page', 6);
         $manuf_cols = $this->getConfigValue('col', 3);
         $show_title = $this->getConfigValue('active_title', 1);
         $auto_play = $this->getConfigValue('active_play', 0);
         $image_types = $this->getConfigValue('type_img', 'pf_manufacturer');
         $interval = $this->getConfigValue('intv', 8000);
         if (!$auto_play) {
             $interval = 'false';
         }
         $manufacturers = Manufacturer::getManufacturers(false, $this->context->language->id, true);
         //echo '<pre>'.print_r($manufacturers,1);die;
         $id_manufacturers = array();
         foreach ($manufacturers as $m) {
             $id_manufacturers[] = $m['id_manufacturer'];
         }
         $manufs = array();
         foreach ($id_manufacturers as $id_manufacturer) {
             $manufacturer = new Manufacturer($id_manufacturer, $this->context->language->id);
             if (Validate::isLoadedObject($manufacturer)) {
                 $manufs[$id_manufacturer]['link'] = $this->context->link->getManufacturerLink($id_manufacturer, $manufacturer->link_rewrite, $this->context->language->id);
                 $manufs[$id_manufacturer]['id_manufacturer'] = $id_manufacturer;
                 $manufs[$id_manufacturer]['name'] = $manufacturer->name;
                 $manufs[$id_manufacturer]['linkIMG'] = $id_manufacturer . '-' . $image_types . '.jpg';
             }
         }
         $this->smarty->assign(array('manuf_page' => $manuf_page, 'manuf_cols' => $manuf_cols, 'scolumn' => 12 / $manuf_cols, 'show_title' => $show_title, 'auto_play' => $auto_play, 'ecommanufacturers' => $manufs, 'interval' => $interval));
     }
     return $this->display(__FILE__, 'ecomblockmanufacturer.tpl', $this->getCacheId());
 }
 public function __construct()
 {
     // need to set this in constructor to allow translation
     TSBuyerProtection::$payments_type = array('DIRECT_DEBIT' => $this->l('Direct debit'), 'CREDIT_CARD' => $this->l('Credit Card'), 'INVOICE' => $this->l('Invoice'), 'CASH_ON_DELIVERY' => $this->l('Cash on delivery'), 'PREPAYMENT' => $this->l('Prepayment'), 'CHEQUE' => $this->l('Cheque'), 'PAYBOX' => $this->l('Paybox'), 'PAYPAL' => $this->l('PayPal'), 'CASH_ON_PICKUP' => $this->l('Cash on pickup'), 'FINANCING' => $this->l('Financing'), 'LEASING' => $this->l('Leasing'), 'T_PAY' => $this->l('T-Pay'), 'CLICKANDBUY' => $this->l('Click&Buy'), 'GIROPAY' => $this->l('Giropay'), 'GOOGLE_CHECKOUT' => $this->l('Google Checkout'), 'SHOP_CARD' => $this->l('Online shop payment card'), 'DIRECT_E_BANKING' => $this->l('DIRECTebanking.com'), 'MONEYBOOKERS' => $this->l('moneybookers.com'), 'OTHER' => $this->l('Other method of payment'));
     $this->tab_name = $this->l('Trusted Shops quality seal and buyer protection');
     $this->site_url = Tools::htmlentitiesutf8('http://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     TSBPException::setTranslationObject($this);
     if (!method_exists('Tools', 'jsonDecode') || !method_exists('Tools', 'jsonEncode')) {
         $this->warnings[] = $this->l('Json functions must be implemented in your php version');
     } else {
         foreach ($this->available_languages as $iso => $lang) {
             if ($lang === '') {
                 $this->available_languages[$iso] = Language::getLanguage(Language::getIdByIso($iso));
             }
             TSBuyerProtection::$CERTIFICATE[strtoupper($iso)] = (array) Tools::jsonDecode(Tools::htmlentitiesDecodeUTF8(Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'CERTIFICATE_' . strtoupper($iso))));
         }
         if (TSBuyerProtection::$SHOPSW === NULL) {
             TSBuyerProtection::$SHOPSW = Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'SHOPSW');
             TSBuyerProtection::$ET_CID = Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'ET_CID');
             TSBuyerProtection::$ET_LID = Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'ET_LID');
             TSBuyerProtection::$DEFAULT_LANG = (int) Configuration::get('PS_LANG_DEFAULT');
             TSBuyerProtection::$CAT_ID = (int) Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'CAT_ID');
             TSBuyerProtection::$ENV_API = Configuration::get(TSBuyerProtection::PREFIX_TABLE . 'ENV_API');
         }
     }
 }
Example #22
0
    protected function displayForm()
    {
        $languages = Language::getLanguages(false);
        $default_language = Configuration::get('PS_LANG_DEFAULT');
        $div_id_language = 'block_1_language¤block_2_language¤block_3_language¤block_4_language¤block_5_language';
        $data = $this->getAllReinsurances();
        $reinssuarances = array();
        foreach ($data as $row) {
            $reinssuarances[$row['id_reinsurance']][$row['id_lang']] = $row;
        }
        $this->_html .= '
		<script type="text/javascript">id_language = Number(' . $default_language . ');</script>
		<form method="POST" action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" enctype="multipart/form-data">
			<fieldset class="width2">
				<legend>' . $this->l('Block configuration') . '</legend>
		';
        for ($i = 1; $i != 6; $i++) {
            $this->_html .= '
					<h3>Block ' . $i . '</h3>
			';
            if ($i == 1) {
                $this->_html .= '<p style="color: red;">' . $this->l('This block is required') . '</p>';
            }
            if (isset($reinssuarances[$i][$default_language]) && $reinssuarances[$i][$default_language]['filename'] != null) {
                $this->_html .= '<div class="margin-form">
					<img src="' . $this->_path . '/img/' . $reinssuarances[$i][$default_language]['filename'] . '" alt="' . $reinssuarances[$i][$default_language]['text'] . '" />
				</div>';
            }
            $this->_html .= '
					<label>' . $this->l('Image:') . '</label>
					<div class="margin-form">
						<input type="file" name="images[' . $i . ']" />
					</div>
			';
            foreach ($languages as $lang) {
                $this->_html .= '
					<div id="block_' . $i . '_language_' . $lang['id_lang'] . '" style="display: ' . ($lang['id_lang'] == $default_language ? 'block' : 'none') . '; float:left;">
						<label>' . $this->l('Text:') . '</label>
						<input type="text" name="texts[' . $i . '][' . $lang['id_lang'] . ']" value="' . (isset($reinssuarances[$i][$lang['id_lang']]) && $reinssuarances[$i][$lang['id_lang']]['text'] ? Tools::htmlentitiesUTF8($reinssuarances[$i][$lang['id_lang']]['text']) : 'default') . '" />
					</div>
				';
            }
            $this->_html .= $this->displayFlags($languages, $default_language, $div_id_language, 'block_' . $i . '_language', true);
            $this->_html .= '
			<div class="clear"></div>
			';
            if ($i != 5) {
                $this->_html .= '<hr />';
            }
        }
        $this->_html .= '
				<p class="center">
					<input type="submit" class="button" name="submitBlock" value="' . $this->l('Save') . '" />
				</p>
			</fieldset>
		</form>
		';
        return $this->_html;
    }
Example #23
0
 public function __construct()
 {
     // Basic vars
     global $currentIndex;
     $this->current_index = $currentIndex;
     $this->token = Tools::getValue('token');
     $this->name = 'twenga';
     $this->tab = 'smart_shopping';
     $this->version = '1.8';
     parent::__construct();
     $this->displayName = $this->l('Twenga API');
     $this->description = $this->l('Module role: export of your products on Twenga and installation of the sales tracking brought by Twenga (requires sign up to Twenga)');
     // For Twenga subscription
     $protocol = 'http://';
     if (isset($_SERVER['https']) && $_SERVER['https'] != 'off') {
         $protocol = 'https://';
     }
     $this->site_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     self::$base_dir = _PS_ROOT_DIR_ . '/modules/twenga/';
     self::$base_path = $this->site_url . '/modules/twenga/';
     $this->feed_url = self::$base_path . 'export.php?twenga_token=' . sha1(Configuration::get('TWENGA_TOKEN') . _COOKIE_KEY_);
     self::$shop_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
     require_once realpath(self::$base_dir . '/lib/PrestashopStats.php');
     require_once realpath(self::$base_dir . '/lib/TwengaObj.php');
     // set the base dir to load files needed for the TwengaObj class
     TwengaObj::$base_dir = self::$base_dir . '/lib';
     TwengaObj::setTranslationObject($this);
     TwengaException::setTranslationObject($this);
     if (!in_array(strtolower(self::$shop_country), $this->limited_countries)) {
         $this->_allowToWork = false;
         $this->warning = $this->l('Twenga module works only in specific countries (iso code list:') . ' ' . implode(', ', $this->limited_countries) . ').';
         return false;
     }
     // instanciate (just once) the TwengaObj and PrestashopStats
     if (self::$obj_twenga === NULL) {
         self::$obj_twenga = new TwengaObj();
     }
     if (self::$obj_ps_stats === NULL) {
         self::$obj_ps_stats = new PrestashopStats($this->site_url);
     }
     $this->_initCurrentIsoCodeCountry();
 }
Example #24
0
 public function getConfigFieldsValues($obj)
 {
     $languages = Language::getLanguages(false);
     $fields_values = array();
     $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $this->image_base_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'themes/' . $this->theme_name . '/img/modules/leobootstrapmenu/icons/';
     //		$a = array();
     foreach ($this->fields_form as $k => $f) {
         foreach ($f['form']['input'] as $j => $input) {
             if (isset($obj->{trim($input['name'])})) {
                 $data = $obj->{trim($input['name'])};
                 if ($input['name'] == 'image' && $data) {
                     $thumb = $this->image_base_url . $data;
                     $this->fields_form[$k]['form']['input'][$j]['thumb'] = $thumb;
                 }
                 if (isset($input['lang'])) {
                     foreach ($languages as $lang) {
                         # validate module
                         $fields_values[$input['name']][$lang['id_lang']] = isset($data[$lang['id_lang']]) ? $data[$lang['id_lang']] : $input['default'];
                     }
                 } else {
                     # validate module
                     $fields_values[$input['name']] = isset($data) ? $data : $input['default'];
                 }
             } else {
                 if (isset($input['lang'])) {
                     foreach ($languages as $lang) {
                         $v = Tools::getValue('title', Configuration::get($input['name'], $lang['id_lang']));
                         $fields_values[$input['name']][$lang['id_lang']] = $v ? $v : $input['default'];
                     }
                 } else {
                     $v = Tools::getValue($input['name'], Configuration::get($input['name']));
                     $fields_values[$input['name']] = $v ? $v : $input['default'];
                 }
                 if ($input['name'] == $obj->type . '_type') {
                     # validate module
                     $fields_values[$input['name']] = $obj->item;
                 }
             }
         }
     }
     return $fields_values;
 }
    public function postProcess()
    {
        if ($id_customer_thread = (int) Tools::getValue('id_customer_thread')) {
            if ($id_contact = (int) Tools::getValue('id_contact')) {
                Db::getInstance()->execute('
					UPDATE ' . _DB_PREFIX_ . 'customer_thread
					SET id_contact = ' . (int) $id_contact . '
					WHERE id_customer_thread = ' . (int) $id_customer_thread);
            }
            if ($id_status = (int) Tools::getValue('setstatus')) {
                $status_array = array(1 => 'open', 2 => 'closed', 3 => 'pending1', 4 => 'pending2');
                Db::getInstance()->execute('
					UPDATE ' . _DB_PREFIX_ . 'customer_thread
					SET status = "' . $status_array[$id_status] . '"
					WHERE id_customer_thread = ' . (int) $id_customer_thread . ' LIMIT 1
				');
            }
            if (isset($_POST['id_employee_forward'])) {
                $messages = Db::getInstance()->executeS('
					SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name,
						CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
					FROM ' . _DB_PREFIX_ . 'customer_thread ct
					LEFT JOIN ' . _DB_PREFIX_ . 'customer_message cm
						ON (ct.id_customer_thread = cm.id_customer_thread)
					LEFT JOIN ' . _DB_PREFIX_ . 'contact_lang cl
						ON (cl.id_contact = ct.id_contact AND cl.id_lang = ' . (int) $this->context->language->id . ')
					LEFT OUTER JOIN ' . _DB_PREFIX_ . 'employee e
						ON e.id_employee = cm.id_employee
					LEFT OUTER JOIN ' . _DB_PREFIX_ . 'customer c
						ON (c.email = ct.email)
					WHERE ct.id_customer_thread = ' . (int) Tools::getValue('id_customer_thread') . '
					ORDER BY cm.date_add DESC
				');
                $output = '';
                foreach ($messages as $message) {
                    $output .= $this->displayMessage($message, true, (int) Tools::getValue('id_employee_forward'));
                }
                $cm = new CustomerMessage();
                $cm->id_employee = (int) $this->context->employee->id;
                $cm->id_customer_thread = (int) Tools::getValue('id_customer_thread');
                $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
                $current_employee = $this->context->employee;
                $id_employee = (int) Tools::getValue('id_employee_forward');
                $employee = new Employee($id_employee);
                $email = Tools::getValue('email');
                if ($id_employee && $employee && Validate::isLoadedObject($employee)) {
                    $params = array('{messages}' => Tools::nl2br(stripslashes($output)), '{employee}' => $current_employee->firstname . ' ' . $current_employee->lastname, '{comment}' => stripslashes($_POST['message_forward']));
                    if (Mail::Send($this->context->language->id, 'forward_msg', Mail::l('Fwd: Customer message', $this->context->language->id), $params, $employee->email, $employee->firstname . ' ' . $employee->lastname, $current_employee->email, $current_employee->firstname . ' ' . $current_employee->lastname, null, null, _PS_MAIL_DIR_, true)) {
                        $cm->private = 1;
                        $cm->message = $this->l('Message forwarded to') . ' ' . $employee->firstname . ' ' . $employee->lastname . "\n" . $this->l('Comment:') . ' ' . $_POST['message_forward'];
                        $cm->add();
                    }
                } elseif ($email && Validate::isEmail($email)) {
                    $params = array('{messages}' => Tools::nl2br(stripslashes($output)), '{employee}' => $current_employee->firstname . ' ' . $current_employee->lastname, '{comment}' => stripslashes($_POST['message_forward']));
                    if (Mail::Send($this->context->language->id, 'forward_msg', Mail::l('Fwd: Customer message', $this->context->language->id), $params, $email, null, $current_employee->email, $current_employee->firstname . ' ' . $current_employee->lastname, null, null, _PS_MAIL_DIR_, true)) {
                        $cm->message = $this->l('Message forwarded to') . ' ' . $email . "\n" . $this->l('Comment:') . ' ' . $_POST['message_forward'];
                        $cm->add();
                    }
                } else {
                    $this->errors[] = '<div class="alert error">' . Tools::displayError('The email address is invalid.') . '</div>';
                }
            }
            if (Tools::isSubmit('submitReply')) {
                $ct = new CustomerThread($id_customer_thread);
                ShopUrl::cacheMainDomainForShop((int) $ct->id_shop);
                $cm = new CustomerMessage();
                $cm->id_employee = (int) $this->context->employee->id;
                $cm->id_customer_thread = $ct->id;
                $cm->message = Tools::htmlentitiesutf8(Tools::getValue('reply_message'));
                $cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
                if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0) {
                    $this->errors[] = Tools::displayError('An error occurred during the file upload process.');
                } elseif ($cm->add()) {
                    $file_attachment = null;
                    if (!empty($_FILES['joinFile']['name'])) {
                        $file_attachment['content'] = file_get_contents($_FILES['joinFile']['tmp_name']);
                        $file_attachment['name'] = $_FILES['joinFile']['name'];
                        $file_attachment['mime'] = $_FILES['joinFile']['type'];
                    }
                    $params = array('{reply}' => Tools::nl2br(Tools::getValue('reply_message')), '{link}' => Tools::url($this->context->link->getPageLink('contact', true), 'id_customer_thread=' . (int) $ct->id . '&token=' . $ct->token));
                    //#ct == id_customer_thread    #tc == token of thread   <== used in the synchronization imap
                    $contact = new Contact((int) $ct->id_contact, (int) $ct->id_lang);
                    if (Validate::isLoadedObject($contact)) {
                        $from_name = $contact->name[(int) $ct->id_lang];
                        $from_email = $contact->email;
                    } else {
                        $from_name = null;
                        $from_email = null;
                    }
                    if (Mail::Send((int) $ct->id_lang, 'reply_msg', sprintf(Mail::l('An answer to your message is available #ct%1$s #tc%2$s', $ct->id_lang), $ct->id, $ct->token), $params, Tools::getValue('msg_email'), null, $from_email, $from_name, $file_attachment, null, _PS_MAIL_DIR_, true)) {
                        $ct->status = 'closed';
                        $ct->update();
                    }
                    Tools::redirectAdmin(self::$currentIndex . '&id_customer_thread=' . (int) $id_customer_thread . '&viewcustomer_thread&token=' . Tools::getValue('token'));
                } else {
                    $this->errors[] = Tools::displayError('An error occurred. Your message was not sent. Please contact your system administrator.');
                }
            }
        }
        return parent::postProcess();
    }
Example #26
0
 public function __construct()
 {
     // Basic vars
     global $currentIndex;
     $this->current_index = $currentIndex;
     $this->token = Tools::getValue('token');
     $this->name = 'twenga';
     $this->tab = 'smart_shopping';
     $this->version = '1.11';
     $this->author = 'PrestaShop';
     parent::__construct();
     $this->displayName = $this->l('Twenga Module');
     $this->description = $this->l('Export your products to Twenga Shopping Search Engine and get new online buyers immediately.');
     $this->ps_versions_compliancy = array('min' => '1.4', 'max' => _PS_VERSION_);
     // For Twenga subscription
     $protocol = 'http://';
     if (isset($_SERVER['https']) && $_SERVER['https'] != 'off') {
         $protocol = 'https://';
     }
     $this->site_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     self::$base_dir = _PS_ROOT_DIR_ . '/modules/twenga/';
     self::$base_path = $this->site_url . '/modules/twenga/';
     $this->feed_url = self::$base_path . 'export.php?twenga_token=' . sha1(Configuration::get('TWENGA_TOKEN') . _COOKIE_KEY_);
     self::$shop_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
     require_once realpath(self::$base_dir . '/lib/PrestashopStats.php');
     require_once realpath(self::$base_dir . '/lib/TwengaObj.php');
     // set the base dir to load files needed for the TwengaObj class
     TwengaObj::$base_dir = self::$base_dir . '/lib';
     TwengaObj::setTranslationObject($this);
     TwengaException::setTranslationObject($this);
     if (!in_array(strtolower(self::$shop_country), $this->limited_countries)) {
         $this->_allowToWork = false;
         $this->warning = $this->l('Twenga module works only in specific countries (iso code list:') . ' ' . implode(', ', $this->limited_countries) . ').';
         return false;
     }
     // instanciate (just once) the TwengaObj and PrestashopStats
     if (self::$obj_twenga === NULL) {
         self::$obj_twenga = new TwengaObj();
     }
     if (self::$obj_ps_stats === NULL) {
         self::$obj_ps_stats = new PrestashopStats($this->site_url);
     }
     $this->_initCurrentIsoCodeCountry();
     if (!extension_loaded('openssl')) {
         $this->warning = $this->l('OpenSSL should be activated on your PHP configuration to use all functionalities of Twenga.');
     }
 }
Example #27
0
    /**
     * show megamenu item configuration.
     */
    protected function showFormSetting()
    {
        $this->context->controller->addJS(__PS_BASE_URI__ . 'modules/psmegamenu/views/js/admin/jquery.nestable.js');
        $this->context->controller->addJS(__PS_BASE_URI__ . 'modules/psmegamenu/views/js/admin/form.js');
        $this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/plugins/jquery.cookie-plugin.js');
        $this->context->controller->addJS(__PS_BASE_URI__ . 'js/jquery/ui/jquery.ui.tabs.min.js');
        $this->context->controller->addCss(__PS_BASE_URI__ . 'js/jquery/ui/themes/base/jquery.ui.tabs.css');
        $this->context->controller->addCss(__PS_BASE_URI__ . 'modules/psmegamenu/views/css/admin/form.css');
        $this->widget->loadEngines();
        $id_lang = $this->context->language->id;
        $id_psmegamenu = (int) Tools::getValue('id_psmegamenu');
        $obj = new Psbtmegamenu($id_psmegamenu);
        $tree = $obj->getTree();
        $categories = PsMegamenuHelper::getCategories();
        $manufacturers = Manufacturer::getManufacturers(false, $id_lang, true);
        $suppliers = Supplier::getSuppliers(false, $id_lang, true);
        $cmss = CMS::listCms($this->context->language->id, false, true);
        $menus = $obj->getDropdown(null, $obj->id_parent);
        $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
        $soption = array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')));
        $image_url = '';
        if ($obj->image && is_file(_PSMEGAMENU_IMAGE_DIR_ . $obj->image)) {
            $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
            $image_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST']) . _PSMEGAMENU_IMAGE_URL_ . $obj->image;
        }
        $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Create New MegaMenu Item.')), 'input' => array(array('type' => 'hidden', 'label' => $this->l('Megamenu ID'), 'name' => 'id_psmegamenu', 'default' => 0), array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'value' => true, 'lang' => true, 'default' => ''), array('type' => 'text', 'label' => $this->l('Sub Title:'), 'lang' => true, 'name' => 'text', 'cols' => 40, 'rows' => 10, 'default' => ''), array('type' => 'select', 'label' => $this->l('Parent ID'), 'name' => 'id_parent', 'options' => array('query' => $menus, 'id' => 'id', 'name' => 'title'), 'default' => 'url'), array('type' => 'switch', 'label' => $this->l('Is Active'), 'name' => 'active', 'values' => $soption, 'default' => '1'), array('type' => 'switch', 'label' => $this->l('Show Title'), 'name' => 'show_title', 'values' => $soption, 'default' => '1'), array('type' => 'select', 'label' => $this->l('Menu Type'), 'name' => 'type', 'id' => 'menu_type', 'desc' => $this->l('Select a menu link type and fill data for following input'), 'options' => array('query' => array(array('id' => 'url', 'name' => $this->l('Url')), array('id' => 'category', 'name' => $this->l('Category')), array('id' => 'product', 'name' => $this->l('Product')), array('id' => 'manufacture', 'name' => $this->l('Manufacture')), array('id' => 'supplier', 'name' => $this->l('Supplier')), array('id' => 'cms', 'name' => $this->l('Cms')), array('id' => 'html', 'name' => $this->l('Html'))), 'id' => 'id', 'name' => 'name'), 'default' => 'url'), array('type' => 'text', 'label' => $this->l('Product ID'), 'name' => 'product_type', 'id' => 'product_type', 'class' => 'menu-type-group', 'default' => ''), array('type' => 'select', 'label' => $this->l('CMS Type'), 'name' => 'cms_type', 'id' => 'cms_type', 'options' => array('query' => $cmss, 'id' => 'id_cms', 'name' => 'meta_title'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'text', 'label' => $this->l('URL'), 'name' => 'url', 'id' => 'url_type', 'class' => 'menu-type-group', 'default' => ''), array('type' => 'select', 'label' => $this->l('Category Type'), 'name' => 'category_type', 'id' => 'category_type', 'options' => array('query' => $categories, 'id' => 'id_category', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'select', 'label' => $this->l('Manufacture Type'), 'name' => 'manufacture_type', 'id' => 'manufacture_type', 'options' => array('query' => $manufacturers, 'id' => 'id_manufacturer', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'select', 'label' => $this->l('Supplier Type'), 'name' => 'supplier_type', 'id' => 'supplier_type', 'options' => array('query' => $suppliers, 'id' => 'id_supplier', 'name' => 'name'), 'default' => '', 'class' => 'menu-type-group'), array('type' => 'textarea', 'label' => $this->l('HTML Type'), 'name' => 'content_text', 'lang' => true, 'default' => '', 'autoload_rte' => true, 'class' => 'menu-type-group-lang'), array('type' => 'select', 'label' => $this->l('Target Open'), 'name' => 'target', 'options' => array('query' => array(array('id' => '_self', 'name' => $this->l('Self')), array('id' => '_blank', 'name' => $this->l('Blank')), array('id' => '_parent', 'name' => $this->l('Parent')), array('id' => '_top', 'name' => $this->l('Top'))), 'id' => 'id', 'name' => 'name'), 'default' => '_self'), array('type' => 'text', 'label' => $this->l('Menu Class'), 'name' => 'menu_class', 'display_image' => true, 'default' => ''), array('type' => 'text', 'label' => $this->l('Menu Icon Class'), 'name' => 'icon_class', 'display_image' => true, 'default' => '', 'desc' => $this->l('The module integrated with FontAwesome') . '.' . $this->l('Check list of icons and class name in here') . ' <a href="http://fontawesome.io/" target="_blank">http://fontawesome.io/</a> or your icon class'), array('type' => 'file_pts', 'label' => $this->l('Or Menu Icon Image'), 'name' => 'image', 'display_image' => true, 'default' => '', 'image' => $image_url, 'delete_url' => $this->base_config_url . '&delete_icon=1', 'title' => $this->l('Icon Preview')), array('type' => 'select', 'label' => $this->l('Sub Menu Type'), 'name' => 'type_submenu', 'options' => array('query' => array(array('id' => 'menu', 'name' => $this->l('Menu')), array('id' => 'html', 'name' => $this->l('HTML'))), 'id' => 'id', 'name' => 'name'), 'default' => 'menu', 'desc' => $this->l('Submenu will be showed if select option Menu')), array('type' => 'textarea', 'label' => $this->l('Sub Menu Content:'), 'name' => 'submenu_content_text', 'value' => true, 'lang' => true, 'default' => '', 'autoload_rte' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button btn btn-danger'));
        $helper = new HelperForm();
        $helper->module = $this;
        $helper->name_controller = $this->name;
        $helper->identifier = $this->identifier;
        $helper->token = Tools::getAdminTokenLite('AdminModules');
        foreach (Language::getLanguages(false) as $lang) {
            $helper->languages[] = array('id_lang' => $lang['id_lang'], 'iso_code' => $lang['iso_code'], 'name' => $lang['name'], 'is_default' => $default_lang == $lang['id_lang'] ? 1 : 0);
        }
        $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
        $helper->default_form_language = $default_lang;
        $helper->allow_employee_form_lang = $default_lang;
        $helper->toolbar_scroll = true;
        $helper->title = $this->displayName;
        $helper->submit_action = 'save' . $this->name;
        $helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues($obj), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id);
        $liveeditor_url = AdminController::$currentIndex . '&configure=' . $this->name . '&liveeditor=1&token=' . Tools::getAdminTokenLite('AdminModules');
        $action = AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules');
        $helper->toolbar_btn = array('back' => array('href' => AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list')));
        $html = $this->_html . '<div class="col-lg-12"> <div class="alert alert-info clearfix">
			<div class="pull-right">Using <a href="' . $liveeditor_url . '" class="btn btn-danger"> 
			' . $this->l('Live Megamenu Editor') . '</a> ' . $this->l('To Make Rich Content For Megamenu') . '</div></div></div>';
        $output = $html . '
                 <ul class="nav nav-tabs clearfix" id="myTab">
                  <li class="active"><a href="#megamenu" data-toggle="tab">' . $this->l('Megamenu') . '</a></li>
                  <li><a href="#widgets" data-toggle="tab">' . $this->l('Widgets') . '</a></li>
                </ul>

 
            <div class="tab-content clearfix">
              <div class="tab-pane active" id="megamenu">
        ';
        $addnew = AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&configure=' . $this->name . '&tab_module=front_office_features&module_name=' . $this->name;
        $output .= '<div class="col-md-4"><div class="panel panel-default"><h3 class="panel-title">' . $this->l('Tree Megamenu Management') . '</h3>
					<div class="panel-content"><div class="alert alert-warning">' . $this->l('To sort orders or update parent-child, you drap and drop expected menu, 
						then click to Update button to Save') . '</div>
					<hr>
					<p>
                    <div class="pull-right">
                    <input type="button" value="' . $this->l('New Category') . '" id="addcategory" 
                    	data-loading-text="' . $this->l('Processing ...') . '" class="btn btn-default " name="addcategory">
                     <a href="' . $liveeditor_url . '" class="btn btn-danger"> ' . $this->l('Editor') . '</a> </div>
                    <input type="button" value="' . $this->l('Update Positions') . '" id="serialize" data-loading-text="' . $this->l('Processing ...') . '" 
                    	class="btn btn-primary" name="serialize"></p><hr>' . $tree . '<p><input type="button" value="' . $this->l('Update Positions') . '" 
                    	id="serialize-tree" data-loading-text="' . $this->l('Processing ...') . '" 
                    	class="btn btn-primary" name="serialize"></p></div></div></div>
                    <div class="col-md-8">' . $helper->generateForm($this->fields_form) . '</div>
                    <script type="text/javascript">var addnew ="' . $addnew . '"; var action="' . $action . '";
                    	$("#content").PavMegaMenuList({action:action,addnew:addnew});</script>';
        $output .= '</div>';
        $output .= '<div class="tab-pane" id="widgets">
                <div>
                    <p><a href="' . AdminController::$currentIndex . '&
                    configure=' . $this->name . '&widgets=1&token=' . Tools::getAdminTokenLite('AdminModules') . '" 
                    	class="btn btn-info pts-modal-action btn btn-modeal btn-success btn-action">' . $this->l('Create Widget') . '</a></p>
                </div>' . $this->widgetsList() . '</div>';
        $output .= '</div><script>$(\'#myTab a[href="#profile"]\').tab(\'show\')</script>';
        return $output;
    }
Example #28
0
    public function getContent()
    {
        $str = $this->preProcess();
        $flexwin_colors = array('sand', 'grey', 'blue');
        $logo_colors = array('yellow', 'grey', 'blue', 'black', 'purple', 'green');
        $str .= '<h2>' . $this->displayName . '</h2>' . $this->_displayPresentation() . '<br />
		<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset class="width2">
				<legend><img src="../img/admin/contact.gif" />' . $this->l('Settings') . '</legend>
				<label>' . $this->l('Logo color') . '<br /><br />
				<img src="' . self::$site_url . 'modules/dibs/logos/dibs_' . self::$MORE_SETTINGS['logo_color'] . '.jpg" />
				</label>
				<div class="margin-form">';
        foreach ($logo_colors as $logo_color) {
            $str .= '<input type="radio" name="logo_color" ' . (self::$MORE_SETTINGS['logo_color'] === $logo_color ? 'checked ' : '') . 'value="' . Tools::safeOutput($logo_color) . '" /> ' . Tools::safeOutput($logo_color) . '<br />';
        }
        $str .= '	<p>' . $this->l('The basic color of the logo which appears on the payment page.') . '</p>
				</div>
				<label>' . $this->l('Merchant ID') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" size="20" name="idMerchant" value="' . Tools::safeOutput(self::$ID_MERCHANT) . '" />
					<p>' . $this->l('See the e-mail sent by DIBS.') . '</p>
				</div>
				<label>' . $this->l('Secure Key #1') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" size="20" name="k1" value="' . Tools::htmlentitiesUTF8(self::$MORE_SETTINGS['k1']) . '" />
				</div>
				<label>' . $this->l('Secure Key #2') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" size="20" name="k2" value="' . Tools::htmlentitiesUTF8(self::$MORE_SETTINGS['k2']) . '" />
					<p>' . $this->l('These keys are used for security improvement.') . '<br />' . $this->l('To obtain these keys, go to the DIBS administration interface and under \'Integration\', select the MD5 Keys menu. Please ensure the MD5 control is activated, otherwise the module will not work.') . '</p>
				</div>
				<label>' . $this->l('Use DIBS test module') . '</label>
				<div class="margin-form">
					<input type="checkbox" name="testing" ' . (self::$TESTING === 1 ? 'checked ' : '') . 'value="testing" />
					<p>' . $this->l('When this field is declared, the transaction is not dispatched to the card issuer, but is instead handled by the DIBS test module.') . $this->l('See also Step 5 of the 10 Step Guide for more information.') . ' <a href="http://tech.dibs.dk/10_step_guide/your_own_test/" title="' . $this->l('See also Step 5 of the 10 Step Guide for more information.') . '" target="_blank">> ' . $this->l('Link') . '</a><br />' . $this->l('During the initial integration with DIBS, there is no need to insert this parameter, since all default transactions will reach the DIBS test system until DIBS has approved integration. Should the test system be used at a later date, this will be activated at DIBS (contact DIBS support for reactivating the test mode of your shop).') . '</p>
				</div>
				<label>' . $this->l('Flexwin color') . '</label>
				<div class="margin-form">';
        foreach ($flexwin_colors as $flexwin_color) {
            $str .= '<input type="radio" name="flexwin_color" ' . (self::$MORE_SETTINGS['flexwin_color'] === $flexwin_color ? 'checked ' : '') . 'value="' . $flexwin_color . '" /> ' . $flexwin_color . '<br />';
        }
        $str .= '	<p>' . $this->l('The basic color theme of FlexWin.') . '</p>
				</div>
				<label>' . $this->l('Accepted url') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" size="20" name="acceptedUrl" value="' . Tools::safeOutput(self::$ACCEPTED_URL) . '" />
					<p>' . $this->l('URL of the page to be displayed if the purchase is approved.') . '</p>
				</div>
				<label>' . $this->l('Cancelled url') . ' <sup>*</sup></label>
				<div class="margin-form">
					<input type="text" size="20" name="cancelledUrl" value="' . Tools::safeOutput(self::$CANCELLED_URL) . '" />
					<p>' . $this->l('URL of the page to be displayed if the customer cancels the payment.') . '</p>
				</div>
				<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
			</fieldset>
		</form>';
        return $str;
    }
Example #29
0
    public function getFrontTree($parent = 1, $edit = false, $params = array(), $typesub = '')
    {
        $this->parserMegaConfig($params);
        if ($edit) {
            $this->edit_string = ' data-id="%s" data-group="%s"  data-cols="%s" ';
        } else {
            $this->is_live_edit = false;
            $this->model_menu_widget = new LeoTempcpWidget();
            $this->model_menu_widget->setTheme(Context::getContext()->shop->getTheme());
            $this->model_menu_widget->langID = Context::getContext()->language->id;
            $this->model_menu_widget->loadWidgets(Context::getContext()->shop->id);
            $this->model_menu_widget->loadEngines();
        }
        $this->edit_string_col = ' data-colwidth="%s" data-class="%s" ';
        $childs = $this->getChild(null, null, null, true);
        foreach ($childs as $child) {
            $child['megaconfig'] = $this->hasMegaMenuConfig($child);
            $child['megamenu_id'] = $child['id_sbmegamenu'];
            if (isset($child['megaconfig']->group)) {
                $child['is_group'] = $child['megaconfig']->group;
            }
            if (isset($child['megaconfig']->submenu) && $child['megaconfig']->submenu == 0) {
                $child['menu_class'] = $child['menu_class'];
            }
            $this->children[$child['id_parent']][] = $child;
        }
        $parent = 1;
        $theme_name = Context::getContext()->shop->getTheme();
        $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
        $this->image_base_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__) . 'themes/' . $theme_name . '/img/modules/leomenusidebar/icons/';
        $this->shop_url = $this->image_base_url;
        $output = '';
        if ($this->hasChild($parent)) {
            $data = $this->getNodes($parent);
            //			$page_name = Dispatcher::getInstance()->getController();
            //			$true = false;
            $output = '<ul class="nav navbar-nav megamenu ' . $typesub . '">';
            foreach ($data as $menu) {
                if ($menu['type'] == 'html') {
                    $output .= '<li class="' . $menu['menu_class'] . '" ' . $this->renderAttrs($menu) . '>
					<a href="' . $this->getLink($menu) . '" target="' . $menu['target'] . '" class="has-category has-subhtml">';
                    if ($menu['icon_class']) {
                        $output .= '<span class="hasicon menu-icon-class"><span class="' . $menu['icon_class'] . '"></span>';
                    } elseif ($menu['image']) {
                        $output .= '<span class="hasicon menu-icon" style="background:url(\'' . $this->image_base_url . $menu['image'] . '\') no-repeat;">';
                    }
                    if ($menu['show_title'] == 1) {
                        $output .= '<span class="menu-title">' . $menu['title'] . '</span>';
                    }
                    if ($menu['text']) {
                        $output .= '<span class="sub-title">' . $menu['text'] . '</span>';
                    }
                    if ($menu['description']) {
                        $output .= '<span class="menu-desc">' . $menu['description'] . '</span>';
                    }
                    if ($menu['image'] || $menu['icon_class']) {
                        $output .= '</span>';
                    }
                    $output .= '</a>';
                    if ($menu['content_text']) {
                        $output .= '<div class="menu-content">' . html_entity_decode($menu['content_text'], ENT_QUOTES, 'UTF-8') . '</div>';
                    }
                    $output .= '</li>';
                } else {
                    if ($this->hasChild($menu['megamenu_id'])) {
                        $output .= '<li class="parent dropdown ' . $menu['menu_class'] . '" ' . $this->renderAttrs($menu) . '>';
                        $output .= '<a class="dropdown-toggle has-category" data-toggle="dropdown" href="' . $this->getLink($menu) . '" target="' . $menu['target'] . '">';
                        if ($menu['icon_class']) {
                            $output .= '<span class="hasicon menu-icon-class"><span class="' . $menu['icon_class'] . '"></span>';
                        } elseif ($menu['image']) {
                            $output .= '<span class="hasicon menu-icon" style="background:url(\'' . $this->image_base_url . $menu['image'] . '\') no-repeat;">';
                        }
                        if ($menu['show_title'] == 1) {
                            $output .= '<span class="menu-title">' . $menu['title'] . '</span>';
                        }
                        if ($menu['text']) {
                            $output .= '<span class="sub-title">' . $menu['text'] . '</span>';
                        }
                        if ($menu['description']) {
                            $output .= '<span class="menu-desc">' . $menu['description'] . '</span>';
                        }
                        if ($menu['image'] || $menu['icon_class']) {
                            $output .= '</span>';
                        }
                        $output .= '</a><b class="caret"></b>';
                        $output .= $this->genFrontTree($menu['megamenu_id'], 1, $menu, $typesub);
                        $output .= '</li>';
                    } else {
                        if (!$this->hasChild($menu['megamenu_id']) && isset($menu['megaconfig']) && $menu['megaconfig'] && isset($menu['megaconfig']->rows) && $menu['megaconfig']->rows) {
                            $output .= $this->genMegaMenuByConfig($menu['megamenu_id'], 1, $menu, true, $typesub);
                        } else {
                            $output .= '<li class="' . $menu['menu_class'] . '" ' . $this->renderAttrs($menu) . '>
						<a href="' . $this->getLink($menu) . '" target="' . $menu['target'] . '" class="has-category">';
                            if ($menu['icon_class']) {
                                $output .= '<span class="hasicon menu-icon-class"><span class="' . $menu['icon_class'] . '"></span>';
                            } elseif ($menu['image']) {
                                $output .= '<span class="hasicon menu-icon" style="background:url(\'' . $this->image_base_url . $menu['image'] . '\') no-repeat;">';
                            }
                            if ($menu['show_title'] == 1) {
                                $output .= '<span class="menu-title">' . $menu['title'] . '</span>';
                            }
                            if ($menu['text']) {
                                $output .= '<span class="sub-title">' . $menu['text'] . '</span>';
                            }
                            if ($menu['description']) {
                                $output .= '<span class="menu-desc">' . $menu['description'] . '</span>';
                            }
                            if ($menu['image'] || $menu['icon_class']) {
                                $output .= '</span>';
                            }
                            $output .= '</a></li>';
                        }
                    }
                }
            }
            $output .= '</ul>';
        }
        $this->leo_module = null;
        return $output;
    }
    private function displayMsg($message, $email = false, $id_employee = null)
    {
        global $cookie, $currentIndex;
        $customersToken = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee);
        $contacts = Contact::getContacts($cookie->id_lang);
        if (!$email) {
            if (!empty($message['id_product']) and empty($message['id_employee'])) {
                $id_order_product = Db::getInstance()->getValue('
				SELECT o.id_order
				FROM ' . _DB_PREFIX_ . 'orders o
				LEFT JOIN ' . _DB_PREFIX_ . 'order_detail od ON o.id_order = od.id_order
				WHERE o.id_customer = ' . (int) $message['id_customer'] . '
				AND od.product_id = ' . (int) $message['id_product'] . '
				ORDER BY o.date_add DESC');
            }
            $output = '
			<fieldset style="' . (!empty($message['id_employee']) ? 'background: rgb(255,236,242);' : '') . 'width:600px;margin-top:10px">
				<legend ' . (empty($message['id_employee']) ? '' : 'style="background:rgb(255,210,225)"') . '>' . (!empty($message['employee_name']) ? '<img src="../img/t/AdminCustomers.gif" alt="' . Configuration::get('PS_SHOP_NAME') . '" /> ' . Configuration::get('PS_SHOP_NAME') . ' - ' . $message['employee_name'] : '<img src="' . __PS_BASE_URI__ . 'img/admin/tab-customers.gif" alt="' . Configuration::get('PS_SHOP_NAME') . '" /> ' . (!empty($message['id_customer']) ? '<a href="index.php?tab=AdminCustomers&id_customer=' . (int) $message['id_customer'] . '&viewcustomer&token=' . $customersToken . '" title="' . $this->l('View customer') . '">' . $message['customer_name'] . '</a>' : $message['email'])) . '</legend>
				<div style="font-size:11px">' . ((!empty($message['id_customer']) and empty($message['id_employee'])) ? '<b>' . $this->l('Customer ID:') . '</b> <a href="index.php?tab=AdminCustomers&id_customer=' . (int) $message['id_customer'] . '&viewcustomer&token=' . $customersToken . '" title="' . $this->l('View customer') . '">' . (int) $message['id_customer'] . ' <img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . '
					<b>' . $this->l('Sent on:') . '</b> ' . Tools::displayDate($message['date_add'], (int) $cookie->id_lang, true) . '<br />' . (empty($message['id_employee']) ? '<b>' . $this->l('Browser:') . '</b> ' . strip_tags($message['user_agent']) . '<br />' : '') . ((!empty($message['file_name']) and file_exists(_PS_UPLOAD_DIR_ . $message['file_name'])) ? '<b>' . $this->l('File attachment') . '</b> <a href="index.php?tab=AdminCustomerThreads&id_customer_thread=' . $message['id_customer_thread'] . '&viewcustomer_thread&token=' . Tools::getAdminToken('AdminCustomerThreads' . (int) Tab::getIdFromClassName('AdminCustomerThreads') . (int) $cookie->id_employee) . '&filename=' . $message['file_name'] . '" title="' . $this->l('View file') . '"><img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . ((!empty($message['id_order']) and empty($message['id_employee'])) ? '<b>' . $this->l('Order #') . '</b> <a href="index.php?tab=AdminOrders&id_order=' . (int) $message['id_order'] . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee) . '" title="' . $this->l('View order') . '">' . (int) $message['id_order'] . ' <img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . ((!empty($message['id_product']) and empty($message['id_employee'])) ? '<b>' . $this->l('Product #') . '</b> <a href="index.php?tab=AdminOrders&id_order=' . (int) $id_order_product . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee) . '" title="' . $this->l('View order') . '">' . (int) $message['id_product'] . ' <img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . '<br />
					<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
						<b>' . $this->l('Subject:') . '</b>
						<input type="hidden" name="id_customer_message" value="' . $message['id_customer_message'] . '" />
						<select name="id_contact" onchange="this.form.submit();">';
            foreach ($contacts as $contact) {
                $output .= '<option value="' . (int) $contact['id_contact'] . '" ' . ($contact['id_contact'] == $message['id_contact'] ? 'selected="selected"' : '') . '>' . Tools::htmlentitiesutf8($contact['name']) . '</option>';
            }
            $output .= '</select>
					</form>';
        } else {
            $output = '<div style="font-size:11px">
			' . ($id_employee ? '<a href="' . Tools::getHttpHost(true) . $currentIndex . '&token=' . Tools::getAdminToken('AdminCustomerThreads' . (int) Tab::getIdFromClassName('AdminCustomerThreads') . (int) $id_employee) . '&id_customer_thread=' . (int) $message['id_customer_thread'] . '&viewcustomer_thread">' . $this->l('View this thread') . '</a><br />' : '') . '
			<b>' . $this->l('Sent by:') . '</b> ' . (!empty($message['customer_name']) ? $message['customer_name'] . ' (' . $message['email'] . ')' : $message['email']) . ((!empty($message['id_customer']) and empty($message['employee_name'])) ? '<br /><b>' . $this->l('Customer ID:') . '</b> ' . (int) $message['id_customer'] . '<br />' : '') . ((!empty($message['id_order']) and empty($message['employee_name'])) ? '<br /><b>' . $this->l('Order #') . ':</b> ' . (int) $message['id_order'] . '<br />' : '') . ((!empty($message['id_product']) and empty($message['employee_name'])) ? '<br /><b>' . $this->l('Product #') . ':</b> ' . (int) $message['id_product'] . '<br />' : '') . '<br /><b>' . $this->l('Subject:') . '</b> ' . $message['subject'];
        }
        $message['message'] = preg_replace('/(https?:\\/\\/[a-z0-9#%&_=\\(\\)\\.\\? \\+\\-@\\/]{6,1000})([\\s\\n<])/Uui', '<a href="\\1">\\1</a>\\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
        $output .= '<br /><br />
			<b>' . $this->l('Thread ID:') . '</b> ' . (int) $message['id_customer_thread'] . '<br />
			<b>' . $this->l('Message ID:') . '</b> ' . (int) $message['id_customer_message'] . '<br />
			<b>' . $this->l('Message:') . '</b><br />
			' . $message['message'] . '
		</div>';
        if (!$email) {
            if (empty($message['employee_name'])) {
                $output .= '
				<p style="text-align:right">
					<button style="font-family: Verdana; font-size: 11px; font-weight:bold; height: 65px; width: 120px;" onclick="$(\'#reply_to_' . (int) $message['id_customer_message'] . '\').show(500); $(this).hide();">
						<img src="' . __PS_BASE_URI__ . 'img/admin/contact.gif" alt="" style="margin-bottom: 5px;" /><br />' . $this->l('Reply to this message') . '
					</button>
				</p>
				<div id="reply_to_' . (int) $message['id_customer_message'] . '" style="display: none; margin-top: 20px;"">
					<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post" enctype="multipart/form-data">
						<p>' . $this->l('Please type your reply below:') . '</p>
						<textarea style="width: 450px; height: 175px;" name="reply_message">' . str_replace('\\r\\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])) . '</textarea>
						<div style="width: 450px; text-align: right; font-style: italic; font-size: 9px; margin-top: 2px;">
							' . $this->l('Your reply will be sent to:') . ' ' . $message['email'] . '
						</div>
						<div style="width: 450px; margin-top: 0px;">
							<input type="file" name="joinFile"/>
						<div>
						<div style="width: 450px; text-align: center;">
							<input type="submit" class="button" name="submitReply" value="' . $this->l('Send my reply') . '" style="margin-top:20px;" />
							<input type="hidden" name="id_customer_thread" value="' . (int) $message['id_customer_thread'] . '" />
							<input type="hidden" name="msg_email" value="' . $message['email'] . '" />
						</div>					
					</form>
				</div>';
            }
            $output .= '
			</fieldset>';
        }
        return $output;
    }