Current File : /home/pacjaorg/public_html/km/components/com_djclassifieds/layouts/formfield.php |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined('_JEXEC') or die;
$f = $displayData['f'];
$item = $displayData['item'];
$show_field_only = !empty($displayData['show_field_only']) ? true : false;
$par = $displayData['par'];
if(!$show_field_only){
echo '<div class="djform_row '.$f->wrapper_cl.'" data-ord="'.$f->ordering.'" data-id="'.$f->id.'">';
echo DJClassifiedsTheme::renderLayout('formfieldlabel', array('for' => 'dj'.$f->name, 'title' => $f->label, 'tooltip' => $f->description, 'char_limit' => $f->par->get('char_limit'), 'extra_info' => $f->par->get('label_extra_info') ? $f->par->get('label_extra_info') : '', 'req' => $f->required, 'par' => $par));
echo '<div class="djform_field">';
}
if($f->type=="inputbox"){
if($f->source == '0' && $f->name=='price'){
if($par->get('unit_price_position','0')=='1'){
echo ' ';
if($par->get('unit_price_list','')){
$c_list = explode(';', $par->get('unit_price_list',''));
echo '<select class="price_currency" name="currency">';
for($c_l=0;$c_l<count($c_list);$c_l++){
echo '<option'.($item && $c_list[$c_l] == $item->currency ? ' selected' : '').' value="'.$c_list[$c_l].'">'.$c_list[$c_l].'</option>';
}
echo '</select>';
}else{
echo $par->get('unit_price','EUR');
}
}
}
echo '<input class="'.$f->cl.'"'.$f->props.' type="'.($f->input_type ? $f->input_type : 'text').'" id="dj'.$f->name.'" name="'.$f->name.'" '.$f->attribs;
if($f->placeholder && in_array($f->input_type, array('', 'text', 'url', 'tel', 'email', 'password'))){
echo ' placeholder="'.JText::_($f->placeholder).'"';
}
if($f->par->get('char_limit')){
echo ' data-charlimit="'.$f->par->get('char_limit').'"';
}
echo ' value="'.$f->val.'"';
echo ' />';
}else if($f->type=="textarea"){
echo '<textarea class="'.$f->cl.'"'.$f->props.' id="dj'.$f->name.'" name="'.$f->name.'" '.$f->attribs;
if($f->placeholder){
echo ' placeholder="'.JText::_($f->placeholder).'"';
}
if($f->par->get('char_limit')){
echo ' data-charlimit="'.$f->par->get('char_limit').'"';
}
echo ' />';
echo $f->val;
echo '</textarea>';
}else if($f->type=="selectlist"){
echo '<select class="'.$f->cl.'"'.$f->props.' id="dj'.$f->name.'" name="'.$f->name.'" '.$f->attribs.'>';
for($i=0;$i<count($f->val_arr);$i++){
$val_arr = DJClassifiedsField::getFieldOptionValue($f->val_arr[$i]);
echo '<option'.($f->val == $val_arr[0] ? ' selected' : '').' value="'.$val_arr[0].'">';
if($val_arr[1] == ''){
if($f->par->get('empty_value_text')){
echo JText::_($f->par->get('empty_value_text'));
}elseif(JText::_('COM_DJCLASSIFIEDS_SELECT_FIELD_EMPTY_VALUE') != 'COM_DJCLASSIFIEDS_SELECT_FIELD_EMPTY_VALUE'){
echo JText::_('COM_DJCLASSIFIEDS_SELECT_FIELD_EMPTY_VALUE');
}
}else{
echo $par->get('cf_values_to_labels','0') ? DJClassifiedsTheme::getFieldValueToLabel($val_arr[1]) : $val_arr[1];
}
echo '</option>';
}
echo '</select>';
}else if($f->type=="radio"){
echo '<div class="radiofield_box">';
echo '<input type="hidden" name="'.$f->name.'_djhelper" value="" />'; // helper input for empty form submit
echo '<fieldset id="dj'.$f->name.'" class="radio '.$f->cl.'"'.$f->props.'>';
for($i=0;$i<count($f->val_arr);$i++){
$val_arr = DJClassifiedsField::getFieldOptionValue($f->val_arr[$i]);
echo '<div class="radio_v">';
echo '<input type="radio"'.($f->val == $val_arr[0] ? ' checked' : '').' value="'.$val_arr[0].'" name="'.$f->name.'" id="dj'.$f->name.$i.'" />';
echo '<label for="dj'.$f->name.$i.'" class="radio_label dj'.$f->name.$i.'">';
if($val_arr[1] == ''){
if($f->par->get('empty_value_text')){
echo JText::_($f->par->get('empty_value_text'));
}
}else{
echo $par->get('cf_values_to_labels','0') ? DJClassifiedsTheme::getFieldValueToLabel($val_arr[1]) : $val_arr[1];
}
echo '</label>';
echo '</div>';
}
echo '</fieldset>';
echo '</div>';
}else if($f->type=="checkbox"){
$chx_output = '';
$chx_output .= '<div class="radiofield_box">';
$chx_output .= '<fieldset id="dj'.$f->name.'" class="'.$f->cl.'"'.$f->props.'>';
$chx_output .= '<input type="hidden" name="'.$f->name.'_djhelper" value="" />'; // helper input for empty form submit
for($i=0;$i<count($f->val_arr);$i++){
$val_arr = DJClassifiedsField::getFieldOptionValue($f->val_arr[$i]);
$checked = '';
if($f->val){
for($d=0;$d<count($f->val);$d++){
if($f->val[$d] == $val_arr[0]){
$checked = ' checked';
}
}
}
$chx_output .= '<div class="checkbox_v">';
$chx_output .= '<input type="checkbox" id="dj'.$f->name.$i.'" class="checkbox"'.$checked.' value="'.$val_arr[0].'" name="'.$f->name.'[]" />';
$chx_output .= '<label for="dj'.$f->name.$i.'" class="radio_label dj'.$f->name.$i.'">';
if($val_arr[1] == ''){
if($f->par->get('empty_value_text')){
$chx_output .= JText::_($f->par->get('empty_value_text'));
}
}else{
$chx_output .= $par->get('cf_values_to_labels','0') ? DJClassifiedsTheme::getFieldValueToLabel($val_arr[1]) : $val_arr[1];
}
$chx_output .= '</label>';
$chx_output .= '</div>';
}
$chx_output .= '</fieldset>';
$chx_output .= '</div>';
if($f->par->get('show_in_modal','0')){
$modal_id = 'djmodal'.rand().'_chx'.$f->id;
?>
<div class="djmodal_trigger_wrapper">
<span class="djmodal_trigger" data-bs-toggle="modal" data-toggle="modal" data-target="#<?php echo $modal_id; ?>" href="#<?php echo $modal_id; ?>" data-label="<?php echo JText::_($f->par->get('empty_value_text') ? $f->par->get('empty_value_text') : $f->label); ?>"><?php echo JText::_($f->par->get('empty_value_text') ? $f->par->get('empty_value_text') : $f->label); ?></span>
<button type="button" style="display:none" class="djclose close novalidate button" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<?php
echo JHtml::_('bootstrap.renderModal', $modal_id, array('title' => JText::_($f->label), 'footer' => '<button type="button" class="button cancel btn btn-secondary" data-dismiss="modal" data-bs-dismiss="modal">'.JText::_('COM_DJCLASSIFIEDS_MODAL_CLOSE').'</button>'), $chx_output);
}else{
echo $chx_output;
}
}else if($f->type=="date"){
echo JHTML::calendar($f->val, $f->name, 'dj'.$f->name, DJClassifiedsTheme::dateFormatConvert($f->date_format), array('size'=>'10','maxlength'=>'19','class'=>$f->cl));
}else if($f->type=="date_from_to"){
echo JHTML::calendar($f->val, $f->name, 'dj'.$f->name, DJClassifiedsTheme::dateFormatConvert($f->date_format), array('size'=>'10','maxlength'=>'19','class'=>$f->cl));
echo '<span class="date_from_to_sep"> - </span>';
echo JHTML::calendar($f->val2, $f->name.'_to', 'dj'.$f->name.'_to', DJClassifiedsTheme::dateFormatConvert($f->date_format), array('size'=>'10','maxlength'=>'19','class'=>$f->cl));
}else if($f->type=="link"){
echo '<input class="'.$f->cl.'"'.$f->props.' type="text" id="dj'.$f->name.'" name="'.$f->name.'" '.$f->attribs;
if($f->placeholder){
echo ' placeholder="'.JText::_($f->placeholder).'"';
}
if($f->par->get('char_limit')){
echo ' data-charlimit="'.$f->par->get('char_limit').'"';
}
echo ' value="'.$f->val.'"';
echo ' />';
}else if($f->type=="image"){
echo '<div class="djimage">';
echo '<div class="itemImage">';
echo '<img id="imgImg'.$f->id.'" src="'.$f->img_src.'" />';
echo '<input style="display:none" type="checkbox" name="del_img'.$f->id.'" id="del_img'.$f->id.'" value="'.$f->img_id.'"/>';
echo '<div class="imgMask">';
echo '<span class="delBtn" id="delBtn'.$f->id.'"></span>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '<input class="imgInput" type="file" name="imgInp'.$f->id.'" id="imgInp'.$f->id.'" accept="image/*" data-maxsize="'.($f->par->get('image_maxsize', 0) * 1024 * 1024).'" data-maxsize-msg="'.addslashes(JText::_('COM_DJCLASSIFIEDS_TO_BIG_IMAGE')).'" '.$f->attribs.'/>';
}
if($f->source == '0' && $f->name=='price'){
if($par->get('unit_price_position','0')=='0'){
echo ' ';
if($par->get('unit_price_list','')){
$c_list = explode(';', $par->get('unit_price_list',''));
echo '<select class="price_currency" name="currency">';
for($c_l=0;$c_l<count($c_list);$c_l++){
echo '<option'.($item && $c_list[$c_l] == $item->currency ? ' selected' : '').' value="'.$c_list[$c_l].'">'.$c_list[$c_l].'</option>';
}
echo '</select>';
}else{
echo $par->get('unit_price','EUR');
}
}
if($par->get('show_price_negotiable','0')){
echo '<div class="price_neg_box">';
echo '<input type="checkbox" autocomplete="off" name="price_negotiable" id="price_negotiable" value="1"'.($item && $item->price_negotiable ? ' checked' : '').'/>';
echo '<label for="price_negotiable">'.JText::_('COM_DJCLASSIFIEDS_PRICE_NEGOTIABLE').'</label>';
echo '</div>';
}else{
echo '<input type="hidden" name="price_negotiable" value="0" />';
}
}
if(!$show_field_only){
echo '</div>';
echo '<div class="clear_both"></div>';
echo '</div>';
}
?>