Current File : /home/pacjaorg/wpt.pacja.org/km/modules/mod_djclassifieds_items/tmpl/default.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('Restricted access');
JHTML::_('jquery.framework');
$app = JFactory::getApplication();
$cols = $params->get('columns_nr','1');
$items_in_col = ceil(count($items) / $cols);
$col_nr = 1;
$item_c = 0;
$last_row = count($items)%$cols;
$items_in_lr = $last_row;
?>
<div id="mod_djclassifieds_items<?php echo $module->id; ?>" class="mod_djclassifieds_items <?php echo $params->get('items_dir','vertical'); ?> clearfix<?php echo $slider ? ' mod_djcf_slider' : ''; ?>">
<?php if($slider){ ?>
<div class="djcf_slider_left blocked"> </div>
<div class="djcf_slider_loader"><div class="djcf_slider_loader_img"></div></div>
<?php } ?>
<div class="items-outer">
<div class="items items-cols<?php echo $cols; ?>">
<?php if($params->get('items_dir','vertical') == 'vertical' || $slider){ ?>
<div class="<?php echo $slider ? 'items-content' : 'items-col' ?> icol<?php echo $col_nr; ?>"><div class="icol-in">
<?php } ?>
<?php foreach($items as $i){ ?>
<?php if($params->get('items_dir','vertical') == 'horizontal'){ ?>
<div class="items-col"><div class="icol-in">
<?php } ?>
<?php
if(!$slider && $params->get('items_dir','vertical') == 'vertical'){
if($item_c==$items_in_col){
$col_nr++;
echo '</div></div><div class="items-col icol'.$col_nr.'"><div class="icol-in">';
$item_c=0;
}
if($item_c==$items_in_col-1 && $last_row==0 && $items_in_lr!=0){
$col_nr++;
echo '</div></div><div class="items-col icol'.$col_nr.'"><div class="icol-in">';
$item_c=0;
}
if($item_c==$items_in_col-1 && $last_row>0){
$last_row--;
}
$item_c++;
}
?>
<div class="item-box">
<div class="item-box-in">
<?php
$item_class='';
if($i->promotions){
$item_class .=' promotion '.str_ireplace(',', ' ', $i->promotions);
}
if($i->published==2){
$item_class .=' item_archived';
}
if($user->id && $cfpar->get('favourite','1') && $params->get('show_fav_icon','0')==1 && $i->f_id){
$item_class .= ' item_fav';
}
echo '<div class="item'.$item_class.'">';
echo '<div class="title">';
if($params->get('show_img')==1){
$img_width = ($params->get('img_width','') ? 'max-width:'.$params->get('img_width','').'px;' : '');
$img_height = ($params->get('img_height','') ? 'max-height:'.$params->get('img_height','').'px;' : '');
if($i->images){
echo '<a class="title_img" href="'.$i->item_uri.'">';
if($params->get('img_type','ths')=='thm'){
$thumb = $i->images[0]->thumb_m;
}else if($params->get('img_type','ths')=='thb'){
$thumb = $i->images[0]->thumb_b;
}else{
$thumb = $i->images[0]->thumb_s;
}
echo '<img style="'.$img_width.$img_height.'" src="'.JURI::base(true).$thumb.'" alt="'.str_ireplace('"', "'", $i->name).'" title="'.$i->images[0]->caption.'" />';
foreach($app->triggerEvent('onAfterDJClassifiedsDisplayImage', array($i, $params, 'module.items')) as $plug_out) echo $plug_out;
echo '</a>';
}else if($params->get('show_default_img','1')>0){
echo '<a class="title_img" href="'.$i->item_uri.'">';
$show_cat_icon = false;
if(isset($cat_images[$i->cat_id])){
if($cat_images[$i->cat_id]->name){$show_cat_icon = true;}
}
if($params->get('show_default_img','1')==2 && $show_cat_icon){
echo '<img style="'.$img_width.$img_height.'" src="'.JURI::base(true).$cat_images[$i->cat_id]->image_path.'" alt="'.str_ireplace('"', "'", $i->name).'" title="'.$cat_images[$i->cat_id]->caption.'" />';
}else{
echo '<img class="no-image" style="'.($img_width || $img_height ? $img_width.$img_height : DJClassifiedsImage::getThumbStyle($params->get('img_type','ths'),$cfpar)).'" src="'.JURI::base(true).'/'.DJClassifiedsTheme::getImgAssetPath('no-image.svg').'" alt="'.str_ireplace('"', "'", $i->name).'" />';
}
foreach($app->triggerEvent('onAfterDJClassifiedsDisplayImage', array($i, $params, 'module.items')) as $plug_out) echo $plug_out;
echo '</a>';
}
}
if($params->get('show_title','1')==1){
$title_c = $params->get('char_title_nr',0);
if($title_c && mb_strlen($i->name) > $title_c){
$i->name = mb_substr($i->name, 0, $title_c, 'UTF-8').'...';
}
echo '<a class="title" href="'.$i->item_uri.'">'.$i->name.'</a>';
}
if($params->get('show_type','1') && $i->type_id){
$type_preview = DJClassifiedsType::getTypePreview($i->type_id, $params->get('show_type','1')=='2');
if($type_preview){
echo '<span class="type">'.$type_preview.'</span>';
}
}
if(!empty($i->p_verified)){
echo ' <span class="verified_icon" title="'.JText::_('COM_DJCLASSIFIEDS_VERIFIED_SELLER').'"></span>';
}
if($i->published==2){
echo ' <span class="archived_icon" title="'.JText::_('COM_DJCLASSIFIEDS_ARCHIVE_ADVERT').'"></span>';
}
if($cfpar->get('favourite','1') && $params->get('show_fav_icon','0')==1){
echo DJClassifiedsTheme::renderLayout('favbox', array('item_id' => $i->id, 'i_user_id' => $i->user_id, 'fav' => !empty($i->f_id), 'cl' => 'mfav_box', 'par' => $cfpar));
}
if(($params->get('show_date')==1) || ($params->get('show_cat')==1) || ($params->get('show_price')==1) || ($params->get('show_region','1'))){
echo '<div class="date_cat">';
if($params->get('show_date')==1){
echo '<span class="date">';
echo DJClassifiedsTheme::formatDate(strtotime($i->date_start),'',$cfpar->get('date_format_type_modules','Y-m-d H:i:s'));
echo '</span>';
}
if($params->get('show_cat')==1){
echo '<span class="category">';
if($i->event->DJClassifiedsDisplayCategory){
echo $i->event->DJClassifiedsDisplayCategory;
}else{
if($params->get('cat_link')==1){
echo '<a class="title_cat" href="'.DJClassifiedsSEO::getCategoryRoute($i->cat_id.':'.$i->c_alias, true).'">'.JText::_($i->c_name).'</a>';
}else{
echo JText::_($i->c_name);
}
}
echo '</span>';
}
if($params->get('show_region')==1){
echo '<span class="region">';
echo '<a href="'.DJClassifiedsSEO::getRegionRoute($i->region_id.':'.$i->r_alias, true).'">'.JText::_($i->r_name).'</a>';
echo '</span>';
}
if($plug_out_arr = $app->triggerEvent('onDJClassifiedsDisplayPrice', array($i, 'module.items'))){
foreach($plug_out_arr as $plug_out) echo $plug_out;
}elseif($params->get('show_price')==1 && ($i->price || $i->auction)){
echo '<div class="price">';
if($i->buynow){
echo '<span class="buynow_label">'.JText::_('COM_DJCLASSIFIEDS_BUYNOW').': </span>';
}
if($i->price){
echo DJClassifiedsTheme::priceFormat($i->price,$i->currency);
}
if($i->auction){
$auction_price = $i->highest_bid ? $i->highest_bid : $i->price_start;
echo '<div class="auction" title="'.($i->highest_bid ? JText::_('COM_DJCLASSIFIEDS_HIGHEST_BID') : JText::_('COM_DJCLASSIFIEDS_START_PRICE')).'">';
echo '<span class="auction_icon"></span>';
echo DJClassifiedsTheme::priceFormat($auction_price, $i->currency);
echo '</div>';
}
if($i->price_negotiable){
echo '<div class="row_negotiable">';
echo JText::_('COM_DJCLASSIFIEDS_PRICE_IS_NEGOTIABLE');
echo '</div>';
}
echo '</div>';
}
echo '</div>';
}
echo '</div>';
if($params->get('show_description')==1){
echo '<div class="desc">';
if($params->get('desc_source','0')==1){
echo $i->description;
}else{
if($params->get('desc_link')==1){
echo '<a href="'.$i->item_uri.'">';
}
$desc_c = $params->get('char_desc_nr',0);
if($desc_c && $i->intro_desc && mb_strlen($i->intro_desc) > $desc_c){
echo mb_substr($i->intro_desc, 0, $desc_c, 'UTF-8').'...';
}else{
echo $i->intro_desc;
}
if($params->get('desc_link')==1){
echo '</a>';
}
}
echo '</div>';
}
if($params->get('custom_fields',0)){
foreach($fields as $f){
if($f->item_id == $i->id) {
?>
<div class="row_<?php echo $f->name;?> row_custom_field <?php echo $f->class; ?>">
<span class="row_label"><?php echo JText::_($f->label); ?></span>
<span class="row_value">
<?php echo $f->value_conv; ?>
</span>
</div>
<?php }
}
}
echo '</div>';
?>
</div>
</div>
<?php if($params->get('items_dir','vertical') == 'horizontal'){ ?>
</div></div>
<?php } ?>
<?php } ?>
<?php if($slider){ ?>
<div style="clear: both"></div>
<?php } ?>
<?php if($params->get('items_dir','vertical') == 'vertical' || $slider){ ?>
</div></div>
<?php } ?>
</div>
</div>
<?php if($slider){ ?>
<div class="djcf_slider_right"> </div>
<?php } ?>
</div>
<style>
#mod_djclassifieds_items<?php echo $module->id; ?>.horizontal .items {
display: flex;
flex-wrap: wrap;
}
</style>