continuing changement css

This commit is contained in:
Marion Muszynski 2016-12-29 15:29:23 +01:00
parent 795aca43a7
commit 13e343c6ff
8 changed files with 206 additions and 95 deletions

View File

@ -315,23 +315,23 @@ class HelperFormBootstrap{
}
public function inputSimpleDate($p = array()) {
if($p['period']) {
if(isset($p['period']) && $p['period']) {
$this->_html .='<div class="'.(isset($p['class-from'])?$p['class-from']:'').'">';
}
$this->_html .='
<div class="form-group">
'.(isset($p['label']) && $p['label'] ?'<label class="'.$p['label-class'].'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>':'').'
'.(isset($p['label']) && $p['label'] ?'<label class="'.(isset($p['label-class']) && $p['label-class'] ?$p['label-class']:'').'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>':'').'
<div class="input-group '.(isset($p['input-class'])?$p['input-class']:'').'">
'.(isset($p['before']) && $p['before'] ?'<div class="input-group-addon">'.$p['before'].'</div>':'').'
<input type="text" class="form-control" value="'.(isset($p['value'])?$p['value']:'').'" name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" placeholder="'.((isset($p['placeholder']) && $p['placeholder'])?$p['placeholder']:'').'">
'.(isset($p['after']) && $p['after'] ?'<div class="input-group-addon">'.$p['after'].'</div>':'').'
</div>
</div>';
if($p['period']) {
if(isset($p['period']) && $p['period']) {
$this->_html .='</div>
<div class="'.(isset($p['class-to'])?$p['class-to']:'').'">
<div class="form-group">
'.(isset($p['label-to']) && $p['label-to'] ?'<label class="'.$p['label-class'].'" for="'.(isset($p['id-to']) ? $p['id-to'] : $p['name-to']).'">'.$p['label-to'].'</label>':'').'
'.(isset($p['label-to']) && $p['label-to'] ?'<label class="'.(isset($p['label-class']) && $p['label-class'] ?$p['label-class']:'').'" for="'.(isset($p['id-to']) ? $p['id-to'] : $p['name-to']).'">'.$p['label-to'].'</label>':'').'
<div class="input-group '.(isset($p['input-to-class'])?$p['input-to-class']:'').'">
'.(isset($p['before-to']) && $p['before-to'] ?'<div class="input-group-addon">'.$p['before-to'].'</div>':'').'
<input type="text" class="form-control" value="'.(isset($p['value-to'])?$p['value-to']:'').'" name="'.$p['name-to'].'" id="'.(isset($p['id-to']) ? $p['id-to'] : $p['name-to']).'" placeholder="'.((isset($p['placeholder-to']) && $p['placeholder-to'])?$p['placeholder-to']:'').'">
@ -415,6 +415,9 @@ class HelperFormBootstrap{
}
public function inputUploadImage($p = array()) {
if(isset($p['lang']) && $p['lang']) {
return $this->inputUploadImageL($p);
}
$this->_html .='
<div class="form-group">
'.(isset($p['label'])?'<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label'].'</label>':'').'
@ -433,6 +436,44 @@ class HelperFormBootstrap{
</span>
</div>
</div>
'.(isset($p['help'])?'<p class="help-block">'.$p['help'].'</p>':'').'
</div>';
}
public function inputUploadImageL($p = array()) {
$defaultLanguage = (isset($p['default_language']) && $p['default_language'])? $p['default_language'] : 2;
$this->_html .='
<div class="form-group">
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">
<span class="pull-left">'.$p['label'].'</span>'
.$this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']).'
<div class="clearfix"></div>
</label>';
//$this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img'],'table');
//$this->_html .= '
foreach ($p['languages'] as $language) {
$this->_html .='
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'_'.$language['id_lang'].'">
<div class="input-group image-preview">
<input type="text" class="form-control image-preview-filename" disabled="disabled">
<span class="input-group-btn">
<button type="button" class="btn btn-default image-preview-clear" style="display:none;">
<span class="glyphicon glyphicon-remove"></span> Clear
</button>
<div class="btn btn-default image-preview-input">
<span class="glyphicon glyphicon-folder-open"></span>
<span class="image-preview-input-title">Ouvrir</span>
<input type="file" accept="image/png, image/jpeg" name="'.$p['name'].'_'.$language['id_lang'].'"/>
</div>
</span>
</div>';
if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
$this->_html .='<p><a href="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"><span class="anticon anticon-image"></span> Image '.$language['iso_code'].'</a></p>';
}
$this->_html .='</div>';
}
$this->_html .= '<div class="clearfix"></div>
'.((isset($p['help']) && $p['help']) ? '<span id="helpBlock" class="help-block">'.$p['help'].'</span>' : '').'
</div>';
}
@ -443,7 +484,7 @@ class HelperFormBootstrap{
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
<div class="checkbox input-switch">
<label>
<input type="checkbox" name="'.$p['name'].'" class="js-switch" '.(isset($p['checked']) && $p['checked']?'checked="checked"':'').' /> '.$p['title'].'
<input type="checkbox" name="'.$p['name'].'" class="js-switch" '.(isset($p['checked']) && $p['checked']?'checked="checked"':'').' /> '.(isset($p['title'])?$p['title']:'').'
</label>
</div>
</div>
@ -475,7 +516,11 @@ class HelperFormBootstrap{
$defaultLanguage = $p['default_language'] ? $p['default_language'] : 2;
$this->_html .= '
<div class="form-group">
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label'].' </label>
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">
<span class="pull-left">'.$p['label'].'</span>
'.$this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']).'
<div class="clearfix"></div>
</label>
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">';
foreach ($p['languages'] as $language) {
$default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value;
@ -484,7 +529,6 @@ class HelperFormBootstrap{
<input class="form-control" type="text" name="'.$p['name'].'_'.$language['id_lang'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'_'.$language['id_lang'].'" value="'.($this->_object ? $this->_object->{$p['name']}[(int)$language['id_lang']] : $default_lang).'" />
</div>';
}
$this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']);
$this->_html .= '<div class="clearfix"></div>
'.((isset($p['help']) && $p['help']) ? '<span id="helpBlock" class="help-block">'.$p['help'].'</span>' : '').'
</div>
@ -502,7 +546,11 @@ class HelperFormBootstrap{
$defaultLanguage = $p['default_language'] ? $p['default_language'] : 2;
$this->_html .= '
<div class="form-group">
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label'].' </label>
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">
<span class="pull-left">'.$p['label'].'</span>
'.$this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']).'
<div class="clearfix"></div>
</label>
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">';
foreach ($p['languages'] as $language) {
$default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value;
@ -511,7 +559,6 @@ class HelperFormBootstrap{
<textarea class="form-control" rows="3" name="'.$p['name'].'_'.$language['id_lang'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';'.(isset($p['css']) ? $p['css'].'"' : '').'">'.str_replace('\r\n', "\n", ($this->_object ? $this->_object->{$p['name']}[(int)$language['id_lang']] : $default_lang)).'</textarea>
</div>';
}
$this->_html .= $this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']);
$this->_html .= '<div class="clearfix"></div>
</div>
</div>';
@ -523,10 +570,10 @@ class HelperFormBootstrap{
<div class="form-group">
<label class="control-label ' . (isset($p['label-class']) && $p['label-class'] ? $p['label-class'] : '') . '">'.$p['label'].' </label>
<div class="' . (isset($p['input-class']) && $p['input-class'] ? $p['input-class'] : '') . '">
<label class="radio-inline" for="'.$key.'_on">
<label class="radio-inline" for="'.$p['name'].'_on">
<input type="radio" name="'.$p['name'].'" value="1" id="'.$p['name'].'_on"'.($checked ? ' checked="checked"' : '').' /> '.(isset($p['label_on']) && $p['label_on'] ?$p['label_on']:'').'
</label>
<label class="radio-inline" for="'.$key.'_off">
<label class="radio-inline" for="'.$p['name'].'_off">
<input type="radio" name="'.$p['name'].'" value="0" id="'.$p['name'].'_off"'.($checked ? '' : ' checked="checked"').'/> '. (isset($p['label_off']) && $p['label_off'] ?$p['label_off']:'').'
</label>
<div class="clearfix"></div>
@ -721,23 +768,23 @@ class HelperFormBootstrap{
</div>';
}
public function displayFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false, $link_flag_img = "../img/l/")
public function displayFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false, $link_flag_img = "../img/l/", $display ='block')
{
if (sizeof($languages) == 1)
return false;
$output = '
$output = '<div class="flags_custom">
<div class="displayed_flag">
<img src="'.$link_flag_img.$default_language.'.jpg" class="pointer" id="language_current_'.$id.'" onclick="toggleLanguageFlags(this);" alt="" />
</div>
<div id="languages_'.$id.'" class="language_flags">
<div id="languages_'.$id.'" class="language_flags language_flags_custom">
Choose language:<br />';
foreach ($languages as $language) {
if($use_vars_instead_of_ids)
$output .= '<img src="'.$link_flag_img.(int)($language['id_lang']).'.jpg" class="pointer" alt="'.$language['name'].'" title="'.$language['name'].'" onclick="changeLanguage(\''.$id.'\', '.$ids.', '.$language['id_lang'].', \''.$language['iso_code'].'\');" /> ';
$output .= '<img src="'.$link_flag_img.(int)($language['id_lang']).'.jpg" class="pointer" alt="'.$language['name'].'" title="'.$language['name'].'" onclick="changeLang(\''.$id.'\', '.$ids.', '.$language['id_lang'].', \''.$language['iso_code'].'\', \''.$display.'\');" /> ';
else
$output .= '<img src="'.$link_flag_img.(int)($language['id_lang']).'.jpg" class="pointer" alt="'.$language['name'].'" title="'.$language['name'].'" onclick="changeLanguage(\''.$id.'\', \''.$ids.'\', '.$language['id_lang'].', \''.$language['iso_code'].'\');" /> ';
$output .= '<img src="'.$link_flag_img.(int)($language['id_lang']).'.jpg" class="pointer" alt="'.$language['name'].'" title="'.$language['name'].'" onclick="changeLang(\''.$id.'\', \''.$ids.'\', '.$language['id_lang'].', \''.$language['iso_code'].'\', \''.$display.'\');" /> ';
}
$output .= '</div>';
$output .= '</div></div>';
if ($return)
return $output;

View File

@ -174,6 +174,17 @@ div.tagsinput span.tag a {
color: #fff;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice{
border: 1px solid #504d8b;
background: #796dc7;
color: #fff;
padding: 3px;
border-radius: 2px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
color: #fff;
}
#content .alert {
width: 100%;
margin: 0;
@ -193,8 +204,8 @@ div.tagsinput span.tag a {
border-color: #d6e9c6;
}
/* form */
.form-control {
/* form img */
.form-control.image-preview-filename {
height: 28px;
line-height: 28px;
}
@ -224,6 +235,8 @@ div.tagsinput span.tag a {
.image-preview-input-title {
margin-left:2px;
}
/* switch */
.checkbox.input-switch label, .radio.input-switch label {
padding-left: 0px;
width: auto;
@ -266,4 +279,17 @@ table.table tr th {
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #504d8b;
color: white;
}
/* Language choice box */
.flags_custom{
float: left;
position: relative;
}
.language_flags.language_flags_custom{
position: absolute;
z-index: 999;
margin: 0;
width: 120px;
right: 0;
}

View File

@ -1,4 +1,3 @@
$(document).on('click', '#close-preview', function(){
$('.image-preview').popover('hide');
$('.image-preview').hover(
@ -60,4 +59,17 @@ $(function() {
elems.forEach(function(html) {
var switchery = new Switchery(html, { size: 'small', color: '#504d8b' });
});
});
});
function changeLang(field, fieldsString, id_language_new, iso_code, display)
{
var fields = fieldsString.split('¤');
for (var i = 0; i < fields.length; ++i)
{
getE(fields[i] + '_' + id_language).style.display = 'none';
getE(fields[i] + '_' + id_language_new).style.display = display;
getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg';
}
getE('languages_' + field).style.display = 'none';
id_language = id_language_new;
}

View File

@ -176,12 +176,9 @@ function toggleLanguageFlags(elt)
// Kept for retrocompatibility only (out of AdminProducts & AdminCategories)
function changeLanguage(field, fieldsString, id_language_new, iso_code)
{
console.log(field);
console.log(fieldsString);
var fields = fieldsString.split('¤');
for (var i = 0; i < fields.length; ++i)
{
console.log(fields[i] + '_' + id_language);
getE(fields[i] + '_' + id_language).style.display = 'none';
getE(fields[i] + '_' + id_language_new).style.display = 'block';
getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg';

View File

@ -29,11 +29,13 @@ class AdminPrivateSalesSales extends AdminTab {
foreach(array_keys($this->imagelist) as $img) {
$images[] = 'img_'.$img;
}
$divLangName = 'description¤video¤'.implode('¤', $images);
$divLangName = 'description¤video';
$divLangImgName = implode('¤', $images);
$helperForm = new HelperFormBootstrap();
$helperForm->_select2 = true;
$helperForm->_inputMask = true;
$helperForm->_inputSwitch = true;
$helperForm->_js .='<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/privatesales/privatesale.js"></script>
<script type="text/javascript">
@ -238,8 +240,7 @@ class AdminPrivateSalesSales extends AdminTab {
);
if($this->cursale!==NULL && $this->cursale->id_category==$category['id_category']) {
$id_category_options[(int)$category['id_category']]['selected'] = true;
}
if(in_array($category['id_category'], $used_categories)){
}elseif(in_array($category['id_category'], $used_categories)){
$id_category_options[(int)$category['id_category']]['disabled'] = true;
}
}
@ -251,7 +252,7 @@ class AdminPrivateSalesSales extends AdminTab {
$(document).ready(function() {
$(\'#id_category\').change(function(){
$(\'#title input\').attr(\'value\', categories_ordered[$(this).attr(\'value\')].name);
$(\'#alias input\').attr(\'value\', categories_ordered[$(this).attr(\'value\')].link_rewrite);"
$(\'#alias input\').attr(\'value\', categories_ordered[$(this).attr(\'value\')].link_rewrite);
});
$("#date_start").inputmask("9999-99-99 99:99:99");
@ -334,14 +335,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Status
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'enabled',
'label' => $this->l('Status:'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label' => $this->l('Active :'),
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->enabled==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->enabled==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -349,14 +351,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Display
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'logout',
'label' => $this->l('Display:'),
'label_on' => '<span class="anticon anticon-user-check text-green-light"></span>',
'label_off' => '<span class="anticon anticon-user-minus text-rose"></span>',
'label' => $this->l('Affichage non inscrits :'),
// 'label_on' => '<span class="anticon anticon-user-check text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-user-minus text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->logout==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->logout==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -364,14 +367,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Public
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'pub',
'label' => $this->l('Public sale:'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->pub==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->pub==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -379,14 +383,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Braderie
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'braderie',
'label' => $this->l('Braderie :'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->braderie==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->braderie==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -394,14 +399,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Featured
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'featured',
'label' => $this->l('Featured sale:'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->featured==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->featured==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -409,14 +415,15 @@ class AdminPrivateSalesSales extends AdminTab {
// New
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'new',
'label' => $this->l('Nouveau :'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->new==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->new==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -424,14 +431,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Newsletter
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'forward_news',
'label' => $this->l('Mise en avant Newsletter :'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->forward_news==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->forward_news==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -439,14 +447,15 @@ class AdminPrivateSalesSales extends AdminTab {
// Shipping only fr
$input = array(
'type' => 'bool',
'type' => 'switch',
'name' => 'shipping_fr',
'label' => $this->l('Livraison seulement en France :'),
'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
// 'label_on' => '<span class="anticon anticon-checkmark text-green-light"></span>',
// 'label_off' => '<span class="anticon anticon-cross text-rose"></span>',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->shipping_fr==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->shipping_fr==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
@ -960,24 +969,39 @@ class AdminPrivateSalesSales extends AdminTab {
<div class="col-sm-5 col-sm-offset-2" style="background:#eee;padding:20px; border-radius:7px;">
<h4 class="text-center"><span class="anticon anticon-images"></span> Images</h4>';
foreach($this->imagelist as $k => $v) {
echo '<label>'.$v[0].'</label>
<div class="">';
foreach($this->_languages as $language) {
echo '<div id="img_'.$k.'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
<input type="file" name="img_'.$k.'_'.$language['id_lang'].'" />
<p class="help-block">'.$this->l('Size:').' '.$v[1].'</p>';
if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) {
echo '<p><a href="'.__PS_BASE_URI__.'modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"> '.$this->l('Preview').'</a></p>';
}
echo '
</div>';
}
$helperForm->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k);
echo '<div class="clear"></div>
</div>';
$input = array(
'type' => 'uploadImage',
'lang' => true,
'label' => $v[0],
'name' => 'img_'.$k,
'name_img' => $k,
'help' => $this->l('Size:').' '.$v[1],
'languages' => $this->_languages,
'default_language' => 2,
'input-class' => '',
'id_langs' => $divLangImgName,
'link_flag_img' => '../img/l/',
'url_imgs' => ($this->cursale !== NULL?__PS_BASE_URI__.'modules/privatesales/img/'.$this->cursale->id.'/':''),
'url_to_check' => ($this->cursale !== NULL?_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/':''),
);
echo $helperForm->generateInput($input);
echo '<div class="clearfix"></div>';
// echo '<label>'.$v[0].'</label>
// <div class="">';
// foreach($this->_languages as $language) {
// echo '<div id="img_'.$k.'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
// <input type="file" name="img_'.$k.'_'.$language['id_lang'].'" />
// <p class="help-block">'.$this->l('Size:').' '.$v[1].'</p>';
// if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) {
// echo '<p><a href="'.__PS_BASE_URI__.'modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"> '.$this->l('Preview').'</a></p>';
// }
// echo '
// </div>';
// }
// $helperForm->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k);
// echo '<div class="clear"></div>
// </div>';
}
echo '</div>
<div class="clear"></div>
<div class="ln_solid-small"></div>
@ -1265,6 +1289,8 @@ class AdminPrivateSalesSales extends AdminTab {
public function postProcess() {
global $cookie, $currentIndex;
//echo '<pre>';var_dump($_POST);echo '</pre>';die();
if(Tools::isSubmit('submitSaleAdd')) {
if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) {
return false;

View File

@ -186,9 +186,9 @@ class PrivateSales_ExtraFields extends Module {
SELECT *
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` s
WHERE s.`id_sale` = '.(int) $params['sale']->id.'
') as $value) {
') as $value) {
if($fields_values[$value['id_field']] === NULL) {
if($fields_values[$value['id_field']] === NULL) {
$fields_values[$value['id_field']] = array();
}
$fields_values[$value['id_field']][$value['id_lang']] = $value['value'];
@ -201,9 +201,9 @@ class PrivateSales_ExtraFields extends Module {
// SELECT *
// FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` s
// WHERE s.`id_sale` = '.(int) $params['sale']->id.'
// ') as $value) {
// ') as $value) {
// if($fields_values[$value['id_field']] === NULL) {
// if($fields_values[$value['id_field']] === NULL) {
// $fields_values[$value['id_field']] = array();
// }
// $fields_values[$value['id_field']][$value['id_lang']] = $value['value'];
@ -215,24 +215,25 @@ class PrivateSales_ExtraFields extends Module {
}
$divLangName = implode('¤', $divLangName);
foreach($fields as $field) {
echo '<label>'.$field['name'].'</label>
<div class="margin-form">';
echo '<div class="form-group">
<label class="control-label" >'.$field['name'].'</label>
<div class="">';
foreach($this->_languages as $language) {
echo '<div id="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">';
if($field['type'] == 1) {
echo '<textarea style="width: 500px; height: 150px;" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'">'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'</textarea>';
echo '<textarea class="form-control" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'">'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'</textarea>';
} else {
echo '<input type="text" style="width: 500px;" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'" value="'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'" />';
echo '<input type="text" class="form-control" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'" value="'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'" />';
}
echo '
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'm_extrafields_'.$field['id_field'].'_value');
echo '<div class="clear"></div>
</div>
</div>';
}
}
@ -272,7 +273,7 @@ class PrivateSales_ExtraFields extends Module {
public function hookPrivateSales_Listing($params) {
global $cookie;
$ids = array();
if(isset($params['sales'])){
foreach($params['sales'] as $sale) {
@ -286,7 +287,7 @@ class PrivateSales_ExtraFields extends Module {
}
if(isset($params['futuresales'])){
foreach($params['futuresales'] as $sale) {
$ids[] = $sale->id;
$ids[] = $sale->id;
}
}
@ -315,7 +316,7 @@ class PrivateSales_ExtraFields extends Module {
{
global $cookie;
$result = array();
foreach (Db::getInstance()->ExecuteS('
SELECT f.`blank`, l.`name`, l.`format`, s.`value`, s.`id_sale`, f.id_field
FROM `'._DB_PREFIX_.'privatesale_extrafield` f
@ -331,5 +332,5 @@ class PrivateSales_ExtraFields extends Module {
}
return $result;
}
}

View File

@ -180,19 +180,20 @@ class PrivateSales_Shipping extends Module {
<div class="clear"></div>
</div>';
} else {
echo '
<label>'.$this->l('Shipping:').'</label>
<div class="margin-form">
echo '<div class="form-group">
<label class="control-label">'.$this->l('Shipping:').'</label>
<div class="">
<div id="tags" style="float: left;">
<select id="s_shipping" name="s_shipping">
<option value=""></option>';
<select class="form-control" id="s_shipping" name="s_shipping">
<option value="">Choisir un expediteur</option>';
foreach($shipping as $ship) {
echo '<option value="'.$ship['id_shipping'].'"'.(isset($ship['id_shipping']) && $ship['id_sale'] !== NULL?' selected="selected"':'').'>'.$ship['value'].'</option>';
echo '<option value="'.$ship['id_shipping'].'"'.(isset($ship['id_shipping']) && (isset($ship['id_sale']) && $ship['id_sale'] !== NULL)?' selected="selected"':'').'>'.$ship['value'].'</option>';
}
echo '
</select>
</div>
<div class="clear"></div>
</div>
</div>';
}
}

View File

@ -184,9 +184,9 @@ class PrivateSales_Tags extends Module {
<div class="clear"></div>
</div>';
} else {
echo '
<label>'.$this->l('Tags:').'</label>
<div class="margin-form">
echo '<div class="form-group">
<label class="control-label">'.$this->l('Tags:').'</label>
<div class="">
<div id="tags" style="float: left;">
<select id="m_tag" name="m_tag[]" multiple="multiple" size="5">
<option value=""></option>
@ -208,7 +208,8 @@ class PrivateSales_Tags extends Module {
});
</script>
<div class="clear"></div>
</div>';
</div>
</div>';
}
}