Your IP : 10.10.0.253


Current Path : /var/www/modules/mod_top_extravote/tmpl/
Upload File :
Current File : /var/www/modules/mod_top_extravote/tmpl/default.php

<?php
/*------------------------------------------------------------------------
# mod_top_extravote
# ------------------------------------------------------------------------
# author    ecolora
# copyright Copyright (C) 2012 ecolora.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.ecolora.com
# Technical Support:  Forum - http://www.ecolora.com/index.php/component/kunena/top-extravote
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die('Restricted access');
$show_hits = $params->get('show_hits',2);
$hitstring = $params->get('hitstring','');
$show_stars = $params->get('show_stars',1);
$show_introtext = $params->get('show_introtext',0);
$show_fulltext = $params->get('show_fulltext',0);
$lnk = $params->get('lnk',1);
$count = count($list); //больше чем всего есть материалов выводить не имеет смысла
$cols = intval($params->get('cols', 1));
if ($cols < 1) $cols = 1;
$il = 0;
$ic = 0; //внутри столбца

$document->addStyleSheet(JURI::root(true).'/plugins/content/extravote/assets/extravote.css');
$document->addStyleSheet(JURI::root(true).'/modules/mod_top_extravote/css/top_extravote.css');

$itemcount = floor($count/$cols); //количество итемов в одном столбце
if (($itemcount == 0) || ($itemcount*$cols < $count)) $itemcount++; //если недобрали, то +1
$colwidth=floor(100/$cols); //ширина столбца
?>
<div class="top_extravote">
<div class="top_extravote_col" style="width: <?php echo $colwidth; ?>%;">
<?php foreach ($list as $item) : ?>
 		<?php
        	$il++;
        	$ic++;
            if ($ic > $itemcount) { //закрываем столбец
            	$ic = 1;
            	echo '</div><div class="top_extravote_col" style="width: '.$colwidth.'%;">';
            }
            echo '<div class="top_extravote_item">';
			if (trim($hitstring) == '') { //не задали
                   $hstring = "(&nbsp;".$item->hits.'&nbsp;';
                   if($item->hits!=1)
                    $hstring .= JTEXT::_('MOD_TOP_EXTRAVOTE_VOTES');
                     else $hstring .= JTEXT::_('MOD_TOP_EXTRAVOTE_VOTE');
                    $hstring .="&nbsp;)";
            }
            else $hstring = '('.$item->hits.' '.$hitstring.')';
			switch ($show_hits){
				case '1':{
						?>
						<div class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
                        <?php echo $hstring.' ';  ?>
						 <a href="<?php echo $item->link; ?>" class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
						<?php echo $item->text;
						?></a>
						</div>
						<?php
						break;
						}
				case '2':{
						?>
						<div class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
						 <a href="<?php echo $item->link; ?>" class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
						<?php echo $item->text;
						?></a>
						<?php echo ' '.$hstring;  ?>
						</div>
						<?php
						break;
						}
				default:{
						?>
						<div class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
						 <a href="<?php echo $item->link; ?>" class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
						<?php echo $item->text;
						?></a></div><?php
						}
				}
            if ($show_introtext) {
             ?>
  			 <div class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
			 <?php echo $item->displayIntrotext; ?>
			 </div>
			 <?php
			}

            if ($show_fulltext) {
             ?>
  			 <div class="mostvotedext<?php echo $params->get('moduleclass_sfx'); ?>">
			 <?php echo $item->fulltext; ?>
			 </div>
			 <?php
			}

			if ($show_stars) {
			   if($item->hits!=0) {
			      $percent = number_format((intval($item->sum) / intval( $item->hits ))*20,2);
			      $rating  = number_format(($item->sum / intval( $item->hits )),2);
		       }
		       $modTopExtravoteHelper = new modTopExtravoteHelper();
               if ($modTopExtravoteHelper->ext_isJoomla('1.6', '>=')) {
               	$spans = '';
                for ($i=0,$j=5/10; $i<10; $i++,$j+=5/10) {
		      	  $spans .= "<span class=\"extravote-star\"><a href=\"".((($il==count($list)) && ($j == 5/10)&&($lnk))?'http://www.ecolora.com" rel="nothing':$item->link)."\" title=\"".JTEXT::_('MOD_TOP_EXTRAVOTE_RATING')." ".$rating."\" class=\"ev-".($j*10)."-stars\">".((($il==count($list)) && ($j == 5/10)&&($lnk))?"e":"1")."</a></span>";
                }

  	 	        echo "<div class=\"extravote\">
                <span class=\"extravote-stars\">
                <span id=\"rating_".$item->id."_0\" class=\"current-rating\" style=\"width:".(int)($rating*20)."%;\"></span>"
             	.$spans."
                </span>
                </div>";
               } else {
               	echo "<div class=\"extravote-container-small\" style=\"margin-top:5px;\">
                 <ul class=\"extravote-stars-small\">
                 <li id=\"rating_".$item->id."_x\" class=\"current-rating\" style=\"width:".(int)$percent."%;\"></li>
                 <li><a href=\"".(($il==count($list)&&($lnk))?'http://www.ecolora.com" rel="nothing':$item->link)."\" title=\"".$rating."\" class=\"ev-one-star\">".(($il==count($list)&&($lnk))?"e":"1")."</a></li>
                 <li><a href=\"".$item->link."\" title=\"".$rating."\" class=\"ev-two-stars\">2</a></li>
                 <li><a href=\"".$item->link."\" title=\"".$rating."\" class=\"ev-three-stars\">3</a></li>
                 <li><a href=\"".$item->link."\" title=\"".$rating."\" class=\"ev-four-stars\">4</a></li>
                 <li><a href=\"".$item->link."\" title=\"".$rating."\" class=\"ev-five-stars\">5</a></li>
                 </ul>
                 </div>";
               }
			}
			echo '</div>';
	?>
<?php endforeach; ?>
</div>
</div>