/** * Method to get the list * * @access public * @return array */ function getData(&$params) { global $mainframe; if (!class_exists('JoomleagueModelRanking')) { require_once JLG_PATH_SITE . '/models/ranking.php'; } $model = JLGModel::getInstance('project', 'JoomleagueModel'); $model->setProjectId($params->get('p')); $project = $model->getProject(); $ranking = JLGRanking::getInstance($project); $ranking->setProjectId($params->get('p')); $divisionid = explode(':', $params->get('division_id', 0)); $divisionid = $divisionid[0]; $res = $ranking->getRanking(null, null, $divisionid); $teams = $model->getTeamsIndexedByPtid(); $list = array(); foreach ($res as $ptid => $t) { $t->team = $teams[$ptid]; $list[] = $t; } if ($params->get('visible_team') != '') { $exParam = explode(':', $params->get('visible_team')); $list = modJLGRankingHelper::getShrinkedDataAroundOneTeam($list, $exParam[0], $params->get('limit', 5)); } $colors = array(); if ($params->get('show_rank_colors', 0)) { $mdlRanking = JLGModel::getInstance("Ranking", "JoomleagueModel"); $mdlRanking->setProjectid($params->get('p')); $config = $mdlRanking->getTemplateConfig("ranking"); $colors = $mdlRanking->getColors($config["colors"]); } return array('project' => $project, 'ranking' => $list, 'colors' => $colors); }
<?php /** * @version $Id: mod_joomleague_ranking.php 4905 2010-01-30 08:51:33Z and_one $ * @package Joomla * @subpackage Joomleague ranking module * @copyright Copyright (C) 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant to the * GNU General Public License, and as distributed it includes or is derivative * of works licensed under the GNU General Public License or other free or open * source software licenses. See COPYRIGHT.php for copyright notices and * details. */ //no direct access defined('_JEXEC') or die('Restricted access'); //get helper require_once dirname(__FILE__) . DS . 'helper.php'; require_once JPATH_SITE . DS . 'components' . DS . 'com_joomleague' . DS . 'joomleague.core.php'; $show_debug_info = JComponentHelper::getParams('com_joomleague')->get('show_debug_info', 0); $list = modJLGRankingHelper::getData($params); if ($show_debug_info) { echo 'this->mod_joomleague_ranking params<br /><pre>~' . print_r($params, true) . '~</pre><br />'; } $document = JFactory::getDocument(); //add css file $document->addStyleSheet(JURI::base() . 'modules/mod_joomleague_ranking/css/mod_joomleague_ranking.css'); require JModuleHelper::getLayoutPath('mod_joomleague_ranking');
if ($spanStyle != '') { echo '</span>'; } ?> </td> <?php foreach ($columns as $col) { ?> <td class="rankcolval"<?php if ($color != '') { echo $rowStyle; } ?> > <?php echo modJLGRankingHelper::getColValue(trim($col), $item); ?> </td> <?php } ?> </tr> <?php $k = 1 - $k; ?> <?php } ?> </tbody> </table>