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 = '

'.$this->displayName.'

'; $languages = Language::getLanguages(FALSE); $divLangName = 'left_link_0¤right_link_0¤new_window_0¤fixed_0¤img_0¤left_link_1¤right_link_1¤new_window_1¤fixed_1¤img_1¤left_link_2¤right_link_2¤new_window_2¤fixed_2¤img_2'; $defaultFormLanguage = (int) Configuration::get('PS_LANG_DEFAULT'); if (Tools::isSubmit('btnSubmit')) { Configuration::updateValue('SKINSTATIC_VERSION', (int) Configuration::get('SKINSTATIC_VERSION') + 1); foreach($languages as $language) { for($i=0; $i < 3; $i++) { if(isset($_FILES['img_'.(int) $i.'_'.(int) $language['id_lang']]) && $_FILES['img_'.(int) $i.'_'.(int) $language['id_lang']]['name'] != '') { if(!copy($_FILES['img_'.(int) $i.'_'.(int) $language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/themes/site/skinstatic_cache/skin_'.(int) $i.'_'.(int) $language['id_lang'].'.jpg')) { echo '

'.$this->l('An error occured during the image upload.').'

'; continue; } file_put_contents( _PS_ROOT_DIR_.'/themes/site/skinstatic_cache/columns_'.(int) $i.'_'.(int) $language['id_lang'].'.html', str_replace( array('{left_link}', '{right_link}', '{version}'), array( Tools::getValue('left_link_'.(int) $i.'_'.(int) $language['id_lang']), Tools::getValue('right_link_'.(int) $i.'_'.(int) $language['id_lang']), Configuration::get('SKINSTATIC_VERSION'), ), ''.(Tools::getValue('fixed_'.(int) $i.'_'.(int) $language['id_lang'])? ' ': '').' ')); } } } $this->_html .= '

'.$this->l('Links updated successfully.').'



'; } $this->_html .= '
'.$this->l('Links (logged out)').'
'; foreach($languages as $language) { $this->_html .= ''; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'left_link_0', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= ''; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'right_link_0', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= '
'; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'new_window_0', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= '
'; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'fixed_0', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= '
'; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'img_0', TRUE); $this->_html .= '

'.$this->l('Links (logged in)').'

'; foreach($languages as $language) { $this->_html .= ''; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'left_link_1', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= ''; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'right_link_1', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= '
'; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'new_window_1', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= '
'; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'fixed_1', TRUE); $this->_html .= '
'; foreach($languages as $language) { $this->_html .= '
'; } $this->_html .= $this->displayFlags($languages, $defaultFormLanguage, $divLangName, 'img_1', TRUE); $this->_html .= '


'; return $this->_html; } }