* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6594 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_CAN_LOAD_FILES_'))
exit;
class LiveZilla extends Module
{
public function __construct()
{
$this->name = 'livezilla';
$this->tab = 'front_office_features';
$this->version = 1.0;
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct();
$this->displayName = 'LiveZilla';
$this->description = $this->l('Live support chat');
}
public function install()
{
if (!Configuration::get('LIVEZILLA_URL'))
Configuration::updateValue('LIVEZILLA_URL', Tools::htmlentitiesUTF8($_SERVER['HTTP_HOST']).'/LiveZilla/');
return (parent::install() AND $this->registerHook('rightColumn'));
}
public function getContent()
{
if (Tools::isSubmit('submitLiveZilla'))
{
Configuration::updateValue('LIVEZILLA_URL', Tools::getValue('LIVEZILLA_URL_TYPE').Tools::getValue('LIVEZILLA_URL'));
Configuration::updateValue('LIVEZILLA_SCRIPT', Tools::getValue('LIVEZILLA_SCRIPT'), true);
echo $this->displayConfirmation($this->l('Settings updated'));
}
$html = '
'.$this->displayName.'
';
return $html;
}
private function displayBlock()
{
global $smarty;
if ($livezilla_script = Configuration::get('LIVEZILLA_SCRIPT'))
$smarty->assign('LIVEZILLA_SCRIPT', $livezilla_script);
elseif ($livezilla_url = Configuration::get('LIVEZILLA_URL'))
$smarty->assign('LIVEZILLA_URL', $livezilla_url);
else
$smarty->assign('LIVEZILLA_UNDEFINED', 1);
return $this->display(__FILE__, 'livezilla.tpl');
}
public function hookLeftColumn($params)
{
return $this->displayBlock();
}
public function hookRightColumn($params)
{
return $this->displayBlock();
}
}