function display($hideColumns = array(), $showThisRound = true) { global $database, $jTips, $jLang, $mosConfig_live_site, $mainframe, $jTipsCurrentUser, $Itemid; if (empty($this->jTipsUser->id)) { echo ""; return; } ?> <style type="text/css"> @import url(<?php echo $mosConfig_live_site; ?> /templates/<?php echo jTipsGetTemplateName(); ?> /css/template.css); @import url(<?php echo $mosConfig_live_site; ?> /components/com_jtips/css/jtips-popup.css); </style> <script type='text/javascript' src='<?php echo $mosConfig_live_site; ?> /components/com_jtips/js/mootools.js'></script> <script type='text/javascript' src='<?php echo $mosConfig_live_site; ?> /components/com_jtips/js/Popup.js'></script> <?php $width = $jTips['ShowTipsWidth'] - 40; if ($jTips['ShowTipsPadding']) { ?> <div style="padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:10px;width:<?php echo $width; ?> px;text-align:center;"> <?php } ?> <h2 style='text-align:center;'><?php echo $this->jSeason->name; ?> <?php echo $jLang['_COM_SHOWTIPS_ROUND']; ?> <?php echo $this->jRound->round; ?> </h2> <?php if ($jTips['SocialIntegration'] and $showThisRound) { if ($jTips['SocialIntegration'] == 'cb') { $imgSrc = getCommunityBuilderAvatar($this->jTipsUser->user_id); $link = jTipsRoute("index.php?option=com_comprofiler&task=userProfile&user={$this->jTipsUser->user_id}"); } else { $imgSrc = getJomSocialAvatar($this->jTipsUser->user_id); $link = getJomSocialProfileLink($this->jTipsUser->user_id); } ?> <div style="text-align:center;"> <a href="javascript:void(0);" onClick="parent.location='<?php echo $link; ?> ';" title='View Profile' id='userLadderLink_<?php echo $this->jTipsUser->id; ?> '> <img src="<?php echo $imgSrc; ?> " border="0" alt="" /> </a> </div> <?php } if ($this->stats) { $this->showStats(); } //BUG 189 - Which order should the tips panel be shown in if ($this->jSeason->tips_layout == 'away') { $left = 'away'; $right = 'home'; } else { $left = 'home'; $right = 'away'; } ?> <table align='center' width='100%' border='0' cellspacing='0' style="padding-top:25px;"> <thead> <tr class="sectiontableheader"> <?php if (!in_array($left, $hideColumns)) { ?> <th class="sectiontableheader TB_th"><?php echo $jLang['_COM_GAME_' . strtoupper($left)]; ?> </th><?php } if (!in_array($right, $hideColumns)) { ?> <th class="sectiontableheader TB_th"><?php echo $jLang['_COM_GAME_' . strtoupper($right)]; ?> </th><?php } if (!in_array('tipped', $hideColumns)) { ?> <th class="sectiontableheader TB_th"><?php echo $jLang['_COM_DASH_TIPPED']; ?> </th><?php } if (!in_array('result', $hideColumns)) { ?> <th class="sectiontableheader TB_th"><?php echo $jLang['_COM_TIPS_RESULT']; ?> </th><?php } if (!in_array('more', $hideColumns)) { ?> <th class="sectiontableheader TB_th"><?php echo $jLang['_COM_TIPS_MORE']; ?> </th><?php } ?> </tr> </thead> <tbody> <?php $rowIndex = 0; $i = 1; $hasTipped = $this->jTipsUser->hasTipped($this->jRound->id); $byeTeams = array(); // Might want to list the byes somewhere later foreach ($this->jGames as $jGame) { $leftTeam = new jTeam($database); $left_id = $left . '_id'; //$leftTeam->load($jGame->$left_id); $rightTeam = new jTeam($database); $right_id = $right . '_id'; //$rightTeam->load($jGame->$right_id); // Skip games with byes $leftLoaded = $rightLoaded = false; if ($jGame->{$left_id}) { $leftTeam->load($jGame->{$left_id}); $leftLoaded = true; } if ($jGame->{$right_id}) { $rightTeam->load($jGame->{$right_id}); $rightLoaded = true; } if (!$leftLoaded and $rightLoaded) { $byeTeams[] = $rightTeam; } if ($leftLoaded and !$rightLoaded) { $byeTeams[] = $leftTeam; } if (!$leftLoaded or !$rightLoaded) { continue; } $jTip = new jTip($database); $jTipParams = array('user_id' => $this->jTipsUser->id, 'game_id' => $jGame->id); $jTip->loadByParams($jTipParams); $overlib_text = ""; if ($jTip->tip_id == $leftTeam->id) { $tipName = $leftTeam->getName(); $tip = $leftTeam->getDisplayLogoName(); $nonName = $rightTeam->getName(); } else { if ($jTip->tip_id == $rightTeam->id) { $tipName = $rightTeam->getName(); $tip = $rightTeam->getDisplayLogoName(); $nonName = $leftTeam->getName(); } else { if ($jTip->tip_id == -1) { $tip = $jLang['_COM_GAME_DRAW']; $tipName = $leftTeam->getName(); $nonName = $rightTeam->getName(); } else { $tip = $jLang['_ADMIN_CONF_NONE']; } } } if ($jGame->winner_id == $jTip->tip_id) { $result = "<img src='" . $mosConfig_live_site . "/administrator/images/tick.png' alt='Y' border='0' align='middle' />"; } else { $result = "<img src='" . $mosConfig_live_site . "/administrator/images/publish_x.png' alt='N' border='0' align='middle' />"; } $onClick = "onClick='toggleMore(" . $jGame->id . ", this)'"; $more = "<img src='{$mosConfig_live_site}/components/com_jtips/images/show.gif' alt='more' border='0' {$onClick} style='cursor:pointer;' />"; $rowIndex++; ?> <tr class="sectiontableentry<?php echo $i % 2 + 1; ?> " valign='middle'> <?php if (!in_array($left, $hideColumns)) { if ($jGame->winner_id == $leftTeam->id) { $style = "style='font-weight:bold;'"; } else { if ($jGame->winner_id == -1) { $style = "style='font-style:italic;'"; } else { $style = ''; } } ?> <td class="sectiontableentry<?php echo $i % 2 + 1; ?> " align="left" <?php echo $style; ?> ><?php echo $leftTeam->getDisplayLogoName(); ?> </td><?php } if (!in_array($right, $hideColumns)) { if ($jGame->winner_id == $rightTeam->id) { $style = "style='font-weight:bold;'"; } else { if ($jGame->winner_id == -1) { $style = "style='font-style:italic;'"; } else { $style = ''; } } ?> <td class="sectiontableentry<?php echo $i % 2 + 1; ?> " align="left" <?php echo $style; ?> ><?php echo $rightTeam->getDisplayLogoName(); ?> </td><?php } if (!in_array('tipped', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $i % 2 + 1; ?> " align="left"><?php echo $tip; ?> </td><?php } if (!in_array('result', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $i % 2 + 1; ?> " style='text-align:center;'><?php echo $result; ?> </td><?php } if (!in_array('more', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $i % 2 + 1; ?> " style='text-align:center;'><?php echo $more; ?> </td><?php } ?> </tr> <?php /* * Process the in-depth game analysis */ $left_score_field = $left . '_score'; $right_score_field = $right . '_score'; if ($jGame->winner_id == $leftTeam->id) { $winnerName = $leftTeam->getDisplayLogoName(); } else { if ($jGame->winner_id == $rightTeam->id) { $winnerName = $rightTeam->getDisplayLogoName(); } else { if ($jGame->winner_id == -1) { $winnerName = $jLang['_COM_GAME_DRAW']; } else { $winnerName = ''; } } } $gameTotal = 0; $tipWidth = 30; if (in_array('actual', $hideColumns)) { $tipWidth += 30; } if (in_array('awarded', $hideColumns)) { $tipWidth += 10; } ?> <tr> <td colspan="50" id="moreInfo<?php echo $jGame->id; ?> " style="display:none;"> <table width="100%" cellspacing="0"> <thead> <tr class="sectiontableheader"> <th class="sectiontableheader" width="30%"> </th> <th class="sectiontableheader" width="<?php echo $tipWidth; ?> %"><?php echo $jLang['_COM_SHOWTIPS_PREDICTED']; ?> </th> <?php if (!in_array('actual', $hideColumns)) { ?> <th class="sectiontableheader" width="30%"><?php echo $jLang['_COM_SHOWTIPS_ACTUAL']; ?> </th> <?php } if (!in_array('awarded', $hideColumns)) { ?> <th class="sectiontableheader" width="10%"><?php echo $jLang['_COM_SHOWTIPS_AWARDED']; ?> </th> <?php } ?> </tr> </thead> <tbody> <tr class="sectiontableentry1"> <th class="sectiontableentry1"><?php echo $jLang['_COM_DASH_TIPPED']; ?> </th> <td class="sectiontableentry1" align="left"><?php echo $tip; ?> </td> <?php if (!in_array('actual', $hideColumns)) { ?> <td class="sectiontableentry1" align="left"><?php echo $winnerName; ?> </td> <?php } if (!in_array('awarded', $hideColumns)) { ?> <td class="sectiontableentry1" style="text-align:right;"> <?php if ($hasTipped) { if ($jGame->winner_id == $jTip->tip_id) { // BUG 379 - Incorrect value displayed when draw correctly picked if ($jGame->winner_id == -1) { echo $this->jSeason->user_draw; $gameTotal += $this->jSeason->user_draw; } else { echo $this->jSeason->user_correct; $gameTotal += $this->jSeason->user_correct; } } else { echo '0'; } } else { //what were the default points here? if ($this->jSeason->user_none >= 0) { echo $this->jSeason->user_none; $gameTotal += $this->jSeason->user_none; } else { if ($this->jSeason->user_none == -1) { //holy crap! you got the lowest score equivalence! echo $jLang['_ADMIN_CONF_ACT_NA']; } else { if ($this->jSeason->user_none == -2) { //you got all the away teams if ($jGame->winner_id == $jGame->away_id) { echo $this->jSeason->user_correct; $gameTotal += $this->jSeason->user_correct; } else { echo '0'; } } } } } ?> </td> <?php } ?> </tr> <?php $subIndex = 1; if ($jGame->has_score) { ?> <tr class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "> <th class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $jLang['_COM_DASH_POINTS']; ?> </th> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $jTip->{$left_score_field} + 0; ?> - <?php echo $jTip->{$right_score_field} + 0; ?> </td> <?php if (!in_array('actual', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $jGame->{$left_score_field}; ?> - <?php echo $jGame->{$right_score_field}; ?> </td> <?php } if (!in_array('awarded', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> " style="text-align:right;"> <?php if ($jTip->{$left_score_field} == $jGame->{$left_score_field} and $jTip->{$right_score_field} == $jGame->{$right_score_field}) { echo $this->jSeason->user_pick_score; $gameTotal += $this->jSeason->user_pick_score; } else { echo '0'; } ?> </td> <?php } ?> </tr> <?php $subIndex++; } if ($jGame->has_margin) { ?> <tr class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "> <th class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $jLang['_COM_TIPS_MARGIN']; ?> </th> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $jTip->margin + 0; ?> </td> <?php if (!in_array('actual', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo abs($jGame->{$left_score_field} - $jGame->{$right_score_field}); ?> </td> <?php } if (!in_array('awarded', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> " style="text-align:right;"> <?php if ($jTip->margin == abs($jGame->{$left_score_field} - $jGame->{$right_score_field})) { echo $this->jSeason->user_pick_margin; $gameTotal += $this->jSeason->user_pick_margin; } else { echo '0'; } ?> </td> <?php } ?> </tr> <?php $subIndex++; } if ($jGame->has_bonus) { if ($jGame->bonus_id == $leftTeam->id) { $bonusTeam = $leftTeam->getDisplayLogoName(); } else { if ($jGame->bonus_id == $rightTeam->id) { $bonusTeam = $rightTeam->getDisplayLogoName(); } else { if ($jGame->bonus_id == -2) { $bonusTeam = 'Both Teams'; } else { $bonusTeam = ""; } } } if ($jTip->bonus_id == $leftTeam->id) { $bonusTip = $leftTeam->getDisplayLogoName(); } else { if ($jTip->bonus_id == $rightTeam->id) { $bonusTip = $rightTeam->getDisplayLogoName(); } else { if ($jTip->bonus_id == -2) { $bonusTip = 'Both Teams'; } else { $bonusTip = $jLang['_ADMIN_CONF_NONE']; } } } ?> <tr class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "> <th class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $jLang['_COM_SHOWTIPS_BONUS_TEAM']; ?> </th> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> " align="left"><?php echo $bonusTip; ?> </td> <?php if (!in_array('actual', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> "><?php echo $bonusTeam; ?> </td> <?php } if (!in_array('awarded', $hideColumns)) { ?> <td class="sectiontableentry<?php echo $subIndex % 2 + 1; ?> " style="text-align:right;"> <?php if ($jGame->bonus_id == $jTip->bonus_id) { echo $this->jSeason->user_pick_bonus; $gameTotal += $this->jSeason->user_pick_bonus; } else { echo '0'; } ?> </td> <?php } ?> </tr> <?php } ?> </tbody> <?php if (!in_array('awarded', $hideColumns)) { ?> <tfoot> <tr class="sectiontableheader"> <th class="sectiontableheader" colspan="3"><?php echo $jLang['_COM_SHOWTIPS_TOTAL']; ?> </th> <th class="sectiontableheader" style="text-align:right;"><?php echo $gameTotal; ?> </th> </tr> </tfoot> <?php } ?> </table> </td> </tr> <?php $i++; } ?> </tbody> </table> <?php /* * Do we have a comment to show */ $jComment = new jComment($database); $jCommentParams = array('user_id' => $this->jTipsUser->id, 'round_id' => $this->jRound->id); $jComment->loadByParams($jCommentParams); if (isset($jComment->comment) && !empty($jComment->comment)) { ?> <hr /> <p align="center"><?php echo jTipsStripslashes($jComment->comment); ?> </p> <?php } /* * Show the Peek into Next Round link be shown and parsed */ if ($jTips['EnableShowTips'] == 1 and $showThisRound) { //getCurrentUser $current_round_id = $this->jSeason->getCurrentRound(); $showFuture = false; if (isset($jTipsCurrentUser->id) and !empty($jTipsCurrentUser->id)) { if ($jTips['ShowTipsAccess'] == 'any' or $jTips['ShowTipsAccess'] == 'processed' and $jTipsCurrentUser->hasTipped($current_round_id) or $jTips['ShowTipsAccess'] == 'inprogress' and $this->jRound->getStatus() !== false) { $showFuture = true; } } else { if ($jTips['ShowTipsAccess'] == 'any') { $showFuture = true; } } if ($current_round_id != $this->jRound->id and $current_round_id and $showFuture) { $hide = array('result', 'actual', 'awarded'); $colsToHide = json_encode($hide); $data = "&season={$this->jSeason->id}&hide=" . rawurlencode($colsToHide); if ($Itemid) { $data .= "&Itemid={$Itemid}"; } if (isJoomla15()) { ?> <p align="center"><a href="<?php echo jTipsRoute("index2.php?option=com_jtips&view=CompetitionLadder&menu=0&action=ShowTips&uid=" . $this->jTipsUser->id . "&rid=" . $current_round_id . $data); ?> "><?php echo $jLang['_POPUP_TIPS_PEEK']; ?> </a></p> <?php } else { ?> <p align="center"><a href="javascript:loadTipsPopup(<?php echo $this->jTipsUser->id; ?> , <?php echo $current_round_id; ?> , $('mb_caption'), '<?php echo $data; ?> ');"><?php echo $jLang['_POPUP_TIPS_PEEK']; ?> </a></p> <?php } } } if ($jTips['ShowTipsPadding']) { echo "</div>"; } }
} if (isJoomla15()) { JHTML::_('behavior.modal'); } $render = new jTipsRenderTeamLadder(); $season_id = getSeasonID(); $jSeason = new jSeason($database); $jSeason->load($season_id); $render->assign('jSeason', $jSeason); $jTeams = $jSeason->getTeamLadder('points'); $render->assign('jTeams', $jTeams); $jSeasonParams = array('end_time' => array('type' => 'query', 'query' => "> '" . gmdate('Y-m-d') . "'"), 'start_time' => array('type' => 'query', 'query' => "< '" . gmdate('Y-m-d') . "'")); $jSeasons = $jSeason->loadByParams($jSeasonParams); $render->assign('jSeasons', $jSeasons); if (!jTipsGetParam($_REQUEST, 'menu', 1)) { echo "\n\t<style type='text/css'>\n\t@import url({$mosConfig_live_site}/templates/" . jTipsGetTemplateName() . "/css/template.css);\n\t@import url({$mosConfig_live_site}/components/com_jtips/css/jtips-popup.css);\n\t</style>"; if ($jTips['ShowTipsPadding']) { $width = $jTips['ShowTipsWidth'] - 40; echo '<div style="padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:10px;width:' . $width . 'px;text-align:center;">'; } } $render->display(); if (!jTipsGetParam($_REQUEST, 'menu', 1)) { if ($jTips['ShowTipsPadding']) { echo '</div>'; } if (!isJoomla15()) { die; } } //jtips_HTML::show_teamLadder($jTipsUser, $jSeason);
function display() { global $jTipsCurrentUser, $database, $mainframe, $mosConfig_absolute_path, $jLang, $jTips, $mosConfig_live_site; $width = $jTips['ShowTipsWidth'] - 40; ?> <style type="text/css"> @import url(<?php echo $mosConfig_live_site; ?> /templates/<?php echo jTipsGetTemplateName(); ?> /css/template.css); @import url(<?php echo $mosConfig_live_site; ?> /components/com_jtips/css/jtips-popup.css); </style> <?php if ($jTips['ShowTipsPadding']) { ?> <div style="float:left;padding-top:10px;padding-left:10px;padding-right:10px;padding-bottom:10px;width:<?php echo $width; ?> px;text-align:center;"> <?php } if (!empty($this->jTeam->url)) { ?> <div style="float:right;"> <a href="<?php echo $this->jTeam->url; ?> " target="_blank"><img src="images/M_images/weblink.png" align="absmiddle" border="0" alt="<?php echo $jLang['_COM_TEAM_HOME_PAGE']; ?> " title="<?php echo $this->jTeam->url; ?> " /></a> <a href="<?php echo $this->jTeam->url; ?> " target="_blank"><?php echo preg_replace('/.*[^\\/]:\\/+/i', '', $this->jTeam->url); ?> </a> </div> <?php } ?> <h1 align="left"><?php echo $this->jTeam->getName(); ?> </h1> <?php $img = ''; if (!empty($this->jTeam->logo) and jTipsFileExists($mosConfig_absolute_path . '/' . getJtipsImage($this->jTeam->logo, 100))) { $path = getJtipsImage($this->jTeam->logo, 100); $name = $this->jTeam->getName(); $img = "<img src='{$mosConfig_live_site}/{$path}' align='left' border='1' style='margin-right:10px;margin-bottom:10px;' alt='{$name}' />"; } $about = $img . jTipsStripslashes($this->jTeam->about); if (!empty($about)) { ?> <p style="padding-top:5px;" align="left"> <?php echo $about; ?> </p> <?php } ?> <div style="clear:both;"> </div> <h2 align="center" class="contentheading"><?php echo $jLang['_COM_TEAM_HISTORY']; ?> </h2> <table width="100%" border="0" cellspacing="0"> <thead> <tr class="sectiontableheader"> <th><?php echo $jLang['_COM_DASH_ROUND']; ?> </th> <th><?php echo $jLang['_ADMIN_ROUND_DATE']; ?> </th> <th><?php echo $jLang['_COM_TEAM_VS']; ?> </th> <th><?php echo $jLang['_ADMIN_TEAM_LOCATION']; ?> </th> <th><?php echo $jLang['_COM_SCORE']; ?> </th> <th><?php echo $jLang['_COM_TIPS_RESULT']; ?> </th> </tr> </thead> <tbody> <?php $rowIndex = 0; $history = $this->jTeam->getHistory(); foreach ($history as $game) { $other = new jTeam($database); if ($this->jTeam->id == $game->home_id) { $other->load($game->away_id); $location = $jLang['_COM_TEAM_HOME']; } else { $other->load($game->home_id); $location = $jLang['_COM_TEAM_AWAY']; } $isBye = false; if (!$other->id) { $isBye = true; } if ($game->winner_id == $this->jTeam->id) { $result = 'tick'; $alt = $jLang['_COM_TEAM_WIN']; } else { if ($game->winner_id == '-1') { $result = 'draw'; $alt = $jLang['_COM_TEAM_DRAW']; } else { $result = 'cross'; $alt = $jLang['_COM_TEAM_LOSS']; } } $date = TimeDate::toDisplayDate($game->start_time, true, false); $live_site = $mainframe->getCfg('live_site'); if (strrpos($live_site, '/') == strlen($live_site) - 1) { $live_site = substr($live_site, 0, -1); } $thisRowIndex = $rowIndex++; ?> <tr class="sectiontableentry<?php echo $thisRowIndex % 2 + 1; ?> jtablerow<?php echo $thisRowIndex % 2 + 1; ?> "> <td align="center"><?php echo $game->round; ?> .</td> <td align="left"><?php echo $date; ?> </td> <td align="left"><?php echo $isBye ? '<em>' . $jLang['_COM_BYE'] . '</em>' : $other->getDisplayLogoName(); ?> </td> <td align="center"><?php echo $isBye ? ' ' : $location; ?> </td> <td align="center"><?php echo $isBye ? ' ' : $game->home_score . ' - ' . $game->away_score; ?> </td> <td align="center"><img src="<?php echo $mosConfig_live_site; ?> /components/com_jtips/images/<?php echo $result; ?> .png" alt="<?php echo $alt; ?> " title="<?php echo $alt; ?> " border="0" /></td> </tr> <?php } ?> </tbody> </table> <?php if ($jTips['ShowTipsPadding']) { echo "</div>"; } }