/** * Method to get the list * * @access public * @return array */ function getData(&$params) { if (!class_exists('JoomleagueModelResults')) { require_once JLG_PATH_SITE . DS . 'models' . DS . 'results.php'; } $model =& JLGModel::getInstance('Results', 'JoomleagueModel'); $model->setProjectId($params->get('p')); $project =& $model->getProject(); switch ($params->get('round_selection', 0)) { case 0: // latest $roundid = modJLGResultsHelper::getLatestRoundId($project->id); break; case 1: // next $roundid = modJLGResultsHelper::getNextRoundId($project->id); break; case 2: //manual $roundid = (int) $params->get('id') ? (int) $params->get('id') : $model->getCurrentRound(); break; } if (!$roundid) { $roundid = $model->getCurrentRound(); } $model->set('divisionid', (int) $params->get('division_id')); $model->set('roundid', $roundid); $round = modJLGResultsHelper::getRound($project->id, $roundid); $matches = $model->getMatches(); uasort($matches, array('modJLGResultsHelper', '_cmpDate')); $matches = array_slice($matches, 0, $params->get('limit', 10)); $teams = $model->getTeamsIndexedByPtid(); return array('project' => $project, 'round' => $round, 'matches' => $matches, 'teams' => $teams); }