function getTeams() { global $database; if (!isset($this->teams)) { $jTeam = new jTeam($database); $params = array('season_id' => $this->id); $jTeams = $jTeam->loadByParams($params); if (!is_array($jTeams)) { if ($jTeam->exists()) { $jTeams = array($jTeam); } else { $jTeams = array(); } } $this->teams = $jTeams; } return $this->teams; }
<?php defined('_JEXEC') or defined('_VALID_MOS') or die('Restricted Access'); /** * Website: www.jtips.com.au * @author Jeremy Roberts * @copyright Copyright © 2009, jTips * @license Commercial - See website for details * * @since 2.1 - 07/10/2008 * @version 2.1 * @package jTips * * Description: Load a JSON encoded array of teams */ global $database, $mosConfig_absolute_path; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jteam.class.php'; ob_clean(); if ($season_id = jTipsGetParam($_REQUEST, 'season_id', false)) { $params = array('season_id' => $season_id, 'order' => array('type' => 'order', 'by' => 'name', 'direction' => 'ASC')); $jTeam = new jTeam($database); $jTeams = forceArray($jTeam->loadByParams($params)); die(@json_encode($jTeams)); } else { die(json_encode(false)); }
$direction = jTipsGetParam($_REQUEST, 'filter_order_Dir', 'asc'); if (empty($direction)) { $direction = 'asc'; } $orderby = jTipsGetParam($_REQUEST, 'filter_order', 'name'); if (empty($orderby)) { $orderby = 'name'; } $parameters = array('order' => array('type' => 'order', 'direction' => $direction, 'by' => $orderby)); //has the season select been used? if ($season_id = jTipsGetParam($_REQUEST, 'season_id', false)) { $parameters['season_id'] = $season_id; } //jTipsDebug($params); //die(); $jTeams = forceArray($jTeam->loadByParams($parameters, $limit, $limitstart)); $pageNav = new mosPageNav($jTeam->getCount(), $limitstart, $limit); $data = array(); $i = 0; foreach ($jTeams as $team) { $data[$team->id] = array(makeListLink($team->name, $i++), $team->location, $team->getSeasonName(), $team->points); } //Build the Season filter dropdown $jSeason = new jSeason($database); $jSeasons = forceArray($jSeason->loadByParams()); $options = array(jTipsHTML::makeOption('', $jLang['_ADMIN_USERS_SELECT_SEASON'])); foreach ($jSeasons as $season) { $options[] = jTipsHTML::makeOption($season->id, $season->name); } $filters = array($jLang['_ADMIN_SEASON_SELECT'] => jTipsHTML::selectList($options, 'season_id', "id='season_id' class='inputbox' onChange='this.form.submit();'", 'value', 'text', jTipsGetParam($_REQUEST, 'season_id', ''))); jTipsAdminDisplay::ListView($formData, $header, $data, $pageNav, 'list', $filters);