bebeboutik/modules/skinstatic_old/skinstatic.php
Srv Bebeboutik 6c0978166c add modules
2016-01-04 12:49:26 +01:00

63 lines
2.9 KiB
PHP

<?php
if (!defined('_PS_VERSION_'))
exit;
class SkinStatic extends Module {
public function __construct() {
$this->name = 'skinstatic';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Antadis';
parent::__construct();
$this->displayName = $this->l('Static skin items');
$this->description = $this->l('Allows to display static parts as a skin on the website.');
}
public function getContent() {
$this->_html = '<h2>'.$this->displayName.'</h2>';
if (Tools::isSubmit('btnSubmit')) {
Configuration::updateValue('SKINSTATIC_VERSION', (int) Configuration::get('SKINSTATIC_VERSION') + 1);
file_put_contents(_PS_ROOT_DIR_.'/themes/site/skinstatic_cache/columns.html', str_replace(array('{left_link}', '{right_link}', '{version}'), array(Tools::getValue('left_link'), Tools::getValue('right_link'), Configuration::get('SKINSTATIC_VERSION')), '<style type="text/css">body#index #columns { background: url("//www.bebeboutik.com/themes/site/img/columns.jpg?v={version}") no-repeat '.(Tools::getValue('fixed')? 'fixed center 0px': 'scroll center top').' #f3f3f3;}</style><a'.((int) Tools::getValue('new_window')? ' onclick="window.open(this.href); return false;"': '').' id="skin-left" href="{left_link}"></a><a'.((int) Tools::getValue('new_window')? ' onclick="window.open(this.href); return false;"': '').' id="skin-right" href="{right_link}"></a>'.(Tools::getValue('fixed')? '
<script type="text/javascript">
<!--
$(document).ready(function() { var scrolling = $("#skin-left, #skin-right"); var pos = scrolling.position(); var size = scrolling.height() + 80; var max_size = $(document).height() - $("#footer").height() - 45; $(window).scroll(function(event) { offset = parseFloat(scrolling.css("marginTop").replace("px", "")); scrolling.css({ "marginTop": Math.min($(document).scrollTop(), max_size) + "px" }); }); });
-->
</script>': '').'
'));
$this->_html .= '<p class="conf">'.$this->l('Links updated successfully.').'</p><br /><br />';
}
$this->_html .=
'<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">
<fieldset>
<legend><img src="../img/admin/prefs.gif" />'.$this->l('Links').'</legend>
<p class="margin-form">
<label>'.$this->l('Left link:').'</label>
<input type="text" value="" name="left_link" />
</p>
<p class="margin-form">
<label>'.$this->l('Right link:').'</label>
<input type="text" value="" name="right_link" />
</p>
<p class="margin-form">
<label>'.$this->l('Open link in new window').'</label>
<input type="checkbox" value="1" name="new_window" />
</p>
<p class="margin-form">
<label>'.$this->l('Fixed background').'</label>
<input type="checkbox" value="1" name="fixed" />
</p>
<p class="margin-form submit">
<input class="button" name="btnSubmit" value="'.$this->l('Update settings').'" type="submit" />
</p>
</fieldset>
</form>';
return $this->_html;
}
}