echo '</td>'; echo "\n"; break; case 'LASTGAMES': echo '<td class="rankingrow lastgames"'; if ($color != '' && $config['use_background_row_color']) { echo 'style="background-color:' . $color . '"'; } echo '>'; foreach ($this->previousgames[$ptid] as $g) { $txt = $this->teams[$g->projectteam1_id]->name . ' [ ' . $g->team1_result . ' - ' . $g->team2_result . ' ] ' . $this->teams[$g->projectteam2_id]->name; $attribs = array('title' => $txt); if (!($img = JoomleagueHelperHtml::getThumbUpDownImg($g, $ptid, $attribs))) { continue; } switch (JoomleagueHelper::getTeamMatchResult($g, $ptid)) { case -1: $attr = array('class' => 'thumblost'); break; case 0: $attr = array('class' => 'thumbdraw'); break; case 1: $attr = array('class' => 'thumbwon'); break; } $url = JRoute::_(JoomleagueHelperRoute::getMatchReportRoute($g->project_slug, $g->slug)); echo JHTML::link($url, $img, $attr); } echo '</td>'; echo "\n";
/** * return thumb up/down image url if team won/loss * * @param object $game * @param int $projectteam_id * @param array attributes * @return string image html code */ public function getThumbUpDownImg($game, $projectteam_id, $attributes = null) { $res = JoomleagueHelper::getTeamMatchResult($game, $projectteam_id); if ($res === false) { return false; } if ($res == 0) { $img = 'media/com_joomleague/jl_images/draw.png'; $alt = JText::_('COM_JOOMLEAGUE_DRAW'); $title = $alt; } else { if ($res < 0) { $img = 'media/com_joomleague/jl_images/thumbs_down.png'; $alt = JText::_('COM_JOOMLEAGUE_LOST'); $title = $alt; } else { $img = 'media/com_joomleague/jl_images/thumbs_up.png'; $alt = JText::_('COM_JOOMLEAGUE_WON'); $title = $alt; } } // default title attribute, if not specified in passed attributes $def_attribs = array('title' => $title); if ($attributes) { $attributes = array_merge($def_attribs, $attributes); } else { $attributes = $def_attribs; } return JHTML::image($img, $alt, $attributes); }