$jTip = new jTip($database); $limitstart = jTipsGetParam($_REQUEST, 'limitstart', 0); $limit = jTipsGetParam($_REQUEST, 'limit', $jTips['NumMax']); $params = array('join' => array('type' => 'join', 'join_table' => '#__jtips_games', 'lhs_table' => '#__jtips_tips', 'lhs_key' => 'game_id', 'rhs_table' => '#__jtips_games', 'rhs_key' => 'id'), 'group' => array('type' => 'group', 'by' => 'round_id`, `user_id'), 'order' => array('type' => 'order', 'by' => 'round_id', 'direction' => 'DESC')); if ($user_id = jTipsGetParam($_REQUEST, 'user_id', false)) { $params['user_id'] = $user_id; } $jTipArray = forceArray($jTip->loadByParams($params, $limit, $limitstart)); unset($params['order']); $pageNav = new mosPageNav($jTip->getCount($params, true), $limitstart, $limit); $header = array('', 'User', 'Round', 'Season'); $data = array(); $i = 0; foreach ($jTipArray as $tip) { $tip->fillInAdditionalFields(); $data[$tip->id] = array(makeListLink($tip->user->getName(), $i++), $tip->round_num, $tip->season->name); } $jSeason = new jSeason($database); $jSeasons = forceArray($jSeason->loadByParams(array())); $seasons = objectsToSelectList($jSeasons, 'name'); $jTipsUser = new jTipsUser($database); $jTipsUsers = forceArray($jTipsUser->loadByParams(array())); foreach ($jTipsUsers as $u) { $u->name = $u->getName() . " (" . $seasons[$u->season_id] . ")"; $jTipsUsersArray[] = $u; } $users = objectsToSelectList($jTipsUsersArray, 'name'); asort($users); $formData = array('title' => $jLang['_ADMIN_DASH_TIPS_MANAGER'], 'editTask' => 'edit', 'module' => 'Tips', 'icon' => 'tips'); $filters = array($jLang['_ADMIN_USERS_SELECT'] => makeSelectList($users, 'user_id', "id='user_id' onChange='this.form.submit();'", jTipsGetParam($_REQUEST, 'user_id', '')), $jLang['_ADMIN_SEASON_SELECT'] => makeSelectList($seasons, 'season_id', "id='season_id' onChange='this.form.submit();'", jTipsGetParam($_REQUEST, 'season_id', ''))); jTipsAdminDisplay::ListView($formData, $header, $data, $pageNav, 'list', $filters);
$season_options = objectsToSelectList($jSeasons, 'name'); $filters = array('Select Season' => makeSelectList($season_options, 'season_id', "id='season_id' onChange='this.form.submit();'", $season_id)); //Load the Rounds if ($season_id) { $params = array('season_id' => $season_id); $jRound = new jRound($database); $jRounds = forceArray($jRound->loadByParams($params)); $round_options = objectsToSelectList($jRounds, 'round'); $filters['Select Round'] = makeSelectList($round_options, 'round_id', "id='round_id' onChange='this.form.submit();'", $round_id); } //Load the users if ($round_id and $season_id) { $params = array('season_id' => $season_id); $jTipsUser = new jTipsUser($database); $jTipsUsers = forceArray($jTipsUser->loadByParams($params)); $user_options = objectsToSelectList($jTipsUsers, 'getName', true); asort($user_options); $filters['Select User'] = makeSelectList($user_options, 'user_id', "id='user_id' onChange='this.form.submit();'", $user_id); } $tpl->selectLists = $filters; $data = array(); //Now we have the preliminary options, get the set of games if ($season_id and $round_id and $user_id) { $params = array('round_id' => $round_id); $jGame = new jGame($database); $jGames = forceArray($jGame->loadByParams($params)); foreach ($jGames as $game) { $params = array('game_id' => $game->id, 'user_id' => $user_id); $jTip = new jTip($database); $jTip->loadByParams($params); //jTipsDebug($jTip);