894 lines
47 KiB
PHP
894 lines
47 KiB
PHP
<?php
|
|
|
|
class HelperFormBootstrap{
|
|
|
|
public $_forms = array();
|
|
public $_debug = false;
|
|
|
|
public $_html;
|
|
public $_object;
|
|
public $_style; // inc style
|
|
public $_css; // user style
|
|
public $_script; // inc js
|
|
public $_js; // user js
|
|
public $_messages;
|
|
|
|
public $_select2;
|
|
public $_inputMask;
|
|
public $_inputSwitch;
|
|
public $_inputWizard;
|
|
public $_inputTag;
|
|
public $_dateTime;
|
|
|
|
public function __construct(){
|
|
$this->_html = '';
|
|
$this->_object = NULL;
|
|
$this->_css = '';
|
|
$this->_style = '';
|
|
$this->_script = '';
|
|
$this->_js = '';
|
|
$this->_messages = '';
|
|
$this->_select2 = false;
|
|
$this->_inputMask = false;
|
|
$this->_inputSwitch = false;
|
|
$this->_inputWizard = false;
|
|
$this->_inputTag = false;
|
|
$this->_dateTime = false;
|
|
}
|
|
|
|
public function renderStyle() {
|
|
$this->_style .= '<style type="text/css">
|
|
@import url("'.__PS_BASE_URI__.'adm/helpers/includes/jquery-ui-1.8.20.custom.css");
|
|
@import url("'.__PS_BASE_URI__.'adm/helpers/includes/css/bootstrap.min.css");
|
|
'.($this->_select2?'@import url("'.__PS_BASE_URI__.'adm/helpers/includes/css/select2.min.css");':'').'
|
|
'.($this->_inputTag?'@import url("'.__PS_BASE_URI__.'adm/helpers/includes/jquery.tagsinput.min.css");':'').'
|
|
'.($this->_inputSwitch?'@import url("'.__PS_BASE_URI__.'adm/helpers/includes/switchery.min.css");':'').'
|
|
@import url("'.__PS_BASE_URI__.'adm/helpers/includes/css/custom.css");
|
|
' . $this->_css . '
|
|
</style>';
|
|
return $this->_style;
|
|
}
|
|
|
|
public function renderScript() {
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery.min.js"></script>';
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery-ui-1.8.20.custom.min.js"></script>';
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/js/bootstrap.min.js"></script>';
|
|
if ($this->_select2) {
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/js/select2.full.min.js"></script>';
|
|
}
|
|
if ($this->_inputMask) {
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery.inputmask.bundle.min.js"></script>';
|
|
}
|
|
if ($this->_inputTag) {
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery.tagsinput.js"></script>';
|
|
}
|
|
if ($this->_inputSwitch) {
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/switchery.min.js"></script>';
|
|
}
|
|
if ($this->_inputWizard) {
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery.smartWizard.js"></script>';
|
|
}
|
|
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/js/custom.js"></script>';
|
|
$this->_script .= $this->_js;
|
|
return $this->_script;
|
|
}
|
|
|
|
public function renderForm($display = true, $action = NULL, $method = 'POST', $enctype = 'multipart/form-data'){
|
|
|
|
$this->generateForms();
|
|
$form = ($this->_messages ? implode("\n", $this->_messages) : '') . $this->_html;
|
|
|
|
if ($display)
|
|
echo $form;
|
|
return $form;
|
|
}
|
|
|
|
public function generateForms($action = NULL, $method = 'POST', $enctype = 'multipart/form-data'){
|
|
if (!$this->_forms || empty($this->_forms))
|
|
return;
|
|
|
|
if (!$method)
|
|
$method = 'POST';
|
|
if (!$enctype)
|
|
$enctype = 'multipart/form-data';
|
|
|
|
foreach ($this->_forms as $form) {
|
|
$class_div = isset($form['class_div']) ? $form['class_div'] : '';
|
|
$action = isset($form['action']) ? $form['action'] : $action;
|
|
$method = isset($form['method']) ? $form['method'] : $method;
|
|
$enctype = isset($form['enctype']) ? $form['enctype'] : $enctype;
|
|
$css = isset($form['style']) ? $form['style'] : '';
|
|
$class = isset($form['class']) ? $form['class'] : '';
|
|
$id = (isset($form['id']) && $form['id']) ? $form['id'] : false;
|
|
$icon = (isset($form['icon']) && $form['icon']) ? $form['icon'] : false;
|
|
$title = (isset($form['title']) && $form['title']) ? $form['title'] : '';
|
|
|
|
// OPEN FORM
|
|
$this->_html .= '
|
|
<div class="'.$class_div.'">
|
|
<div class="panel">
|
|
<div class="panel-title">
|
|
<h2>'.($icon?$icon:'').$title.'</h2>
|
|
<div class="clearfix"></div>
|
|
</div>
|
|
<div class="panel-content">
|
|
<form action="'.$action.'" method="'.$method.'" enctype="'.$enctype.'" class="'.$class.'" id="'.$id.'" style="'.$css.'">';
|
|
if(isset($form['information'])) {
|
|
$this->_html .= '<p>'.$form['information'].'</p>';
|
|
}
|
|
if (isset($form['sections'])){
|
|
|
|
foreach ($form['sections'] as $section) {
|
|
|
|
$id = (isset($section['id']) && $section['id']) ? $section['id'] : false;
|
|
$icon = (isset($section['icon']) && $section['icon']) ? $section['icon'] : false;
|
|
$css = (isset($section['css']) && $section['css']) ? $section['css'] : false;
|
|
$class = (isset($section['class']) && $section['class']) ? $section['class'] : false;
|
|
$title = (isset($section['title']) && $section['title']) ? $section['title'] : '';
|
|
|
|
// OPEN section
|
|
$this->openSection($title, $id, $icon, $class, $css);
|
|
|
|
foreach ($section['inputs'] as $input) {
|
|
$this->addInput($input);
|
|
}
|
|
if (isset($section['actions']) && $section['actions']){
|
|
$this->_html .= '<div class="clearfix"></div>
|
|
<div class="ln_solid-small"></div>
|
|
<div class="form-group '.$section['actions-class'].'">';
|
|
foreach ($section['actions'] as $action) {
|
|
$this->addAction($action);
|
|
}
|
|
$this->_html .= '</div>';
|
|
}
|
|
$this->closeSection();
|
|
}
|
|
}
|
|
|
|
if (isset($form['html']) && $form['html']){
|
|
$this->_html .= $form['html'];
|
|
}
|
|
|
|
if (isset($form['actions']) && $form['actions']){
|
|
$this->_html .= '<div class="clearfix"></div>
|
|
<div class="ln_solid"></div>
|
|
<div class="form-group '.(isset($form['actions-class'])?$form['actions-class']:'').'">';
|
|
foreach ($form['actions'] as $action) {
|
|
$this->addAction($action);
|
|
}
|
|
$this->_html .= '</div>';
|
|
}
|
|
$this->_html .= '</form>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
}
|
|
}
|
|
|
|
public function generateInput($input) {
|
|
$this->addInput($input);
|
|
|
|
$result = $this->_html;
|
|
$this->_html = '';
|
|
return $result;
|
|
}
|
|
|
|
public function addJs($js){
|
|
$this->_js .= $js;
|
|
}
|
|
|
|
public function addCss($css){
|
|
$this->_css .= $css;
|
|
}
|
|
|
|
public function addInput($input){
|
|
if (!isset($input['type']))
|
|
return false;
|
|
$html = (isset($input['html']) && $input['html']) ? $input['html'] : NULL;
|
|
switch ($input['type']) {
|
|
case 'text':
|
|
$this->inputText($input);
|
|
break;
|
|
case 'simpleText':
|
|
$this->inputSimpleText($input);
|
|
break;
|
|
case 'tag':
|
|
$this->inputTag($input);
|
|
break;
|
|
case 'select':
|
|
$this->inputSelect($input);
|
|
break;
|
|
case 'select2':
|
|
$this->inputSelect2($input);
|
|
break;
|
|
case 'select-styled':
|
|
$this->inputSelectStyled($input);
|
|
break;
|
|
case 'simpleDate':
|
|
$this->inputSimpleDate($input);
|
|
break;
|
|
case 'bool':
|
|
case 'radio':
|
|
$this->inputBool($input);
|
|
break;
|
|
case 'radio2':
|
|
$this->inputRadio($input);
|
|
break;
|
|
case 'checkbox':
|
|
$this->inputCheckbox($input);
|
|
break;
|
|
case 'switch':
|
|
$this->inputSwitch($input);
|
|
break;
|
|
case 'textarea':
|
|
$this->inputTextarea($input);
|
|
break;
|
|
case 'rte':
|
|
$this->inputRte($input);
|
|
break;
|
|
case 'file':
|
|
$this->inputFile($input);
|
|
break;
|
|
case 'uploadImage':
|
|
$this->inputUploadImage($input);
|
|
break;
|
|
case 'button':
|
|
$this->inputButton($input);
|
|
break;
|
|
case 'submit':
|
|
$this->inputSubmit($input);
|
|
break;
|
|
case 'hidden':
|
|
$this->inputHidden($input);
|
|
break;
|
|
case 'html':
|
|
$this->_html .= $input['value'];
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function addAction($action){
|
|
if (!isset($action['type']) || !isset($action['name']))
|
|
return false;
|
|
$css = (isset($action['css']) && $action['css']) ? $action['css'] : NULL;
|
|
switch ($action['type']) {
|
|
case 'button':
|
|
$this->inputButton($action);
|
|
break;
|
|
case 'submit':
|
|
$this->inputSubmit($action);
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function openSection($legend='', $id = NULL, $icon = '', $class = '',$css = false){
|
|
$this->_html .= '<div' . ($id ? ' id="' . $id . '"' : '') .' class="'.$class.'"' . ($css ? ' style="' . $css . '"' : '') .'>';
|
|
if(!empty($legend)) {
|
|
$this->_html .= '<div class="div-title">
|
|
<h4>'.$legend.'</h4>
|
|
<div class="clearfix"></div>
|
|
</div>';
|
|
}
|
|
}
|
|
|
|
public function closeSection(){
|
|
$this->_html .= '</div>';
|
|
}
|
|
|
|
public function openFieldset($legend, $id = NULL, $img_src='../img/admin/edit.gif', $css = false){
|
|
$this->_html .= '<fieldset' . ($id ? ' id="' . $id . '"' : '') .' class="space"' . ($css ? ' style="' . $css . '"' : '') .'>
|
|
<legend><img src="'.$img_src.'" alt="" title="" /> '.$legend.'</legend>
|
|
<div class="fieldset_content">';
|
|
}
|
|
|
|
public function closeFieldset($legend, $img_src='../img/admin/edit.gif'){
|
|
$this->_html .= '</div></fieldset>';
|
|
}
|
|
|
|
public function inputTextAddon($p = array()) {
|
|
$this->_html .='
|
|
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
|
|
'.(isset($p['label']) && $p['label'] ?'<label class="control-label '.$p['label-class'].'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>':'').'
|
|
<div class="input-group">
|
|
'.(isset($p['before']) && $p['before'] ?'<div class="input-group-addon">'.$p['before'].'</div>':'').'
|
|
<input type="text" class="form-control" 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>';
|
|
}
|
|
|
|
public function inputSimpleText($p = array()) {
|
|
$this->_html .='
|
|
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
|
|
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
|
|
<input type="text" class="form-control" name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" placeholder="'.((isset($p['placeholder']) && $p['placeholder'])?$p['placeholder']:'').'" value="'.(isset($p['default']) ? $p['default'] : '').'">
|
|
</div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputTag($p = array()) {
|
|
$this->_html .='
|
|
<div class="control-group">
|
|
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
|
|
<input name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" type="text" class="tags form-control" value="'.(isset($p['default']) ? $p['default'] : '').'" />
|
|
<p id="'.(isset($p['input-tag']) ? $p['input-tag'] : '').'"><i>'.(isset($p['info']) ? $p['info'] : '').'</i></p>
|
|
</div>
|
|
<div class="clearfix"></div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputSimpleDate($p = array()) {
|
|
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="'.(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(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="'.(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']:'').'">
|
|
'.(isset($p['after-to']) && $p['after-to'] ?'<div class="input-group-addon">'.$p['after-to'].'</div>':'').'
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="clearfix"></div>';
|
|
}
|
|
}
|
|
|
|
public function inputSelect2($p = array()) {
|
|
$this->_html .='
|
|
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
|
|
'.(isset($p['label'])?'<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : 'col-md-3 col-sm-3 col-xs-12').'">'.$p['label'].'</label>':'').'
|
|
<div class="'.(isset($p['label'])?(isset($p['select-class']) ? $p['select-class'] :'col-md-9 col-sm-9 col-xs-12'):'').'">
|
|
<select class="form-control" name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" tabindex="-1">';
|
|
foreach($p['options'] as $opt) {
|
|
$selected = '';
|
|
if (
|
|
(isset($opt['selected']) && $opt['selected']) ||
|
|
(isset($this->_object) && $this->_object->{$p['name']} == $opt['value'])
|
|
)
|
|
$selected = ' selected="selected"';
|
|
$this->_html .= '<option id="' . $p['name'] . '_' . $opt['value'] . '" value="' . $opt['value'] . '"'. $selected .'>'.$opt['label'].'</option>';
|
|
}
|
|
$this->_html .='</select>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2({
|
|
placeholder: "'.(isset($p['placeholder'])?$p['placeholder']:'').'",
|
|
allowClear: true
|
|
});
|
|
});
|
|
</script>';
|
|
}
|
|
|
|
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>':'').'
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
|
|
<div class="input-group image-preview" id="'.$p['id'].'">
|
|
<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'].'"/>
|
|
</div>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
'.(isset($p['help'])?'<p class="help-block">'.$p['help'].'</p>':'').'
|
|
</div>';
|
|
|
|
$this->_js .= '
|
|
<script>
|
|
$(function() {
|
|
$(document).on(\'click\', \'#close-preview_'.$p['id'].'\', function(){
|
|
$(\'#'.$p['id'].'\').popover(\'hide\');
|
|
$(\'#'.$p['id'].'\').hover(
|
|
function () {
|
|
$(\'#'.$p['id'].'\').popover(\'show\');
|
|
},
|
|
function () {
|
|
$(\'#'.$p['id'].'\').popover(\'hide\');
|
|
}
|
|
);
|
|
});
|
|
|
|
var closebtn = $(\'<button/>\', {
|
|
type:"button",
|
|
text: \'x\',
|
|
id: \'close-preview_'.$p['id'].'\',
|
|
style: \'font-size: initial;\',
|
|
});
|
|
closebtn.attr("class","close pull-right");
|
|
|
|
$(\'#'.$p['id'].'\').popover({
|
|
trigger:\'manual\',
|
|
html:true,
|
|
title: "<strong>Preview</strong>"+$(closebtn)[0].outerHTML,
|
|
content: "There\'s no image",
|
|
placement:\'bottom\'
|
|
});
|
|
|
|
$(\'#'.$p['id'].' .image-preview-clear\').click(function(){
|
|
$(\'#'.$p['id'].'\').attr("data-content","").popover(\'hide\');
|
|
$(\'#'.$p['id'].' .image-preview-filename\').val("");
|
|
$(\'#'.$p['id'].' .image-preview-clear\').hide();
|
|
$(\'#'.$p['id'].' .image-preview-input input:file\').val("");
|
|
$("#'.$p['id'].' .image-preview-input-title").text("Ouvrir");
|
|
});
|
|
// Create the preview image
|
|
$("#'.$p['id'].' .image-preview-input input:file").change(function (){
|
|
var img = $(\'<img/>\', {
|
|
id: \'dynamic\',
|
|
width:250,
|
|
height: \'auto\'
|
|
});
|
|
var file = this.files[0];
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
$("#'.$p['id'].' .image-preview-input-title").text("Change");
|
|
$("#'.$p['id'].' .image-preview-clear").show();
|
|
$("#'.$p['id'].' .image-preview-filename").val(file.name);
|
|
img.attr(\'src\', e.target.result);
|
|
$("#'.$p['id'].'").attr("data-content",$(img)[0].outerHTML).popover("show");
|
|
}
|
|
reader.readAsDataURL(file);
|
|
});
|
|
});
|
|
</script>';
|
|
}
|
|
|
|
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 .= '
|
|
$this->_js .= '
|
|
<script>
|
|
$(function() {';
|
|
|
|
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="'.$p['name'].'_'.$language['id_lang'].'">
|
|
<div class="input-group image-preview" id="'.$p['id'].'_'.$language['id_lang'].'">
|
|
<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->_js .= '
|
|
$(document).on(\'click\', \'#close-preview_'.$p['id'].'_'.$language['id_lang'].'\', function(){
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].'\').popover(\'hide\');
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].'\').hover(
|
|
function () {
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].'\').popover(\'show\');
|
|
},
|
|
function () {
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].'\').popover(\'hide\');
|
|
}
|
|
);
|
|
});
|
|
|
|
var closebtn = $(\'<button/>\', {
|
|
type:"button",
|
|
text: \'x\',
|
|
id: \'close-preview_'.$p['id'].'_'.$language['id_lang'].'\',
|
|
style: \'font-size: initial;\',
|
|
});
|
|
closebtn.attr("class","close pull-right");
|
|
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].'\').popover({
|
|
trigger:\'manual\',
|
|
html:true,
|
|
title: "<strong>Preview</strong>"+$(closebtn)[0].outerHTML,
|
|
content: "There\'s no image",
|
|
placement:\'bottom\'
|
|
});
|
|
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].' .image-preview-clear\').click(function(){
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].'\').attr("data-content","").popover(\'hide\');
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].' .image-preview-filename\').val("");
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].' .image-preview-clear\').hide();
|
|
$(\'#'.$p['id'].'_'.$language['id_lang'].' .image-preview-input input:file\').val("");
|
|
$("#'.$p['id'].'_'.$language['id_lang'].' .image-preview-input-title").text("Browse");
|
|
});
|
|
// Create the preview image
|
|
$("#'.$p['id'].'_'.$language['id_lang'].' .image-preview-input input:file").change(function (){
|
|
var img = $(\'<img/>\', {
|
|
id: \'dynamic\',
|
|
width:250,
|
|
height: \'auto\'
|
|
});
|
|
var file = this.files[0];
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
$("#'.$p['id'].'_'.$language['id_lang'].' .image-preview-input-title").text("Change");
|
|
$("#'.$p['id'].'_'.$language['id_lang'].' .image-preview-clear").show();
|
|
$("#'.$p['id'].'_'.$language['id_lang'].' .image-preview-filename").val(file.name);
|
|
img.attr(\'src\', e.target.result);
|
|
$("#'.$p['id'].'_'.$language['id_lang'].'").attr("data-content",$(img)[0].outerHTML).popover("show");
|
|
}
|
|
reader.readAsDataURL(file);
|
|
});';
|
|
}
|
|
$this->_html .= '<div class="clearfix"></div>
|
|
'.((isset($p['help']) && $p['help']) ? '<span id="helpBlock" class="help-block">'.$p['help'].'</span>' : '').'
|
|
</div>';
|
|
$this->_js.='
|
|
});
|
|
</script>';
|
|
}
|
|
|
|
public function inputSwitch($p = array()) {
|
|
$this->_html .='
|
|
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
|
|
'.(isset($p['label'])?'<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label'].'</label>':'').'
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
|
|
<div class="checkbox input-switch">
|
|
<label>
|
|
<input type="checkbox" name="'.$p['name'].'" class="js-switch" value="1" '.(isset($p['checked']) && $p['checked']?'checked="checked"':'').' /> '.(isset($p['title'])?$p['title']:'').'
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
//<input type="checkbox" name="'.$p['name'].'" class="js-switch" '.(isset($p['checked']) && $p['checked']?'checked="checked"':'').' /> '.$p['title'].'
|
|
}
|
|
|
|
public function inputText($p = array()){
|
|
|
|
if (isset($p['lang']) && $p['lang'] === true) {
|
|
return $this->inputTextL($p);
|
|
}
|
|
$default_value = (isset($p['default']) ? $p['default'] : '');
|
|
$disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : '');
|
|
$this->_html .= '
|
|
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
|
|
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label']. ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '</label>
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
|
|
<input type="text" class="form-control" ' . $disabled . ' name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" value="'.($this->_object ? $this->_object->{$p['name']} : $default_value ).'"'.(isset($p['css']) ? 'style="'.$p['css'].'"' : '').'/>
|
|
' . ((isset($p['help']) && $p['help']) ? '<span id="helpBlock" class="help-block">'.$p['help'].'</span>' : '') . '
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
</div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputTextL($p = array()){
|
|
$default_value = (isset($p['default']) ? $p['default'] : '');
|
|
$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'] : '').'">
|
|
<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;
|
|
$this->_html .= '
|
|
<div id="'.(isset($p['id']) ? $p['id'] : $p['name']).'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';">
|
|
<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 .= '<div class="clearfix"></div>
|
|
'.((isset($p['help']) && $p['help']) ? '<span id="helpBlock" class="help-block">'.$p['help'].'</span>' : '').'
|
|
</div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputFile($p = array()){
|
|
$this->_html .= '
|
|
<div class="form-group ' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
|
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label'].'</label>
|
|
<input type="file" name="'.$p['name'].'" id="'.$p['name'].'" value="" />
|
|
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
|
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
<p class="clear"></p>
|
|
</div>';
|
|
}
|
|
|
|
public function inputSelect($p = array()){
|
|
$disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : '');
|
|
$this->_html .= '
|
|
<div class="form-group ' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
|
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label'].'</label>
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">
|
|
<select class="form-control" ' . $disabled . ' id="'.$p['name'].'" name="'.$p['name'].'">';
|
|
foreach($p['options'] as $opt) {
|
|
$selected = '';
|
|
if (
|
|
(isset($opt['selected']) && $opt['selected']) ||
|
|
(isset($this->_object) && $this->_object->{$p['name']} == $opt['value'])
|
|
)
|
|
$selected = ' selected="selected"';
|
|
$this->_html .= '<option id="' . $p['name'] . '_' . $opt['value'] . '" value="' . $opt['value'] . '"'. $selected .'>'.$opt['label'].'</option>';
|
|
}
|
|
$this->_html .= '
|
|
</select>
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
</div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputSelectStyled($p = array()){
|
|
$disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : '');
|
|
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
|
<div class="margin-form' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
|
<div class="styled-select'.(isset($p['class-select']) && $p['class-select'] ? ' ' . $p['class-select'] : '').'">
|
|
<select ' . $disabled . ' id="'.$p['name'].'" name="'.$p['name'].'">';
|
|
foreach($p['options'] as $opt) {
|
|
$selected = '';
|
|
if (
|
|
(isset($opt['selected']) && $opt['selected']) ||
|
|
(isset($this->_object) && $this->_object->{$p['name']} == $opt['value'])
|
|
)
|
|
$selected = ' selected="selected"';
|
|
$this->_html .= '<option id="' . $p['name'] . '_' . $opt['value'] . '" value="' . $opt['value'] . '"'. $selected .'>'.$opt['label'].'</option>';
|
|
}
|
|
$this->_html .= '
|
|
</select>
|
|
</div>
|
|
' . ((isset($p['filter']) && $p['filter']) ? '<div class="clear"></div><br/><input data-id="' . $p['name'] . '" class="select_filter" id="filter_' . $p['name'] . '" type="text" ' . ((isset($p['filter_text']) && $p['filter_text']) ? 'placeholder="' . $p['filter_text'] . '"' : '') . 'autocomplete="off" value="" /> <span class="filter_count" id="filter_count_' . $p['name'] . '"></span>' : '') . '
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
</div>';
|
|
}
|
|
|
|
public function inputBool($p = array()) {
|
|
$checked = ((isset($p['default']) && $p['default']) ? $p['default'] : false);
|
|
$this->_html .= '
|
|
<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="'.$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="'.$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>
|
|
</div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputRadio($p = array()) {
|
|
$this->_html .= '
|
|
<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'] : '') . '">';
|
|
foreach($p['options'] as $key => $option) {
|
|
$this->_html .= '<label class="radio-inline" for="'.$p['name'].'_'.$key.'">
|
|
<input type="radio" name="'.$p['name'].'" value="'.$option['value'].'" id="'.$p['name'] . '_' . $opt['value'].'"'.($option['checked']? ' checked="checked"' : '').' /> '.(isset($option['label']) && $option['label'] ?$option['label']:'').'
|
|
</label>';
|
|
}
|
|
$this->_html .= '<div class="clearfix"></div>
|
|
</div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputCheckbox($p = array()){
|
|
$checked = ((isset($p['checked']) && $p['checked']) ? $p['checked'] : false);
|
|
if ($this->_object)
|
|
$checked = $this->_object->{$p['name']};
|
|
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
|
<div class="margin-form checkbox' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
|
<input type="checkbox" id="'.$p['name'].'" name="'.$p['name'].'" value="1" id="'.$p['name'].'"'.($checked ? ' checked="checked"' : '').'/>
|
|
' . (isset($p['text']) && $p['text'] ? '<label class="checkbox_label" for="'.$p['name'].'">'.$p['text'].'</label>' : '') . '
|
|
<div class="clear"></div>
|
|
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
<div class="clear"></div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputDate($p = array()){
|
|
$this->_dateTime = true;
|
|
$default = ((isset($p['default']) && $p['default']) ? $p['default'] : '');
|
|
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
|
<div class="margin-form date' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
|
<div id="'.$p['name'].'" style="float: left;">
|
|
<input class="datetimepicker" name="'.$p['name'].'" type="text" value="'.($this->_object ? $this->_object->{$p['name']} : $default).'" style="width: 150px;" />
|
|
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
|
</div>
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
<div class="clear"></div>
|
|
</div>';
|
|
}
|
|
|
|
public function inputRte($p = array()){
|
|
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
|
<div class="margin-form translatable rte' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">';
|
|
foreach ($this->_languages AS $language){
|
|
$default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : '';
|
|
$this->_html .= '
|
|
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
|
<textarea name="'.$p['name'].'_'.$language['id_lang'].'" rows="4" cols="75">'.($this->_object ? $this->_object->{$p['name']}[(int)$language['id_lang']] : $default_lang).'</textarea>
|
|
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
|
</div>';
|
|
}
|
|
$this->_html .= '
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
<p class="clear"></p>
|
|
</div>';
|
|
}
|
|
|
|
public function selectCheck($p = array()){
|
|
$this->_selectCheck = true;
|
|
$size = ((isset($p['size']) && $p['size']) ? (int) $p['size'] : 5);
|
|
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
|
<div class="margin-form' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
|
<div id="'.$p['name'].'_selectCheck" style="float: left;">
|
|
<select data-text="' . $p['select_all_text'] . '" id="'.$p['name'].'" class="multiSelectCheck" name="'.$p['name'].'[]" multiple="multiple" size="'.$size.'">
|
|
<option value=""></option>
|
|
<optgroup label="'.$p['group_label'].'">';
|
|
|
|
foreach($p['options'] as $opt) {
|
|
$selected = '';
|
|
if (isset($opt['selected']) && $opt['selected'])
|
|
$selected = ' selected="selected"';
|
|
$this->_html .= '<option' .
|
|
((isset($opt['class']) && $opt['class']) ? ' class="' . $opt['class'] . '"' : '') .
|
|
' value="' . $opt['value'] . '"'. $selected . '>' . $opt['label'] .
|
|
'</option>';
|
|
}
|
|
$this->_html .= '
|
|
</optgroup>
|
|
</select>
|
|
</div>
|
|
' . ((isset($p['filter']) && $p['filter']) ? '<div class="clear"></div><br/><input data-id="' . $p['name'] . '" class="selectCheck_filter" id="filter_' . $p['name'] . '" type="text" ' . ((isset($p['filter_text']) && $p['filter_text']) ? 'placeholder="' . $p['filter_text'] . '"' : '') . 'autocomplete="off" value="" />' : '') . '
|
|
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
|
<div class="clear"></div>
|
|
</div>';
|
|
}
|
|
|
|
|
|
public function inputButtonLink($p = array()){
|
|
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
|
|
$class = isset($p['css']) && $p['css'] ? $p['css'] : false;
|
|
$this->_html .= '
|
|
<a '.($css ? 'style="'.$css.'"' : '').' href="'.$p['action'].'" class="button" name="'.$p['name'].'">'.$p['label'].'</a>
|
|
';
|
|
}
|
|
public function inputButton($p = array()){
|
|
$label = isset($p['label']) && $p['label'] ? $p['label'] : false;
|
|
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
|
|
$class = isset($p['class']) && $p['class'] ? $p['class'] : false;
|
|
$this->_html .= '
|
|
<button '.($css ? 'style="'.$css.'"' : '').' type="submit" class="btn '.($class ? $class : '').'" name="'.$p['name'].'">'.$p['value'].'</button>
|
|
';
|
|
}
|
|
public function inputSubmit($p = array()){
|
|
$label = isset($p['label']) && $p['label'] ? $p['label'] : false;
|
|
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
|
|
$class = isset($p['class']) && $p['class'] ? $p['class'] : false;
|
|
if($label) {
|
|
$this->_html .= '<div class="form-group">
|
|
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'" for="'.(isset($p['id']) ? $p['id'] : $p['name']).'">'.$p['label'].'</label>
|
|
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">';
|
|
}
|
|
$this->_html .= '
|
|
<input '.($css ? 'style="'.$css.'"' : '').' type="submit" class="btn '.($class ? $class : '').'" name="'.$p['name'].'" value="'.$p['value'].'" />
|
|
';
|
|
if($label) {
|
|
$this->_html .= '</div></div>';
|
|
}
|
|
}
|
|
|
|
public function inputHidden($p = array()){
|
|
$id = ((isset($p['id']) && $p['id']) ? $p['id'] : $p['name']);
|
|
$this->_html .= '
|
|
<input type="hidden" id="'.$id.'" name="'.$p['name'].'" value="'.$p['value'].'" />';
|
|
}
|
|
|
|
public function displayError($message){
|
|
$this->_messages[] = '<div class="error">' . $message . '</div>';
|
|
}
|
|
|
|
public function displayMessage($message){
|
|
return $this->_messages[] = '<div class="message">' . $message . '</div>';
|
|
}
|
|
|
|
public function displayConf($message){
|
|
return $this->_messages[] = '<div class="conf">' . $message . '</div>';
|
|
}
|
|
|
|
public static function echoConfirmation($message){
|
|
echo '<div class="alert alert-success" role="alert">
|
|
<span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span>
|
|
<span class="sr-only">Success:</span>
|
|
'.$message.'
|
|
</div>';
|
|
}
|
|
public static function echoError($message){
|
|
echo '<div class="alert alert-danger" role="alert">
|
|
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
|
|
<span class="sr-only">Error:</span>
|
|
'.$message.'
|
|
</div>';
|
|
}
|
|
|
|
public static function displaySuccess($message){
|
|
echo '<div class="col-sm-6 col-sm-offset-3 alert-custom alert-ok" style="margin-bottom: 10px;">
|
|
<i class="glyphicon glyphicon-ok"></i> <span class="text-alert">'.$message.'</span>
|
|
</div>';
|
|
}
|
|
public static function displayWarning($message){
|
|
echo '<div class="col-sm-6 col-sm-offset-3 alert-custom alert-warning" style="margin-bottom: 10px;">
|
|
<i class="anticon anticon-notification"></i> <span class="text-alert">'.$message.'</span>
|
|
</div>';
|
|
}
|
|
public static function displayErrors($message){
|
|
echo '<div class="col-sm-6 col-sm-offset-3 alert-custom alert-error" style="margin-bottom: 10px;">
|
|
<i class="anticon anticon-warning"></i> <span class="text-alert">'.$message.'</span>
|
|
</div>';
|
|
}
|
|
|
|
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 = '<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 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="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="changeLang(\''.$id.'\', \''.$ids.'\', '.$language['id_lang'].', \''.$language['iso_code'].'\', \''.$display.'\');" /> ';
|
|
}
|
|
$output .= '</div></div>';
|
|
|
|
if ($return)
|
|
return $output;
|
|
echo $output;
|
|
}
|
|
} |