Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.43 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package DJ-Reviews
  4.  * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
  5.  * @license http://www.gnu.org/licenses GNU/GPL
  6.  * @author url: http://dj-extensions.com
  7.  * @author email contact@dj-extensions.com
  8.  *
  9.  * DJ-Reviews is free software: you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation, either version 3 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * DJ-Reviews is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with DJ-Reviews. If not, see <http://www.gnu.org/licenses/>.
  21.  *
  22.  */
  23.  
  24. defined('_JEXEC') or die('Restricted access');
  25.  
  26. $db= JFactory::getDBO();
  27. $query = "SELECT * FROM #__djcf_types WHERE published=1";
  28. $db->setQuery($query);
  29. $types=$db->loadObjectList('id');          
  30.     foreach($types as $type){
  31.         $registry = new JRegistry();       
  32.         $registry->loadString($type->params);
  33.         $type->params = $registry->toObject();
  34.     }
  35. //echo '<pre>';print_r($types);die();      
  36. $anch = '#dj-classifieds';
  37. $par = JComponentHelper::getParams( 'com_djclassifieds' );
  38. $params_ = JComponentHelper::getParams( 'com_djreviews' );
  39. ?>
  40. <div class="djrv_listing row-striped mod_djreviews">
  41. <?php if (count($data)) {?>
  42.     <?php foreach ($data as $item) {
  43.         $i = $item->user_info;
  44.         $last_rew = $item->last_rev;
  45.         if ($item->name && $i->id) {
  46.         ?>
  47.         <div class="djrv_single_review row-fluid djrv_clearfix" style="margin-bottom: 25px;">
  48.             <div class="span3">
  49.                 <?php if (!empty($item->main_image->thumb_s)) {?>
  50.                     <img src="<?php echo $item->main_image->thumb_s; ?>" alt="<?php echo htmlspecialchars($item->name);?>" />
  51.                 <?php } ?>
  52.             </div>
  53.             <div class="span9">
  54.                 <div class="item_title">
  55.                     <?php
  56.                         echo '<h3>
  57.                                 <a class="title" href="'.DJClassifiedsSEO::getItemRoute($i->id.':'.$i->alias,$i->cat_id.':'.$i->c_alias,$i->region_id.':'.$i->r_name,$i->extra_cats).$anch.'" >'.$i->name.'</a>';
  58.                                 if(isset($types[$i->type_id])){
  59.                                     $type = $types[$i->type_id];
  60.                                     if($type->params->bt_class){
  61.                                         $bt_class = ' '.$type->params->bt_class;
  62.                                     }else{
  63.                                         $bt_class = '';
  64.                                     }
  65.                                     echo '<span class="item_type" style="text-align:center" >';
  66.                                     if($type->params->bt_use_styles){
  67.                                         $style='style="display:inline-block;
  68.                                                     border:'.(int)$type->params->bt_border_size.'px solid '.$type->params->bt_border_color.';'
  69.                                                             .'background:'.$type->params->bt_bg.';'
  70.                                                                     .'color:'.$type->params->bt_color.';'
  71.                                                                             .$type->params->bt_style.'"';
  72.                                         echo '<span class="type_button'.$bt_class.'" '.$style.' >'.$type->name.'</span>';
  73.                                     }else{
  74.                                         echo '<span class="type_label'.$bt_class.'" >'.$type->name.'</span>';
  75.                                     }
  76.                                     echo '</span>';
  77.                                     echo '<div class="item_category" style="font-size: 14px; font-weight: 300;">' .  $i->address . '</div>';
  78.                                 }
  79.                         echo '</h3>';
  80.    
  81.                     ?>
  82.                    
  83.                     <div class="djrv_rating small">
  84.                         <span class="djrv_stars">
  85.                         <?php /*for ($i = 1; $i <= 5; $i++) {?>
  86.                         <span class="djrv_star <?php if ($i <= $item->avg_rate || ($item->avg_rate - $i) >= -0.5) echo 'active';?>"></span>
  87.                         <?php }*/ ?>
  88.                             <span class="djrv_stars_sprite"><span class="djrv_stars_sprite_rating" style="width:<?php echo 100 * ($item->avg_rate / 5); ?>%;"></span></span>
  89.                             <span class="djrv_avg">
  90.                             <?php echo $item->avg_rate; ?>
  91.                             <?php echo '('.$item->review_count.')'; ?>
  92.                         </span>
  93.                         </span>
  94.                     </div>
  95.                     <div class="item_cat_region_outer">
  96.                         <?php if($par->get('column_category','1')){ ?>
  97.                             <?php $class='';
  98.                             if($par->get('column_category','1')=='2'){$class.=' hide_mobile';}
  99.                             else if($par->get('column_category','1')=='3'){$class.=' hide_tablet hide_mobile';} ?>
  100.                             <div class="item_category<?php echo $class;?>">
  101.                                 <?php echo '<a href="'.DJClassifiedsSEO::getCategoryRoute($i->cat_id.':'.$i->c_alias).'" >'.$i->c_name.'</a>'; ?>
  102.                             </div>
  103.                         <?php } ?>
  104.                         <?php if($par->get('column_category','1') && ($par->get('column_loc','1') && $par->get('show_regions','1'))){ ?>
  105.                             <span class="item_cat_region_separator"></span>
  106.                         <?php }?>      
  107.                     </div>
  108.                 <div class="clear_both"></div>                             
  109.             </div>
  110.             <?php if ($last_rew->user_login) {?>
  111.                 <div class="djrv_single_review row-fluid djrv_clearfix" style="margin-top: 10px">
  112.                     <div class="span2">
  113.                         <?php
  114.                             $iterUser = JFactory::getUser($last_rew->created_by);  
  115.                             $customFields = FieldsHelper::getFields('com_users.user', $iterUser, true);
  116.                             if ($customFields[0]->value) {
  117.                                 ?>
  118.                                 <div class="profile_img" style="width:50px!important"><?php echo $customFields[0]->value; ?></div>
  119.                             <?php } else {
  120.                                 $avatar = $params_->get('public_avatar');
  121.                                 $avatar = JUri::base(true).'/media/djreviews/avatars/'.$avatar;
  122.                             ?>
  123.                             <div class="profile_img" style="width:50px!important"><img alt="<?php echo $item->user_login; ?>" src="<?php echo $avatar; ?>" /></div>
  124.                             <?php
  125.                             }
  126.                         ?>
  127.                     </div>
  128.                     <div class="span10">
  129.                         <?php if ($last_rew->user_login) {?>
  130.                             <div class="djrv_post_info">
  131.                                 <div class="djrv_poster small">
  132.                                     <?php echo JText::sprintf('MOD_DJREVIEWS_POSTED_BY_ON', '<span itemprop="author">'.htmlspecialchars($last_rew->user_login).'</span>', JHtml::_('date', $last_rew->created, $params->get('date_format', 'd-m-Y H:i'))); ?>
  133.                                    
  134.                                 </div>
  135.                             </div>
  136.                         <?php } ?> 
  137.                         <?php if ($last_rew->title) {?>
  138.                             <div class="djrv_review_title">
  139.                                     <strong><a href="<?php echo JRoute::_($last_rew->object_url); ?>"><?php echo htmlspecialchars($item->title); ?></a></strong>
  140.                             </div>
  141.                         <?php } ?>
  142.                            
  143.                         <?php if ($last_rew->message) {?>
  144.                             <div class="djrv_review_message">
  145.                                 <div class="box">
  146.                                     <div>  
  147.                                         <p><?php
  148.                                             $str = mb_strimwidth($last_rew->message, 0, 150, "...");
  149.                                             echo nl2br($str);
  150.                                         ?></p>
  151.                                     </div>
  152.                                 </div>
  153.                             </div>
  154.                         <?php } ?>         
  155.                     </div>
  156.                 </div>
  157.             <?php } ?>
  158.         <?php } ?>
  159.     </div>
  160. </div>
  161.     <?php } ?>
  162. <?php }?>
  163. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement