Your IP : 216.73.216.224


Current Path : /var/www/html/plugins/community/jvldrev/
Upload File :
Current File : /var/www/html/plugins/community/jvldrev/jvldrev.php

<?php
/**
 * @version		$Id$
 * @package		JV-LinkDirectory
 * @subpackage	com_jvld
 * @copyright	Copyright 2008-2013 JV-Extensions. All rights reserved
 * @license		GNU General Public License version 3 or later
 * @author		JV-Extensions
 * @link		http://www.jv-extensions.com
 */

// No direct access
defined('_JEXEC') or die('Restricted access');

require_once(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_community'.DIRECTORY_SEPARATOR.'libraries'.DIRECTORY_SEPARATOR.'core.php');

if (!class_exists('plgCommunityJvldrev'))
{
    class plgCommunityJvldrev extends CApplications
    {
        var $name = "My Listing Reviews";
        var $_name = "mylistingrevs";

        function onProfileDisplay()
        {
			if (!defined('_JVLD_INSTALLED'))
				return '';

	        JvldPostinit::loadLanguageFile();

	        JvldPostinit::loadStyleSheet('style', _JVLD_LIVESITE.'plugins/community/jvldrev/jvldrev');

            $cfg = JvldCfg::getInstance();
            $cnt = (int)$this->params->get('jvldfav_cnt', 5);
            $pictype = (int)$this->params->get('jvldpictype', 2);

            $reviews = JvldCommunity::getLinkReviews(CFactory::getRequestUser()->id, $cnt);

            $html = '<div class="app-jvldrev">';
            if (count($reviews))
            {
                $rObj = JvldRatings::getInstance();

                foreach ($reviews as $review)
                {
	                $review->LREVIEW = nl2br(strip_tags($review->LREVIEW));

                    $lnk = JvldPostinit::getRoute("detailpageurl", $review->LID);
                    $title = '<a href="'.$lnk.'" title="'.htmlspecialchars($review->LTITLE).'">'.htmlspecialchars($review->LTITLE).'</a>';
	                $rating = ($rObj) ? $rObj->getRatingForComment($review->LRID) : 0;

                    $pictag = '';
                    switch ($pictype)
                    {
                        case 1:
                        {
                            if ($cfg->get('pgallery_en'))
                            {
                                $picarr = JvldPostinit::getRandomPhotoOfLink($review->LID, 'thumb');
                                if (count($picarr))
                                {
	                                if (JFile::exists(_JVLD_PHOTOS_ABSPATH . DIRECTORY_SEPARATOR . $picarr['pic']))
		                                $pictag = '<img src="' . JvldFrameworkHelper::getApprImage($picarr['pic'], _JVLD_PHOTOS_URLPATH) . '" border="0" align="left" style="margin-right: 8px;" alt="'.htmlspecialchars($picarr['title']).'"/>';
                                }
                            }
                            break;
                        }
                        case 2:
                        {
	                        $thumbObj = new JvldPreviewsCache($review->LID, $review->LURL, _JVLD_CONTEXT_INDEPENDENT, false);
	                        $pictag = $thumbObj->getPreview();

                            break;
                        }
                        default: break;
                    }

                    $html .= '<div class="row-fluid review">
                                  <div class="span12">
                                      <span class="revinfo">';

                    if ($pictag != '')
                    {
                        $html .= $pictag;
                    }

                    if ($rating)
                    {
                        $html .= JvldRatings::showStaticRating($rating);
                    }

                    if ($review->LREVTITLE != '')
                    {
	                    $html .= '        	<span class="title">'.htmlspecialchars($review->LREVTITLE).'</span>';
                    }

                    $html .= ' 			<span class="revtext">'.htmlspecialchars($review->LREVIEW).'</span>                                      
                                      </span>
                                      <span class="meta">'.JText::sprintf("COM_JVLD_REVIEW_META", htmlspecialchars($review->LREVON), $title).'</span>
                                  </div>
                              </div>';
                }
            }
            else
            {
                $html .= '    <p class="alert alert-warning">'.JText::_("COM_JVLD_LISTING_COMMENTS_NONE").'</p>';
            }

            $html .= '</div>';
            return $html;
        }
    }
}