[*] BO #PSFV-94 : Added AdminPDFController
This commit is contained in:
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
|
||||
|
||||
class AdminPDF extends AdminPreferences
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
/* Collect all font files and build array for combo box */
|
||||
$fontFiles = scandir(_PS_FPDF_PATH_.'font');
|
||||
$fontList = array();
|
||||
$arr = array();
|
||||
|
||||
foreach ($fontFiles AS $file)
|
||||
if (substr($file, -4) == '.php' AND $file != 'index.php' AND substr($file, -6) != 'bi.php' AND substr($file, -5) != 'b.php' AND substr($file, -5) != 'i.php')
|
||||
{
|
||||
$arr['mode'] = substr($file, 0, -4);
|
||||
$arr['name'] = substr($file, 0, -4);
|
||||
array_push($fontList, $arr);
|
||||
}
|
||||
|
||||
/* Collect all encoding map files and build array for combo box */
|
||||
$encodingFiles = scandir(_PS_FPDF_PATH_.'font/makefont');
|
||||
$encodingList = array();
|
||||
$arr = array();
|
||||
foreach ($encodingFiles AS $file)
|
||||
if (substr($file, -4) == '.map')
|
||||
{
|
||||
$arr['mode'] = substr($file, 0, -4);
|
||||
$arr['name'] = substr($file, 0, -4);
|
||||
array_push($encodingList, $arr);
|
||||
}
|
||||
|
||||
$this->optionsList = array(
|
||||
'PDF' => array(
|
||||
'title' => $this->l('PDF settings for the current language:').' '.$this->context->language->name,
|
||||
'icon' => 'pdf',
|
||||
'class' => 'width2',
|
||||
'fields' => array(
|
||||
'PS_PDF_ENCODING' => array(
|
||||
'title' => $this->l('Encoding:'),
|
||||
'desc' => $this->l('Encoding for PDF invoice'),
|
||||
'type' => 'selectLang',
|
||||
'cast' => 'strval',
|
||||
'identifier' => 'mode',
|
||||
'list' => $encodingList),
|
||||
'PS_PDF_FONT' => array(
|
||||
'title' => $this->l('Font:'),
|
||||
'desc' => $this->l('Font for PDF invoice'),
|
||||
'type' => 'selectLang',
|
||||
'cast' => 'strval',
|
||||
'identifier' => 'mode',
|
||||
'list' => $fontList),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (isset($_POST['submitPDF'.$this->table]))
|
||||
{
|
||||
// @todo automatize selectLang post process
|
||||
$fieldLangPDF = array();
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($this->optionsList['PDF']['fields'] as $field => $fieldvalue)
|
||||
foreach ($languages as $lang)
|
||||
if (Tools::getValue($field.'_'.strtoupper($lang['iso_code'])))
|
||||
$this->optionsList['PDF']['fields'][$field.'_'.strtoupper($lang['iso_code'])] = array('type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => $fieldvalue['list']);
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
if (!Validate::isLoadedObject($this->context->language))
|
||||
die(Tools::displayError());
|
||||
$this->displayOptionsList();
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
*}
|
||||
{elseif $field['type'] == 'textLang' || $field['type'] == 'textareaLang'}
|
||||
{elseif $field['type'] == 'textLang' || $field['type'] == 'textareaLang' || $field['type'] == 'selectLang'}
|
||||
{if $field['type'] == 'textLang'}
|
||||
{foreach $field['languages'] AS $id_lang => $value}
|
||||
<div id="{$key}_{$id_lang}" style="margin-bottom:8px; display: {if $id_lang == $current_id_lang}block{else}none{/if}; float: left; vertical-align: top;">
|
||||
@@ -134,6 +134,19 @@
|
||||
<textarea rows="{$field['rows']}" cols="{$field['cols']|intval}" name="{$key}_{$id_lang}">{$value|replace:'\r\n':"\n"}</textarea>
|
||||
</div>
|
||||
{/foreach}
|
||||
{elseif $field['type'] == 'selectLang' }
|
||||
{foreach $languages as $language}
|
||||
<div id="{$key}_{$language.id_lang}" style="margin-bottom:8px; display: {if $language.id_lang == $current_id_lang}block{else}none{/if}; float: left; vertical-align: top;">
|
||||
<select name="{$key}_{$language.iso_code|upper}">
|
||||
{foreach $field['list'] AS $k => $v}
|
||||
<option value="{if isset($v.cast)}{$v.cast[$v[$field.identifier]]}{else}{$v[$field.identifier]}{/if}"
|
||||
{if $field['value'][$language.id_lang] == $v['name']} selected="selected"{/if}>
|
||||
{$v['name']}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
{if count($languages) > 1}
|
||||
<div class="displayed_flag">
|
||||
@@ -149,7 +162,7 @@
|
||||
class="pointer"
|
||||
alt="{$language.name}"
|
||||
title="{$language.name}"
|
||||
onclick="changeLanguage('{$key}', '{$key}', {$language.id_lang}, '{$language.iso_code}');" />
|
||||
onclick="changeLanguage('{$key}', '{if isset($custom_key)}{$custom_key}{else}{$key}{/if}', {$language.id_lang}, '{$language.iso_code}');" />
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user