@Brain: er det dette:
- $database->setQuery( "SELECT *, IF(type='C','".JText::_('clans')."','".JText::_('singleplayer')."') AS `modename` FROM `#__mls_tournaments` WHERE `published`='1' AND `started`='1'" );
- $tournaments = $database->loadObjectList();
- $ret = array();
- $k = 0;
- for($i = 0; $i < count($tournaments); $i++) {
- $t = $tournaments[$i];
- if($t->type == "C") {
- $ids = implode(",",$userteams[1]);
- $where = " AND (m.clan1id IN (".$ids.") OR m.clan2id IN (".$ids."))";
- $my_ids = implode(",",$my_teams[1]);
- } else {
- $where =" AND (m.clan1id='".$userid."' OR m.clan2id='".$userid."')";
- $my_ids = $my->id;
- }
- if($userid OR ($t->type == "C" AND $teamid)) {
- $database->setQuery( "SELECT m.*,"
- ."\n t.name AS `tournamentname`, t.type AS `tournamenttype`,"
- ."\n s.name AS `seasonname`,"
- ."\n s.id AS `seasonid`,"
- ."\n IF(m.bracket='l',(m.roundnr+1)/2,m.roundnr) AS `roundnr_calc`,"
- ."\n IF(m.bracket='l','".JText::_('loser')."','".JText::_('winner')."') AS `bracketname`,"
- ."\n IF(t.type='C','".JText::_('clans')."','".JText::_('singleplayer')."') AS `modename`,"
- ."\n IF(m.clan1id IN (".$my_ids."),'1',IF(m.clan2id IN (".$my_ids."),'2',NULL)) AS `whoami`,"
- ."\n IF(m.clan1id IN (".$my_ids."),'2',IF(m.clan2id IN (".$my_ids."),'1',NULL)) AS `whoaminot`,"
- ."\n IF(m.clan1id='F','".JText::_('default_win')."',IF(t.type='P',u1.username,team1.name)) AS `player1_name`,"
- ."\n IF(m.clan2id='F','".JText::_('default_win')."',IF(t.type='P',u2.username,team2.name)) AS `player2_name`,"
- ."\n IF(m.clan1_result > m.clan2_result,clan1id,IF(m.clan1_result=m.clan2_result,NULL,clan2id)) AS `winner`,"
- ."\n IF(m.clan1_result > m.clan2_result,clan2id,IF(m.clan1_result=m.clan2_result,NULL,clan1id)) AS `loser`"
- ."\n FROM `#__mls_tournaments_matches` AS `m`"
- ."\n INNER JOIN `#__mls_tournaments` AS `t` ON t.id=m.tournamentid"
- ."\n INNER JOIN `#__mls_tournaments_seasons` AS `s` ON s.id=t.seasonid"
- ."\n LEFT JOIN `#__mls_teams` AS `team1` ON team1.id=m.clan1id"
- ."\n LEFT JOIN `#__mls_teams` AS `team2` ON team2.id=m.clan2id"
- ."\n LEFT JOIN `#__users` AS `u1` ON u1.id=m.clan1id"
- ."\n LEFT JOIN `#__users` AS `u2` ON u2.id=m.clan2id"
- ."\n WHERE m.tournamentid='".$t->id."' $where"
- ."\n ORDER BY roundnr_calc ASC, m.bracket ASC, m.matchnr ASC" );
- $matches = $database->loadObjectList();
-
- if(count($matches) > 0) {
- $ret[$k] = $t;
- $ret[$k]->matches = $database->loadObjectList();
- $k++;
- }
- }
- }
???
@person: det med
- for($i = count($t->matches) - 1; $i > -1; $i--) {
gav mig det samme output
Indlæg senest redigeret d. 11.04.2011 16:37 af Bruger #16544