function display() { global $jLang; if (isJoomla15()) { JToolbarHelper::title($jLang['_ADMIN_EDIT_CUSTOMISATIONS_TITLE'], 'customisations'); } else { ?> <table class='adminheading'> <tr><th><?php echo $jLang['_ADMIN_EDIT_CUSTOMISATIONS_TITLE']; ?> </th></tr> </table> <?php } ?> <form action="index2.php?option=com_jtips" method="POST" name="adminForm" enctype="multipart/form-data"> <input type="hidden" name="task" value="" /> <input type="hidden" name="module" value="Customisations" /> <input type="hidden" name="path" value="<?php echo $this->path; ?> " /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <?php if (!$this->path) { $this->displayFileSetup(); } ?> <fieldset> <legend><?php echo $jLang['_ADMIN_CSTM_FILE_EDIT']; ?> </legend> <table class='adminform'> <thead> <tr> <th><?php echo $this->path; ?> </th> </tr> </thead> <tbody> <tr> <td><textarea style="width:100%;height:500px" cols="110" rows="25" name="filecontent" id="filecontent" class="inputbox"><?php echo $this->content; ?> </textarea></td> </tr> </tbody> </table> </fieldset> </form> <?php }
static function _log($item, $prepend = "") { global $jTips, $mosConfig_absolute_path; $file_path = $mosConfig_absolute_path . "/components/com_jtips/jtips.log"; $level = empty($prepend) ? 'INFO' : strtoupper($prepend); if (isset($jTips['DebugLevel']) and !in_array($level, $jTips['DebugLevel'])) { return true; } if (isJoomla15()) { jimport('joomla.filesystem.file'); if (JFile::exists($file_path)) { $size = filesize($file_path); $human = round($size / (1024 * 1024), 4); if ($human >= 10) { if (JFile::exists($file_path . ".0")) { JFile::delete($file_path . ".0"); } JFile::move($file_path, $file_path . ".0"); } } } else { if (file_exists($file_path)) { $size = filesize($file_path); $human = round($size / (1024 * 1024), 4); if ($human >= 10) { if (file_exists($file_path . ".0")) { @unlink($file_path . ".0"); } @rename($file_path, $file_path . ".0"); } } } if (!empty($prepend) and is_string($prepend)) { $prepend .= " "; } $log = "jLOG " . gmdate('Y-m-d H:i:s') . ": " . $prepend . stripslashes(print_r($item, true)) . "\n"; if (isJoomla15()) { $data = ''; if (JFile::exists($file_path)) { $data = JFile::read($file_path); $data .= $log; } return JFile::write($file_path, $data); } else { if (!($handle = fopen($file_path, 'a'))) { jTipsLogger::jTipsDebug("FAILED TO OPEN LOG FILE!", false); } else { if (fwrite($handle, $log) === false) { jTipsLogger::jTipsDebug("FAILED TO WRITE TO LOG FILE!", false); return false; } return fclose($handle); } } }
/** * Display the page title and set the document title based on parameters * // BUG 349 - support for Page Title menu item parameter option * * @since 2.1.10 */ function title() { global $mainframe, $jTips; $view = jTipsGetParam($_REQUEST, 'view', 'Dashboard'); $default_title = jTipsGetParam($jTips['Menu'], $view, 'jTips'); if (isJoomla15()) { $document =& JFactory::getDocument(); $params =& $mainframe->getParams(); // Page Title $menus =& JSite::getMenu(); $menu = $menus->getActive(); if (is_object($menu)) { $menu_params = new JParameter($menu->params); if (!$menu_params->get('page_title')) { $params->set('page_title', JText::_($default_title)); } } else { $params->set('page_title', JText::_($default_title)); } $document->setTitle($params->get('page_title')); if ($params->def('show_page_title', 0)) { ?> <div class="componentheading<?php echo $params->get('pageclass_sfx'); ?> "> <?php echo html_entity_decode(stripslashes($params->get('page_title'))); ?> </div> <?php } } else { $mainframe->setPageTitle($default_title); if (!empty($jTips['Title'])) { ?> <h1 class='componentheading jmain_heading'><?php echo $jTips['Title']; ?> </h1> <?php } } }
function display() { global $Itemid, $database, $mainframe, $jTips, $jLang, $mosConfig_live_site, $jTipsCurrentUser; $mosConfig_offset = $mainframe->getCfg('offset'); $postURL = jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}"); ?> <script type='text/javascript'> function getTeamLadder(obj) { document.getElementById('season_id').value = obj.options[obj.selectedIndex].value; document.ladderForm.submit(); //window.location.href='index.php?option=com_jtips&Itemid=<?php echo $Itemid; ?> &task=teams&season=' + id; } </script> <form action="<?php echo $postURL; ?> " method="post" name="ladderForm"> <input type="hidden" name="option" value="com_jtips" /> <input type="hidden" name="task" value="TeamLadder" /> <input type="hidden" name="season" id="season_id" /> <?php if (jTipsGetParam($_REQUEST, 'menu', 1)) { //jtips_HTML::seasonsList($jTipsCurrentUser, $this->jSeasons, "onchange='getTeamLadder(this);'", false, $this->jSeason->id); } ?> <table width='100%' cellspacing="0"> <thead> <?php ?> <tr class='sectiontableheader jtableheader'> <th class="jtips_team_ladder_header">#</th> <th class="jtips_team_ladder_header"> </th> <th class="jtips_team_ladder_header"><?php echo $jLang['_COM_TLD_TEAM']; ?> </th> <?php if (!empty($jTips['TeamLadderColumns'])) { foreach ($jTips['TeamLadderColumns'] as $field) { $lang_key = "_COM_TLD_ABR_" . strtoupper($field); ?> <th style="text-align:center" width="5" class="jtips_team_ladder_header"><?php echo $jLang[$lang_key]; ?> </th> <?php } } ?> </tr> <?php ?> </thead> <tbody> <?php $i = 1; $rowIndex = 0; $noteams = true; if (count($this->jTeams) > 0) { foreach ($this->jTeams as $jTeam) { $extra = ""; $thisRowIndex = $rowIndex++; ?> <tr class='sectiontableentry<?php echo $thisRowIndex % 2 + 1; ?> jtablerow<?php echo $thisRowIndex % 2 + 1; ?> '> <td style='text-align:center'><?php echo $i; ?> </td> <td style='text-align:center'> <?php $img = $jTeam->getLogo(); // if (jTipsFileExists(getJtipsImage($jTeam->logo))) { // $img .= "<img src='" .$mainframe->getCfg('live_site'); // if (!empty($jTips['SubDirectory'])) { // $img .= $jTips['SubDirectory']; // } // $img .= "/" .getJtipsImage($jTeam->logo). "' alt=' ' border='0' />"; // } if (empty($img)) { $img .= " "; } echo $img; ?> </td> <?php $popupUrl = "view=TeamLadder&Itemid={$Itemid}&action=ShowTeam&id=" . $jTeam->id; if (jTipsGetParam($_REQUEST, 'menu', 0) or !jTipsGetParam($_REQUEST, 'tmpl', false)) { if (isJoomla15()) { /*$x = $jTips['ShowTipsWidth']; $y = $jTips['ShowTipsHeight']; //BUG 274 - team ladder popup results in broken scroll bar if (basename($_SERVER['SCRIPT_FILENAME']) != 'index2.php') { $class = "class='modal'"; } else { $class = ''; } $teamname = "<a $class rel=\"{handler: 'iframe', size: {x: $x, y: $y}}\" href='" .jTipsRoute($mosConfig_live_site. "/index2.php?option=com_jtips&$popupUrl&menu=0"). "'>" .$jTeam->getName(). "</a>"; */ // better popup handling in J1.5 JHTML::_('behavior.modal'); $rel = json_encode(array('handler' => 'iframe', 'size' => array('x' => $jTips['ShowTipsWidth'], 'y' => $jTips['ShowTipsHeight']))); $url = jTipsRoute("index.php?option=com_jtips&tmpl=component&{$popupUrl}&menu=0"); $attribs = array('class' => 'modal', 'rel' => str_replace('"', "'", $rel), 'title' => $jTeam->getName()); $teamname = JHTML::link($url, $jTeam->getName(), $attribs); } else { $teamname = "<a href='javascript:void(0);' onClick='openPopup(\"{$popupUrl}\", \"" . $jTeam->getName() . "\");'>" . $jTeam->getName() . "</a>"; } } else { $teamname = $jTeam->getName(); } ?> <td align="left"><?php echo $teamname; ?> </td> <?php if (!empty($jTips['TeamLadderColumns'])) { foreach ($jTips['TeamLadderColumns'] as $field) { ?> <td style='text-align:center'><?php echo $jTeam->getTeamField($field); ?> </td> <?php } } ?> </tr> <?php $i++; } } else { ?> <tr> <td style='text-align:center' colspan='20'><?php echo $jLang['_COM_TEAMS_UNAVAILABLE']; ?> </td> </tr> <?php } $rowIndex = 0; ?> </tbody> </table> <table align='right' cellspacing="0"> <thead id="teamLegendHeader"> <tr> <th colspan='2' class='sectiontableheader'><?php echo $jLang['_COM_TLD_LEGEND']; ?> </th> </tr> </thead> <tbody id='teamLegend'> <?php if (!empty($jTips['TeamLadderColumns'])) { foreach ($jTips['TeamLadderColumns'] as $field) { $lang_key = "_COM_TLD_" . strtoupper($field); $abr_key = "_COM_TLD_ABR_" . strtoupper($field); $thisRowIndex = $rowIndex++; ?> <tr class='sectiontableentry<?php echo $thisRowIndex % 2 + 1; ?> jtablerow<?php echo $thisRowIndex % 2 + 1; ?> '> <td style='text-align:center;font-weight:bold;'><?php echo $jLang[$abr_key]; ?> </td> <td style='text-align:left'><?php echo $jLang[$lang_key]; ?> </td> </tr> <?php } } ?> </tbody> </table> <?php if ($jTips['JsLadder'] != 'none') { ?> <script type='text/javascript'> window.addEvent('domready', function() { var teamLegend = new Fx.Slide('teamLegend', { duration:<?php echo $jTips['JsLadderDuration'] * 1000; ?> , wait: true, <?php if ($jTips['JsLadder'] == 'linear') { echo "transition: Fx.Transitions.linear"; } else { ?> transition: Fx.Transitions.<?php echo $jTips['JsLadder']; ?> .<?php echo $jTips['JsLadderStyle']; ?> <?php } ?> }); teamLegend.hide(); $('teamLegendHeader').addEvent('click', function(e){ e = new Event(e); teamLegend.toggle(); e.stop(); }); $('teamLegendHeader').setStyle('cursor', 'pointer'); }); </script> <?php } ?> </form> <?php }
function display() { global $jLang; ?> <form action='index2.php' method='post' name='adminForm' enctype='multipart/form-data'> <input type='hidden' name='task' value='' /> <input type='hidden' name='option' value='<?php echo jTipsGetParam($_REQUEST, 'options', 'com_jtips'); ?> ' /> <input type='hidden' name='hidemainmenu' value='0' /> <input type='hidden' name='module' value='Configuration' /> <input type='hidden' name='<?php echo jTipsSpoofValue(); ?> ' value='1' /> <?php if (isJoomla15()) { JToolbarHelper::title($jLang['_ADMIN_CONF_TITLE'] . " - " . getVersionNum(), 'config'); } else { ?> <table class='adminheading'> <tr><th><?php echo $jLang['_ADMIN_CONF_TITLE'] . " - " . getVersionNum(); ?> </th></tr> </table> <?php } ?> <div style='width: 100%;'> <?php $tabs = new jTipsTabs(1); $tabs->startPane('dashboard'); foreach ($this->configuration as $tab => $items) { $tabs->startTab(ucwords($tab), $tab); ?> <table class='adminlist'> <thead> <tr> <th align='left' width='20%'><?php echo $jLang['_ADMIN_CONF_SETTING']; ?> </th> <th align='left' width='20%'><?php echo $jLang['_ADMIN_CONF_VARIABLE']; ?> </th> <th align='left'><?php echo $jLang['_ADMIN_CONF_DESCRIPTION']; ?> </th> </tr> </thead> <tbody> <?php $i = 0; foreach ($items as $key => $val) { if (isset($val['versions']) and !empty($val['versions'])) { continue; } else { if (isset($val['type']) and !empty($val['type'])) { $label = (isset($val['label']) and !empty($val['label']) and isset($jLang[$val['label']]) and !empty($jLang[$val['label']])) ? $val['label'] : ''; if (isset($val['definition']) and !empty($val['definition']) and isset($jLang[$val['definition']]) and !empty($jLang[$val['definition']])) { $definition = $jLang[$val['definition']]; } else { $definition = ' '; } ?> <tr class='row<?php echo $i % 2; ?> '> <td><?php if (isset($jLang[$label]) and !empty($jLang[$label])) { echo $jLang[$label]; } else { echo " "; } ?> </td> <td><?php echo makeConfigItem($key, $val); ?> </td> <td><?php echo $definition; ?> </td> </tr> <?php } } $i++; } ?> </tbody> </table> <?php $tabs->endTab(); } $tabs->endPane(); ?> </div> </form> <?php }
/** * Website: www.jtips.com.au * @author Jeremy Roberts * @copyright Copyright © 2009, jTips * @license Commercial - See website for details * * @since 2.1 - 09/10/2008 * @version 2.1 * @package jTips * * Description: Delete the current import file */ jTipsSpoofCheck(); global $jLang, $mosConfig_absolute_path; $file = $mosConfig_absolute_path . '/administrator/components/com_jtips/import.csv'; if (isJoomla15()) { jimport('joomla.filesystem.file'); if (JFile::exists($file)) { if (JFile::delete($file)) { $message = $jLang['_ADMIN_FILE_DELETED']; } else { $message = $jLang['_ADMIN_FILE_DELETE_FAILED']; } } else { $message = $jLang['_ADMIN_FILE_DELETE_NOFILE']; } } else { if (file_exists($file)) { if (unlink($file)) { $message = $jLang['_ADMIN_FILE_DELETED']; } else {
require_once $mosConfig_absolute_path . '/components/com_jtips/custom/views/TeamLadder/ShowTeamRender.ext.php'; } else { require_once $mosConfig_absolute_path . '/components/com_jtips/views/TeamLadder/ShowTeamRender.php'; } if (!isJoomla15()) { //Trash anything we have so far ob_clean(); ob_start(); } $render = new jTipsRenderShowTeam(); $id = jTipsGetParam($_REQUEST, 'id', ''); $jTeam = new jTeam($database); $jTeam->load($id); $render->assign('jTeam', $jTeam); $jSeason = new jSeason($database); $jSeason->load($jTeam->season_id); $render->assign('jSeason', $jSeason); $render->display(); if (!isJoomla15()) { die; } /* $my = $mainframe->getUser(); $jTipsUser = new jTipsUser($database); $jTipsUserParams = array( 'user_id' => $my->id, 'season_id' => $jTeam->season_id ); $jTipsUser = $jTipsUser->loadByParams($jTipsUserParams); */ //sjtips_HTML::show_team($jTeam, $jSeason, $jTipsUser);
/** * Take data assigned in $data and display it */ function display() { global $jTipsCurrentUser, $mainframe, $database, $jLang, $jTips, $mosConfig_live_site; $mosConfig_offset = $mainframe->getCfg('offset'); //$Itemid = jTipsGetParam($_REQUEST, 'Itemid', ''); global $Itemid; //$mainframe->setPageTitle(getComponentName($Itemid).' > '.$jTips['Menu']['Tips']); //jTipsCommonHTML::loadOverlib(); $useJs = false; if ($jTips['JsLadder'] != 'none') { $useJs = true; } if ($jTips['EnableComments'] == 1 and $jTips['EnableCommentFilter'] == 1) { $checkComment = "onclick='return validateComment(\"comment\");'"; } else { $checkComment = "onClick='document.tips_form.submit();'"; } //jtips_HTML::buildMenu('tips', $this->jSeason, $this->jTipsUser); //jtips_HTML::seasonsList($this->jTipsUser, $this->jSeasons, "onchange='getSeason(this);'", true, jTipsGetParam($_REQUEST, 'season', jTipsGetParam($_REQUEST, 'season_id', false))); $postURL = jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}"); ?> <script type='text/javascript'> function getSeason(obj) { var id = obj.options[obj.selectedIndex].value; return window.location.href='<?php echo html_entity_decode(jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}&task=Tips&season=")); ?> ' + id; } </script> <form action='<?php echo $postURL; ?> ' method='post' name='tips_form' id='tips_form'> <input type='hidden' name='option' value='com_jtips' /> <input type='hidden' name='view' value='Tips' /> <input type="hidden" name="action" value="save" /> <input type='hidden' name='user_id' value='<?php echo $jTipsCurrentUser->id; ?> ' /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <h2 class="contentheading jmain_heading"><?php echo $this->jSeason->name; ?> </h2> <h3 align="center"> <?php if ($this->jRound->getPrev()) { ?> <a style="font-size:smaller;" href='<?php echo jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}&view=Tips&rid=" . $this->jRound->getPrev()); ?> '>« <?php echo $jLang['_COM_PREV_ROUND']; ?> </a> <?php } echo " " . $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round . " "; if ($this->jRound->getNext()) { ?> <a style="font-size:smaller;" href='<?php echo jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}&view=Tips&rid=" . $this->jRound->getNext()); ?> '><?php echo $jLang['_COM_NEXT_ROUND']; ?> »</a> <?php } ?> </h3> <?php if ($this->jRound->exists()) { $jGameParams = array('round_id' => $this->jRound->id, 'order' => array('type' => 'order', 'by' => 'position', 'direction' => 'ASC')); $jGame = new jGame($database); $jGames = forceArray($jGame->loadByParams($jGameParams)); $tags = "class='sectiontableheader jtableheader'"; ?> <table width="100%" cellspacing="0"> <thead> <tr class="sectiontableheader"> <th <?php echo $tags; ?> width="33%"><?php echo $jLang['_COM_TIPS_TIPPING_CLOSE']; ?> </th> <?php if ($jTips['ShowJSCountdown'] == 1) { ?> <th <?php echo $tags; ?> width="34%"><?php echo $jLang['_COM_TIPS_TIME_TO_CLOSE']; ?> </th> <?php } ?> <th <?php echo $tags; ?> width="33%"><?php echo $jLang['_COM_TIPS_LASTUP']; ?> </th> </tr> </thead> <tbody> <tr class="sectiontableentry1"> <td style="text-align:center;"> <?php //BUG 136 - show closed/closes depending on start time echo TimeDate::toDisplayDateTime($this->jRound->start_time, false); ?> </td> <?php if ($jTips['ShowJSCountdown'] == 1) { ?> <td><div id='countdown' style="text-align:center;" class="highlight"><?php echo $jLang['_COM_CLOSED']; ?> </div></td> <?php } $jTipParams = array('game_id' => array('type' => 'reference', 'query' => "SELECT DISTINCT id FROM #__jtips_games WHERE round_id = " . $this->jRound->id), 'user_id' => $jTipsCurrentUser->id); $jTip = new jTip($database); $jTipss = forceArray($jTip->loadByParams($jTipParams)); ?> <td><?php if (count($jTipss) > 0) { echo TimeDate::toDisplayDateTime($jTipss[0]->updated, false); } else { echo " "; } ?> </td> </tr> </tbody> </table> <?php if (jTipsGetParam($jTips, 'TeamLadderPopup', 0)) { $url = "view=TeamLadder&Itemid={$Itemid}&menu=0"; ?> <p style="text-align:center;font-weight:bold;"><?php if (isJoomla15()) { /*?> <a class="modal" rel="{handler: 'iframe', size: {x: <?php echo $jTips['ShowTipsWidth']; ?>, y: <?php echo $jTips['ShowTipsHeight']; ?>}}" href="<?php echo jTipsRoute("index2.php?option=com_jtips&" .$url); ?>" title='Team Ladder'><?php echo $jLang['_COM_TIPS_SHOWHIDE']; ?></a> <?php*/ // better popup handling in J1.5 JHTML::_('behavior.modal'); $rel = json_encode(array('size' => array('x' => $jTips['ShowTipsWidth'], 'y' => $jTips['ShowTipsHeight']))); $url = jTipsRoute("index.php?option=com_jtips&tmpl=component&" . $url); $attribs = array('class' => 'modal', 'rel' => str_replace('"', "'", $rel), 'title' => $jLang['_COM_TIPS_SHOWHIDE']); echo JHTML::link($url, $jLang['_COM_TIPS_SHOWHIDE'], $attribs); } else { ?> <a href='javascript:void(0);' onClick="openPopup('<?php echo $url; ?> ', 'Team Ladder');"><?php echo $jLang['_COM_TIPS_SHOWHIDE']; ?> </a> <?php } ?> </p><?php } //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%' class="jdatatable" cellspacing="0"> <tr> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_GAME_' . strtoupper($left)]; ?> </th> <?php if ($this->jSeason->team_starts) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_' . strtoupper($left) . 'START']; ?> </th> <?php } if ($this->jSeason->pick_score == 1) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_' . strtoupper($left) . 'SCORE']; ?> </th> <?php } ?> <th <?php echo $tags; ?> > <?php if ($this->jSeason->pick_draw == 1 and ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score)) { echo " " . $jLang['_COM_GAME_DRAW'] . " "; } else { echo " "; } ?> </th> <?php if ($this->jSeason->pick_score == 1) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_' . strtoupper($right) . 'SCORE']; ?> </th> <?php } if ($this->jSeason->team_starts) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_' . strtoupper($right) . 'START']; ?> </th> <?php } ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_GAME_' . strtoupper($right)]; ?> </th> <?php if ($this->jSeason->pick_margin == 1) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_MARGIN']; ?> </th> <?php } if ($this->jSeason->pick_bonus >= 1) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_BONUS']; ?> </th> <?php } if ($this->jSeason->game_times) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_TIME']; ?> </th> <?php } if ($this->jRound->scored == 1) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_RESULT']; ?> </th> <?php } ?> <th <?php echo $tags; ?> > </th> </tr> <?php // BUG 316 - have TimeDate::toDatabaseDateTime around jRound->start_time was deducting an offset from a GMT time - bad if ($this->jRound->start_time < gmdate('Y-m-d H:i:s') or $jTipsCurrentUser->hasTipped($this->jRound->id) and $jTips['TipLockout'] == 1) { $disabled = "disabled"; } else { $disabled = ''; } $hasTipped = count($jTipss) > 0; $rowIndex = 0; foreach ($jGames as $jGame) { $leftTeam = new jTeam($database); $rightTeam = new jTeam($database); $jTipParams = array('user_id' => $jTipsCurrentUser->id, 'game_id' => $jGame->id); $jTip->loadByParams($jTipParams); $left_id_field = $left . '_id'; $right_id_field = $right . '_id'; $leftLoaded = $rightLoaded = false; if ($jGame->{$left_id_field}) { $leftTeam->load($jGame->{$left_id_field}); $leftLoaded = true; } if ($jGame->{$right_id_field}) { $rightTeam->load($jGame->{$right_id_field}); $rightLoaded = true; } if (!$leftLoaded and $rightLoaded) { $this->byes[] = $rightTeam; } if ($leftLoaded and !$rightLoaded) { $this->byes[] = $leftTeam; } if (!$leftLoaded or !$rightLoaded) { continue; } if ($jGame->winner_id == $leftTeam->id) { $left_style = "font-weight:bold;"; $right_style = ""; } else { if ($jGame->winner_id == -1) { $left_style = "font-style:italics;"; $right_style = "font-style:italics;"; } else { if ($jGame->winner_id == $rightTeam->id) { $left_style = ""; $right_style = "font-weight:bold;"; } else { $left_style = ""; $right_style = ""; } } } $rowClasses = "class='sectiontableentry" . ($rowIndex % 2 + 1) . " jtablerow" . ($rowIndex % 2 + 1) . "'"; if ($this->jSeason->pick_score and $jGame->has_score) { $onClick = 'onClick="switchScore(' . $jGame->id . ');"'; } else { $onClick = ''; } ?> <tr <?php echo $rowClasses; ?> > <td style='text-align:right;<?php echo $left_style; ?> '><label for="<?php echo $left; ?> _game<?php echo $jGame->id; ?> "><?php echo $leftTeam->getDisplayLogoName('right'); ?> </label> <?php if ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score) { ?> <input type='radio' <?php echo $onClick; ?> class="inputbox" name='game<?php echo $jGame->id; ?> ' id='<?php echo $left; ?> _game<?php echo $jGame->id; ?> ' value='<?php echo $leftTeam->id; ?> ' <?php echo $jTip->tip_id == $leftTeam->id ? 'checked="checked"' : ''; ?> <?php echo $disabled; ?> /> <?php } ?> </td> <?php if ($this->jSeason->team_starts) { $left_start_field = $left . '_start'; $leftStart = $jGame->{$left_start_field} + 0; if ($jGame->{$left_start_field} > 0) { $leftStart = "+{$leftStart}"; } else { if ($leftStart == 0) { $leftStart = " "; } } ?> <td style='text-align:center;'><?php echo $leftStart; ?> </td> <?php } if ($this->jSeason->pick_score == 1) { ?> <td style='text-align:center;'> <?php if ($jGame->has_score == 1) { ?> <input type='text' onKeyUp="this.value=this.value.replace(/[^\d]+/, '');" class="inputbox" id="<?php echo $left . $jGame->id; ?> " name='<?php echo $left . $jGame->id; ?> ' style='text-align:center;' maxLength='5' size='5' value='<?php $left_score_field = $left . '_score'; echo $jTip->{$left_score_field}; ?> ' <?php echo $disabled; ?> onBlur="setSelectedTeam(<?php echo $jGame->id; ?> );" /> <?php } else { ?> <?php } ?> </td> <?php } if ($this->jSeason->pick_draw == 1 and ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score)) { ?> <td style='text-align:center;'> <input class="inputbox" type='radio' name='game<?php echo $jGame->id; ?> ' id="draw_game<?php echo $jGame->id; ?> " value='-1' <?php echo $jTip->tip_id == -1 ? 'checked="checked"' : ''; ?> <?php echo $disabled; ?> <?php echo $onClick; ?> /></td> <?php } else { ?> <td style='text-align:center;'> <?php echo $jLang['_COM_TEAM_VS']; ?> </td> <?php } if ($this->jSeason->pick_score == 1) { ?> <td style='text-align:center;'> <?php if ($jGame->has_score == 1) { ?> <input type='text' onKeyUp="this.value=this.value.replace(/[^\d]+/, '');" class="inputbox" id="<?php echo $right . $jGame->id; ?> " name='<?php echo $right . $jGame->id; ?> ' style='text-align:center;' maxLength='5' size='5' value='<?php $right_score_field = $right . '_score'; echo $jTip->{$right_score_field}; ?> ' <?php echo $disabled; ?> onBlur="setSelectedTeam(<?php echo $jGame->id; ?> );" /> <?php } else { ?> <?php } ?> </td> <?php } $right_start_field = $right . '_start'; if ($this->jSeason->team_starts) { $rightStart = $jGame->{$right_start_field} + 0; if ($jGame->{$right_start_field} > 0) { $rightStart = "+{$rightStart}"; } else { if ($rightStart == 0) { $rightStart = " "; } } ?> <td style='text-align:center;'><?php echo $rightStart; ?> </td> <?php } ?> <td style='text-align:left;<?php echo $right_style; ?> '> <?php if ($this->jSeason->pick_score and !$jTips['HideTeamSelect'] or !$this->jSeason->pick_score) { ?> <input type='radio' <?php echo $onClick; ?> class="inputbox" name='game<?php echo $jGame->id; ?> ' value='<?php echo $rightTeam->id; ?> ' <?php echo $jTip->tip_id == $rightTeam->id ? 'checked="checked"' : ''; ?> <?php echo $disabled; ?> id="<?php echo $right; ?> _game<?php echo $jGame->id; ?> "/> <?php } ?> <label for="<?php echo $right; ?> _game<?php echo $jGame->id; ?> "><?php echo $rightTeam->getDisplayLogoName('left'); ?> </label> </td> <?php if ($this->jSeason->pick_margin == 1) { ?> <td style='text-align:center;'> <?php if ($jGame->has_margin == 1) { ?> <input type='text' onKeyUp="this.value=this.value.replace(/[^\d]+/, '');" class="inputbox" name='margin<?php echo $jGame->id; ?> ' style='text-align:center;' maxLength='5' size='5' value='<?php echo $jTip->margin; ?> ' <?php echo $disabled; ?> /> <?php } else { ?> <?php } ?> </td> <?php } if ($this->jSeason->pick_bonus > 0) { if ($jGame->has_bonus == 1) { // BUG 302 - awayTeam and homeTeam do not exist anymore $bonusTeams = array('' => $jLang['_ADMIN_CONF_NONE'], $jGame->{$left_id_field} => $leftTeam->getName(), $jGame->{$right_id_field} => $rightTeam->getName()); if ($this->jSeason->pick_bonus == 2) { $bonusTeams['-2'] = $jLang['_ADMIN_SEASON_EPTB_BOT']; } ?> <td style='text-align:center;'><?php echo makeSelectList($bonusTeams, 'bonus' . $jGame->id, "{$disabled} class='inputbox'", $jTip->bonus_id); ?> </td> <?php } else { ?> <td style='text-align:center;'> </td> <?php } } //show the game time if ($this->jSeason->game_times) { ?> <td><?php if ($jGame->start_time) { echo TimeDate::toDisplayDateTime($jGame->start_time, false); } else { echo " "; } ?> </td><?php } if ($this->jRound->scored == 1) { $left_score_field = $left . '_score'; $right_score_field = $right . '_score'; ?> <th <?php echo $tags; ?> ><?php echo $jGame->{$left_score_field} . " - " . $jGame->{$right_score_field}; ?> </th> <?php } ?> <td><?php if (!empty($jGame->description)) { $description = nl2br(stripslashes($jGame->description)); echo jTipsToolTip($description, $jLang['_COM_GAME_ADDITIONAL_INFO']); } else { echo " "; } ?> </td> </tr> <?php $rowIndex++; } ?> </table> <div> <?php $this->renderByes(); ?> <table width="100%" cellspacing="10"> <?php if ($jTips['DoubleUp'] == 1) { if ($jTipsCurrentUser->doubleup > 0 && $jTipsCurrentUser->doubleup < $this->jRound->id || $disabled == 'disabled') { $disable_doubleup = 'disabled'; } else { $disable_doubleup = ''; } ?> <tr> <td style='text-align:center'><h4><label for="doubleup"><?php echo $jLang['_COM_GAME_USEDOUBLE']; ?> </label> <input type='checkbox' class="inputbox" id="doubleup" name='doubleup' value='<?php echo $this->jRound->id; ?> ' <?php echo $jTipsCurrentUser->doubleup == $this->jRound->id ? "checked" : ""; ?> <?php echo $disable_doubleup; ?> /></h4></td> </tr> <?php } if ($jTips['EnableComments'] == 1) { if ($disabled == 'disabled') { $commentArea = "<em>"; if (strlen($this->jComment->comment) > 0) { $commentArea .= $this->jComment->comment; } else { $commentArea .= $jLang['_ADMIN_CONF_NONE']; } $commentArea .= "</em>"; } else { $comment = str_replace('"', "'", $this->jComment->comment); $commentArea = ' <input name="comment" id="comment" size="50" class="inputbox" value="' . $comment . '" /> '; } ?> <tr> <td style="text-align:center;"><?php echo $jLang['_COM_DASH_COMMENT']; ?> : <?php echo $commentArea; ?> </td> </tr> <?php } ?> <tr> <td style='text-align:center' id='submittipsbuttonarea'><?php echo $disabled != "disabled" ? "<input type='button' class='button' name='submittips' id='submittips' value='" . $jLang['_COM_TIPS_SAVE'] . "' {$checkComment} />" : ""; ?> </td> </tr> <tr> <td style='text-align:center; padding-top:5px; display:none;' id='ajaxloading'></td> </tr> </table> </div> <input type='hidden' name='round_id' value='<?php echo $this->jRound->id; ?> ' /> </form> <?php } else { if ($this->jRound->exists() and TimeDate::toDatabaseDateTime($this->jRound->start_time) > gmdate('Y-m-d H:i:s')) { ?> <h2 style='text-align:center'><?php echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round; ?> </h2> <h2 style='text-align:center'><?php echo $jLang['_COM_ROUND_CLOSED']; ?> </h2> <?php } else { if ($this->jRound->exists()) { ?> <h2 style='text-align:center'><?php echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round; ?> </h2> <?php } else { ?> <h2 style='text-align:center'><?php echo $jLang['_COM_ROUND_NOGAMES']; ?> </h2> <?php } } } if ($this->jRound->getStatus() === false and !empty($jTipsCurrentUser->id)) { $userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false); $targetTime = date('Y-m-d H:i:s', $userTime); if ($jTips['ShowJSCountdown'] == 1) { $field = "'countdown'"; } else { $field = "false"; } ?> <script type='text/javascript'> window.addEvent('domready', function(){ var year = <?php echo TimeDate::format($targetTime, '%Y', true, false); ?> ; var month = <?php echo TimeDate::format($targetTime, '%m', true, false) - 1; ?> ; var day = <?php echo TimeDate::format($targetTime, '%d', true, false); ?> ; var hour = <?php echo TimeDate::format($targetTime, '%H', true, false); ?> ; var min = <?php echo TimeDate::format($targetTime, '%M', true, false); ?> ; var sec = 0; jTipsCountdown(year, month, day, hour, min, 1, <?php echo $field; ?> ); }); </script> <?php } }
/** * Take data assigned in $data and display it */ function display() { global $jTipsCurrentUser, $mainframe, $database, $jLang, $jTips, $mosConfig_live_site; $mosConfig_offset = $mainframe->getCfg('offset'); global $Itemid; $useJs = false; if ($jTips['JsLadder'] != 'none') { $useJs = true; } ?> <h2 class="contentheading jmain_heading"><?php echo $this->jSeason->name; ?> </h2> <h3 align="center"><?php if ($this->jRound->getPrev()) { ?> <a style="font-size: smaller;" href='<?php echo jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}&view=Tips&layout=locked&rid=" . $this->jRound->getPrev()); ?> '>« <?php echo $jLang['_COM_PREV_ROUND']; ?> </a> <?php } echo " " . $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round . " "; if ($this->jRound->getNext()) { ?> <a style="font-size: smaller;" href='<?php echo jTipsRoute("index.php?option=com_jtips&Itemid={$Itemid}&view=Tips&layout=locked&rid=" . $this->jRound->getNext()); ?> '><?php echo $jLang['_COM_NEXT_ROUND']; ?> »</a> <?php } ?> </h3> <?php if ($this->jRound->exists()) { $jGameParams = array('round_id' => $this->jRound->id, 'order' => array('type' => 'order', 'by' => 'position', 'direction' => 'ASC')); $jGame = new jGame($database); $jGames = forceArray($jGame->loadByParams($jGameParams)); $tags = "class='sectiontableheader jtableheader'"; ?> <table width="100%" cellspacing="0"> <thead> <tr class="sectiontableheader"> <th <?php echo $tags; ?> width="50%"><?php echo $jLang['_COM_ROUND_START_TIME']; ?> </th> <?php if ($jTips['ShowJSCountdown'] == 1) { ?> <th <?php echo $tags; ?> width="50%"><?php echo $jLang['_COM_ROUND_TIME_TO_START']; ?> </th> <?php } ?> </tr> </thead> <tbody> <tr class="sectiontableentry1"> <td style="text-align: center;"><?php //BUG 136 - show closed/closes depending on start time echo TimeDate::toDisplayDateTime($this->jRound->start_time, false); ?> </td> <?php if ($jTips['ShowJSCountdown'] == 1) { ?> <td> <div id='countdown' style="text-align: center;" class="highlight"><?php echo $jLang['_COM_CLOSED']; ?> </div> </td> <?php } ?> </tr> </tbody> </table> <?php if (jTipsGetParam($jTips, 'TeamLadderPopup', 0)) { $url = "view=TeamLadder&Itemid={$Itemid}&menu=0"; ?> <p style="text-align: center; font-weight: bold;"> <?php if (isJoomla15()) { // better popup handling in J1.5 JHTML::_('behavior.modal'); $rel = json_encode(array('size' => array('x' => $jTips['ShowTipsWidth'], 'y' => $jTips['ShowTipsHeight']))); $url = jTipsRoute("index.php?option=com_jtips&tmpl=component&" . $url); $attribs = array('class' => 'modal', 'rel' => str_replace('"', "'", $rel), 'title' => $jLang['_COM_TIPS_SHOWHIDE']); echo JHTML::link($url, $jLang['_COM_TIPS_SHOWHIDE'], $attribs); } else { ?> <a href='javascript:void(0);' onClick="openPopup('<?php echo $url; ?> ', 'Team Ladder');"><?php echo $jLang['_COM_TIPS_SHOWHIDE']; ?> </a> <?php } ?> </p><?php } //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%' class="jdatatable" cellspacing="0"> <tr> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_GAME_' . strtoupper($left)]; ?> </th> <?php if ($this->jSeason->team_starts) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_' . strtoupper($left) . 'START']; ?> </th> <?php } if ($this->jSeason->team_starts) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_' . strtoupper($right) . 'START']; ?> </th> <?php } ?> <th <?php echo $tags; ?> > </th> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_GAME_' . strtoupper($right)]; ?> </th> <?php if ($this->jSeason->game_times) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_TIME']; ?> </th> <?php } if ($this->jRound->scored == 1) { ?> <th <?php echo $tags; ?> ><?php echo $jLang['_COM_TIPS_RESULT']; ?> </th> <?php } ?> <th <?php echo $tags; ?> > </th> </tr> <?php $rowIndex = 0; foreach ($jGames as $jGame) { $leftTeam = new jTeam($database); $rightTeam = new jTeam($database); $left_id_field = $left . '_id'; $right_id_field = $right . '_id'; $leftLoaded = $rightLoaded = false; if ($jGame->{$left_id_field}) { $leftTeam->load($jGame->{$left_id_field}); $leftLoaded = true; } if ($jGame->{$right_id_field}) { $rightTeam->load($jGame->{$right_id_field}); $rightLoaded = true; } if (!$leftLoaded and $rightLoaded) { $this->byes[] = $rightTeam; } if ($leftLoaded and !$rightLoaded) { $this->byes[] = $leftTeam; } if (!$leftLoaded or !$rightLoaded) { continue; } if ($jGame->winner_id == $leftTeam->id) { $left_style = "font-weight:bold;"; $right_style = ""; } else { if ($jGame->winner_id == -1) { $left_style = "font-style:italics;"; $right_style = "font-style:italics;"; } else { if ($jGame->winner_id == $rightTeam->id) { $left_style = ""; $right_style = "font-weight:bold;"; } else { $left_style = ""; $right_style = ""; } } } $rowClasses = "class='sectiontableentry" . ($rowIndex % 2 + 1) . " jtablerow" . ($rowIndex % 2 + 1) . "'"; ?> <tr <?php echo $rowClasses; ?> > <td style='text-align:right;<?php echo $left_style; ?> '><label for="<?php echo $left; ?> _game<?php echo $jGame->id; ?> "><?php echo $leftTeam->getDisplayLogoName('right'); ?> </label></td> <?php if ($this->jSeason->team_starts) { $left_start_field = $left . '_start'; $leftStart = $jGame->{$left_start_field} + 0; if ($jGame->{$left_start_field} > 0) { $leftStart = "+{$leftStart}"; } else { if ($leftStart == 0) { $leftStart = " "; } } ?> <td style='text-align: center;'><?php echo $leftStart; ?> </td> <?php } ?> <td style='text-align: center;'> <?php echo $jLang['_COM_TEAM_VS']; ?> </td> <?php $right_start_field = $right . '_start'; if ($this->jSeason->team_starts) { $rightStart = $jGame->{$right_start_field} + 0; if ($jGame->{$right_start_field} > 0) { $rightStart = "+{$rightStart}"; } else { if ($rightStart == 0) { $rightStart = " "; } } ?> <td style='text-align: center;'><?php echo $rightStart; ?> </td> <?php } ?> <td style='text-align:left;<?php echo $right_style; ?> '><label for="<?php echo $right; ?> _game<?php echo $jGame->id; ?> "><?php echo $rightTeam->getDisplayLogoName('left'); ?> </label> </td> <?php //show the game time if ($this->jSeason->game_times) { ?> <td><?php if ($jGame->start_time) { echo TimeDate::toDisplayDateTime($jGame->start_time, false); } else { echo " "; } ?> </td><?php } if ($this->jRound->scored == 1) { $left_score_field = $left . '_score'; $right_score_field = $right . '_score'; ?> <th <?php echo $tags; ?> ><?php echo $jGame->{$left_score_field} . " - " . $jGame->{$right_score_field}; ?> </th> <?php } ?> <td><?php if (!empty($jGame->description)) { $description = nl2br(stripslashes($jGame->description)); echo jTipsToolTip($description, $jLang['_COM_GAME_ADDITIONAL_INFO']); } else { echo " "; } ?> </td> </tr> <?php $rowIndex++; } ?> </table> <div><?php $this->renderByes(); ?> </div> <?php } else { if ($this->jRound->exists() and TimeDate::toDatabaseDateTime($this->jRound->start_time) > gmdate('Y-m-d H:i:s')) { ?> <h2 style='text-align: center'><?php echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round; ?> </h2> <h2 style='text-align: center'><?php echo $jLang['_COM_ROUND_CLOSED']; ?> </h2> <?php } else { if ($this->jRound->exists()) { ?> <h2 style='text-align: center'><?php echo $jLang['_COM_DASH_ROUND'] . " " . $this->jRound->round; ?> </h2> <?php } else { ?> <h2 style='text-align: center'><?php echo $jLang['_COM_ROUND_NOGAMES']; ?> </h2> <?php } } } if ($this->jRound->getStatus() === false) { $userTime = strtotime($this->jRound->start_time) - TimeDate::getOffset(false); $targetTime = date('Y-m-d H:i:s', $userTime); if ($jTips['ShowJSCountdown'] == 1) { $field = "'countdown'"; } else { $field = "false"; } ?> <script type='text/javascript'> window.addEvent('domready', function(){ var year = <?php echo TimeDate::format($targetTime, '%Y', true, false); ?> ; var month = <?php echo TimeDate::format($targetTime, '%m', true, false) - 1; ?> ; var day = <?php echo TimeDate::format($targetTime, '%d', true, false); ?> ; var hour = <?php echo TimeDate::format($targetTime, '%H', true, false); ?> ; var min = <?php echo TimeDate::format($targetTime, '%M', true, false); ?> ; var sec = 0; jTipsCountdown(year, month, day, hour, min, 1, <?php echo $field; ?> ); }); </script> <?php } }
function displayEditRound() { global $jLang, $mosConfig_live_site, $jTips, $Itemid; ?> <style type='text/css'> #loader3.ajax-loading { background:url(<?php echo $mosConfig_live_site; ?> /components/com_jtips/images/loading.gif) no-repeat center; padding: 20px 0; } </style> <div id="loader3"></div> <form action="index2.php?Itemid=<?php echo $Itemid; ?> " method="post" id="jTipsRoundEditForm"> <input type="hidden" name="option" value="com_jtips" /> <input type="hidden" name="view" value="Administration" /> <input type="hidden" name="action" value="SaveRound" /> <input type="hidden" name="season_id" id="season_id" value="<?php echo $this->jSeason->id; ?> " /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <input type="hidden" name="id" id="id" value="<?php echo $this->focus->id; ?> " /> <input type="hidden" name="roundnum" id="roundnum" value="<?php echo $this->roundnum; ?> " /> <h2><?php echo $jLang['_ADMIN_ROUND_LEGEND']; ?> </h2> <table class='admintable' width="100%"> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_ROUND_START'] . " " . $jLang['_ADMIN_ROUND_DATE'] . " & " . $jLang['_ADMIN_ROUND_TIME']; ?> </td> <td> <input type="text" class="inputbox" name="date_start_date" size="30" value="<?php echo $this->date_start_date; ?> " id="date_start_date" /> <img src='<?php echo $mosConfig_live_site; ?> /administrator/components/com_jtips/images/calendar.png' onclick='return showCalendar("date_start_date", "<?php echo $jTips['DateFormat']; ?> ");' border='0' alt='...' align='absmiddle' /> <?php echo $this->date_start_time_hour; ?> :<?php echo $this->date_start_time_minute; ?> <?php echo $this->date_start_time_meridiem; ?> </td> </tr> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_ROUND_END'] . " " . $jLang['_ADMIN_ROUND_DATE'] . " & " . $jLang['_ADMIN_ROUND_TIME']; ?> </td> <td> <input type="text" class="inputbox" name="date_end_date" size="30" value="<?php echo $this->date_end_date; ?> " id="date_end_date" /> <img src='<?php echo $mosConfig_live_site; ?> /administrator/components/com_jtips/images/calendar.png' onclick='return showCalendar("date_end_date", "<?php echo $jTips['DateFormat']; ?> ");' border='0' alt='...' align='absmiddle' /> <?php echo $this->date_end_time_hour; ?> :<?php echo $this->date_end_time_minute; ?> <?php echo $this->date_end_time_meridiem; ?> </td> </tr> <tr> <td class="key" width="25%"><label for="show_jtips_info"><?php echo $jLang['_ADMIN_ROUND_SHOW_COMMENTS']; ?> </label></td> <td><input type="checkbox" id="show_jtips_info" onClick="if(this.checked){$$('.jtipsinfo').setStyle('display', '');}else{$$('.jtipsinfo').setStyle('display', 'none');}" /></td> </tr> </table> <h2><?php echo $jLang['_ADMIN_ROUND_GAMES_LEGEND']; ?> </h2> <?php if (!$this->focus->getStatus() or !$this->focus->exists()) { ?> <p><input type="button" class="button" onClick="addGameRow();" id="addgame" value="Add Game" /> <input type="button" class="button" onClick="removeGameRow();" id="removegame" value="Remove Game(s)" /></p> <?php } ?> <table class="admintable" cellspacing="0" width="100%"> <thead> <tr class="sectiontableheader"> <!--th align='center' width='1'>#</th--> <th align="center" width='20'> </th> <th id="left_team_th"><?php echo $jLang['_ADMIN_ROUND_' . strtoupper($this->left)]; ?> </th> <th id="right_team_th"><?php echo $jLang['_ADMIN_ROUND_' . strtoupper($this->right)]; ?> </th> <th class="pick">Enable Picks</th> <th id="left_start_th" class="team_starts"><?php echo $jLang['_ADMIN_GAME_' . strtoupper($this->left) . '_START']; ?> </th> <th id="right_start_th" class="team_starts"><?php echo $jLang['_ADMIN_GAME_' . strtoupper($this->right) . '_START']; ?> </th> <th class="date_time"><?php echo $jLang['_ADMIN_GAME_TIME']; ?> </th> <th class="jtipsinfo" style="display:none;"><?php echo $jLang['_ADMIN_ROUNDS_INFO']; ?> </th> </tr> </thead> <tbody id="table"> </tbody> </table> <div class="contentheading" style="text-align:center;"> <?php if (isJoomla15()) { ?> <input type="submit" value="<?php echo $jLang['_COM_SAVE']; ?> " name="submit_round" class="button" /> <input type="button" value="<?php echo $jLang['_COM_CANCEL']; ?> " name="cancel_round" onClick="window.parent.document.getElementById('sbox-window').close();" class="button" /> <?php } else { ?> <input type="submit" value="<?php echo $jLang['_COM_SAVE']; ?> " name="submit_round" class="button" /> <input type="button" value="<?php echo $jLang['_COM_CANCEL']; ?> " name="cancel_round" onClick="$('mb_close_link').onclick();" class="button" /> <?php } ?> </div> </form> <?php }
function displayPreferencesLink() { global $jTipsCurrentUser, $jTips, $jLang, $Itemid, $mosConfig_live_site, $mainframe; ?> <div class="jpreferences"> <?php if (!empty($jTipsCurrentUser->id)) { if (isJoomla15()) { /*?> <a class="modal" rel="{handler:'iframe', size: {x: <?php echo $jTips['ShowTipsWidth']; ?>, y: <?php echo $jTips['ShowTipsHeight']; ?>}}" href="<?php echo jTipsRoute("index2.php?option=com_jtips&view=UserPreferences&Itemid=$Itemid&return=" .jTipsGetParam($_REQUEST, 'view', ''). "&menu=0"); ?>" title="<?php echo $jLang['_COM_EDIT_PREFERENCES']; ?>"><?php echo $jLang['_COM_EDIT_PREFERENCES']; ?></a> <?php*/ JHTML::_('behavior.modal'); $rel = json_encode(array('size' => array('x' => $jTips['ShowTipsWidth'], 'y' => $jTips['ShowTipsHeight']))); $url = jTipsRoute("index.php?option=com_jtips&view=UserPreferences&tmpl=component&Itemid={$Itemid}&return=" . jTipsGetParam($_REQUEST, 'view', '') . "&menu=0"); $attribs = array('class' => 'modal', 'rel' => str_replace('"', "'", $rel), 'title' => $jLang['_COM_EDIT_PREFERENCES']); echo JHTML::link($url, $jLang['_COM_EDIT_PREFERENCES'], $attribs); } else { ?> <a href="javascript:void(0);" onClick="loadPreferencesPopup('<?php echo jTipsGetParam($_REQUEST, 'view', ''); ?> ', '<?php echo $Itemid; ?> ', '<?php echo $this->season_link; ?> ', this);" title="<?php echo $jLang['_COM_EDIT_PREFERENCES']; ?> "><?php echo $jLang['_COM_EDIT_PREFERENCES']; ?> </a> <?php } } //can this user administer the results for this competition // BUG 309 - remove the popup admin pages - accessible as normal link $my =& $mainframe->getUser(); if ($this->jSeason->scorer_id == $my->id and !empty($my->id) and !empty($this->jSeason->scorer_id) and jTipsGetParam($_REQUEST, 'view', 'Dashboard') != 'Administration') { /*if (isJoomla15()) { ?> <a href="<?php echo jTipsRoute("index2.php?option=com_jtips&" .$this->adminUrl); ?>" class="modal" rel="{handler: 'iframe', size: {x: 800, y: 450}}" title="<?php echo $jLang['_COM_ADMIN_RESULTS']; ?>"><?php echo $jLang['_COM_ADMIN_RESULTS']; ?></a> <?php } else { ?> <a href="javascript:void(0);" onClick="openPopup('<?php echo $this->adminUrl; ?>', '<?php echo $jLang['_COM_ADMIN_RESULTS']; ?>', 800, 450);" title="<?php echo $jLang['_COM_ADMIN_RESULTS']; ?>"><?php echo $jLang['_COM_ADMIN_RESULTS']; ?></a> <?php }*/ ?> <a href="<?php echo jTipsRoute("index.php?option=com_jtips&" . $this->adminUrl); ?> " title="<?php echo $jLang['_COM_ADMIN_RESULTS']; ?> "><?php echo $jLang['_COM_ADMIN_RESULTS']; ?> </a> <?php } ?> </div> <?php }
function setLastUpdateCheckDate() { global $mosConfig_absolute_path; jTipsLogger::_log('updating update check date'); $auto = $mosConfig_absolute_path . '/administrator/components/com_jtips/auto'; $buffer = gmdate('Y-m-d H:i:s'); if (isJoomla15()) { jimport('joomla.filesystem.file'); JFile::write($auto, $buffer); } else { file_put_contents($auto, $buffer); } }
function display() { global $mainframe, $database, $jTips, $jLang, $jLicence, $mosConfig_absolute_path, $mosConfig_live_site, $database; jTipsLogger::_log('Loading dashboard', 'INFO'); jTipsCommonHTML::loadOverlib(); $option = jTipsGetParam($_REQUEST, 'option', 'com_jtips'); if (isJoomla15()) { JToolbarHelper::title($jLang['_ADMIN_DASH_CPANEL'], 'frontpage'); } else { ?> <table class="adminheading" border="0" width="100%"> <tr> <th class="cpanel" align="left"><?php echo $jLang['_ADMIN_DASH_CPANEL']; ?> </th> <td align="right"><a href="http://www.jtips.com.au" target="_blank" title="jTips Home"><img src="<?php echo $mosConfig_live_site; ?> /components/com_jtips/images/license_logo.png" alt="" border="0" /></a></td> </tr> </table> <?php } ?> <table class="adminform"> <tr> <td width="55%" valign="top"> <?php jTipsLogger::_log('Building dashboard icons', 'INFO'); foreach ($this->menu as $item) { if (isset($item['url']) and !empty($item['url'])) { $link = $item['url']; $extra = "target='_blank'"; } else { $link = "index2.php?option={$option}&task=" . $item['task']; $extra = ""; } ?> <div id="cpanel" style="float:left;"> <div class="icon"> <a href="<?php echo $link; ?> " <?php echo $extra; ?> > <img src="components/com_jtips/images/<?php echo $item['image']; ?> " alt="<?php echo $jLang[$item['alt']]; ?> " align="middle" border="0" /><span><?php echo $jLang[$item['link']]; ?> </span></a> </div> </div> <?php } ?> </td> <td width="45%" valign="top"> <div style="width: 100%;"> <?php $tabs = new jTipsTabs(1); $tabs->startPane('dashpanel'); $tabs->startTab($jLang['_ADMIN_DASH_TAB_SUMMARY'], 'summary'); $center = "style='text-align:center;'"; ?> <table class='adminlist'> <thead> <tr> <th><?php echo $jLang['_COM_DASH_SEASON']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_COM_DASH_CURR_ROUND']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_TOTAL_USERS']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_PENDING_TIPS']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_PENDING_PAYMENT']; ?> </th> </tr> </thead> <tbody> <?php jTipsLogger::_log('Loading season data', 'INFO'); $total_user_count = 0; foreach ($this->jSeasons as $jSeason) { if (TimeDate::toDatabaseDate($jSeason->end_time) > gmdate('Y-m-d')) { $round_id = $jSeason->getCurrentRound(); $jRound = new jRound($database); if ($round_id) { $jRound->load($round_id); } $jTipsUsers = $jSeason->getUsers(); $total_users = 0; $no_tips = 0; $has_paid = 0; $no_tips_overlib = ""; foreach ($jTipsUsers as $jTipsUser) { $total_users++; if (!$jTipsUser->hasTipped($jRound->id)) { $no_tips++; if ($no_tips < 10) { $no_tips_overlib .= "<br />" . htmlentities($jTipsUser->getName()); } else { if ($no_tips == 10) { $no_tips_overlib .= "<br />...more"; } } } if ($jTipsUser->paid == 1) { $has_paid++; } } if ($jTips['Payments'] != 0) { $pending_payment = $total_users - $has_paid; } else { $pending_payment = "N/A"; } $no_tips_overlib = substr($no_tips_overlib, 6); if ($no_tips > 0) { $no_tips_overlib_call = jTipsToolTip($no_tips_overlib, "Users Missing Tips"); } else { $no_tips_overlib_call = ''; } ?> <tr> <td><?php echo $jSeason->name; ?> </td> <td <?php echo $center; ?> ><?php echo $jRound->round; ?> </td> <td <?php echo $center; ?> ><?php echo $total_users; ?> </td> <td <?php echo $center; ?> ><?php echo $no_tips . " " . $no_tips_overlib_call; ?> </td> <td <?php echo $center; ?> ><?php echo $pending_payment; ?> </td> </tr> <?php $total_user_count += $total_users; } } ?> </tbody> </table> <?php $tabs->endTab(); $tabs->startTab($jLang['_ADMIN_DASH_TAB_UPDATED'], 'update'); $filesWritable = filesWritable(); ?> <table class="adminlist" width="100%"> <thead> <tr> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_UPG_THISVERSION']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_UPG_LATESTVERSION']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_UPG_UPGRADE']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_UPG_FILE_CHECK']; ?> </th> </tr> </thead> <tbody> <tr> <td <?php echo $center; ?> ><?php echo getFullVersion(); ?> </td> <!-- td <?php echo $center; ?> id="latest_version"><input type="button" onclick="liveCheckLatestVersion('latest_version');" class="button" value="Check Now" <?php if (!$filesWritable) { echo "disabled"; } ?> /></td --> <td <?php echo $center; ?> >N/A</td> <!-- td <?php echo $center; ?> ><span id="liveupdatespan"><?php echo getUpdateButton('', ''); ?> </span></td --> <td <?php echo $center; ?> >N/A</td> <td <?php echo $center; ?> > <?php if ($filesWritable) { $tip = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_OK']; $tipTitle = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_OK_TITLE']; $img = 'checkin.png'; echo jTipsToolTip($tip, $tipTitle, '', $img); } else { $tip = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_FAIL']; $tipTitle = $jLang['_ADMIN_DASH_UPG_FILE_CHECK_FAIL_TITLE']; $img = 'warning.png'; ?> <a href=> <?php echo jTipsToolTip($tip, $tipTitle, '', $img, '', "index2.php?option=com_jtips&module=Upgrade&task=list"); ?> </a> <?php } ?> </td> </tr> <?php if (needsUpgrade()) { ?> <tr> <td colspan="4" id="upgrade_area" <?php echo $center; ?> > <input type="button" class="button" name="upgrade" value="<?php echo $jLang['_ADMIN_UPGRADE_BUTTON']; ?> " onclick="doUpgrade(this);" /> </td> </tr> <?php } ?> </tbody> <thead> <tr> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_LAST_VALIDATED']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_VALIDATION']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_DASH_EXPIRY_DATE']; ?> </th> <th <?php echo $center; ?> ><?php echo $jLang['_ADMIN_LICENSE_USER_COUNT']; ?> </th> </tr> </thead> <tbody> <tr> <td <?php echo $center; ?> ><?php $validation_date = $jLicence->getValidationDate(); if ($validation_date == -1) { echo $jLang['_ADMIN_DASH_LIC_EXPIRED']; } else { echo $validation_date; } ?> </td> <td <?php echo $center; ?> ><a href="index2.php?option=com_jtips&task=Validate&module=Dashboard"><?php echo $jLang['_ADMIN_DASH_REVALIDATE']; ?> </a></td> <td <?php echo $center; ?> ><?php echo TimeDate::toDisplayDate($jLicence->licence['license_expiry']); ?> </td> <td <?php echo $center; ?> ><?php echo $jLicence->getActiveUserCount(); ?> / <?php echo $jLicence->getLicensedUsers(); ?> </td> </tr> </tbody> <thead> <tr> <th <?php echo $center; ?> colspan="4"><?php echo $jLang['_ADMIN_DASH_LOGGING']; ?> </th> </tr> </thead> <tbody> <tr> <td nowrap><?php echo $jLang['_ADMIN_DASH_FILE_SIZE']; ?> : <?php echo size_readable(filesize($mosConfig_absolute_path . '/components/com_jtips/jtips.log')); ?> </td> <td <?php echo $center; ?> ><a href="index2.php?option=com_jtips&task=DownloadLog&module=Dashboard"><?php echo $jLang['_ADMIN_DASH_DOWNLOAD']; ?> </a></td> <td <?php echo $center; ?> ><a href="index2.php?option=com_jtips&task=PurgeLog&module=Dashboard"><?php echo $jLang['_ADMIN_DASH_PURGE']; ?> </a></td> <td> </td> </tr> </tbody> <tfoot> <tr> <td colspan="4"><small><em><?php echo $jLang['_ADMIN_DASH_LOG_ROTATED']; ?> </em></small></td> </tr> </tfoot> </table> <?php $tabs->endTab(); $tabs->startTab($jLang['_ADMIN_DASH_TAB_ABOUT'], 'about'); ?> <div style="text-align:center;"><img src="components/com_jtips/images/logo.png" border="0" /> <h1><?php echo getFullVersion(); ?> </h1></div> <p><?php echo $jLang['_ADMIN_DASH_ABOUT_UPDATES']; ?> <a href="http://www.jtips.com.au/" target="_blank">http://www.jtips.com.au</a></p> <p><?php echo $jLang['_ADMIN_DASH_ABOUT_SALES']; ?> <a href="mailto:sales@jtips.com.au?subject=jTips Enquiry">sales@jtips.com.au</a></p> <p><?php echo $jLang['_ADMIN_DASH_ABOUT_SUPPORT']; ?> <a href="http://www.jtips.com.au" target="_blank">jTips.com.au</a></p> <p><?php echo $jLang['_ADMIN_DASH_ABOUT_REBUILD']; ?> <a href="#" onclick="sendRebuildRequest('rebuildProgress');">» <?php echo $jLang['_COMMON_CLICK_HERE']; ?> «</a> <span id="rebuildProgress"></span></p> <?php $tabs->endTab(); $tabs->startTab($jLang['_ADMIN_DASH_TAB_CREDITS'], 'credits'); ?> <p><strong><?php echo $jLang['_ADMIN_DASH_CREDITS']; ?> :</strong></p> <table class="adminlist" width="100%"> <thead> <tr> <th><?php echo $jLang['_ADMIN_DASH_CREDITS_PACKAGE']; ?> </th> <th><?php echo $jLang['_ADMIN_DASH_CREDITS_HOMEPAGE']; ?> </th> </tr> </thead> <tbody> <tr> <td>mootools</td> <td><a href="http://mootools.net/" target="_blank">http://mootools.net</a></td> </tr> <tr> <td>tnimg</td> <td><a href="http://vagh.armdex.com/tnimg" target="_blank">http://vagh.armdex.com/tnimg</a></td> </tr> <tr> <td>cURL</td> <td><a href="http://www.phpclasses.org/browse/package/1988.html" target="_blank">http://www.phpclasses.org</a></td> </tr> <tr> <td>dUnzip2</td> <td><a href="http://www.phpclasses.org/browse/package/2495.html" target="_blank">http://www.phpclasses.org</a></td> </tr> <tr> <td>MOOdalBox</td> <td><a href="http://www.e-magine.ro/web-dev-and-design/36/moodalbox/" target="_blank">http://www.e-magine.ro</a></td> </tr> <tr> <td>Silk Icons</td> <td><a href="http://www.famfamfam.com/lab/icons/silk/" target="_blank">http://www.famfamfam.com</a></td> </tr> <tr> <td>datejs</td> <td><a href="http://www.datejs.com/" target="_blank">http://www.datejs.com</a></td> </tr> <tr> <td>strftime in javascript</td> <td><a href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html" target="_blank">http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html</a></td> </tr> <tr> <td>Editor Area</td> <td><a href="http://www.cdolivet.net/editarea/" target="_blank">http://www.cdolivet.net/editarea</a></td> </tr> <tr> <td>GNOME Icons</td> <td><a href="http://commons.wikimedia.org/wiki/GNOME_Desktop_icons" target="_blank">http://commons.wikimedia.org/wiki/GNOME_Desktop_icons</a></td> </tr> </tbody> </table> <?php $tabs->endTab(); $tabs->startTab($jLang['_ADMIN_DASH_TAB_HELP'], 'help'); ?> <h2><?php echo $jLang['_ADMIN_DASH_HELP']; ?> </h2> <p><?php echo $jLang['_ADMIN_DASH_HELP_INTRO']; ?> <a href="http://www.jtips.com.au" target="_blank">www.jtips.com.au</a></p> <ul> <li><?php echo $jLang['_ADMIN_DASH_HELP_GETTING_STARTED']; ?> </li> <li><?php echo $jLang['_ADMIN_DASH_HELP_GUIDES']; ?> </li> <li><?php echo $jLang['_ADMIN_DASH_HELP_TRICKS']; ?> </li> </ul> <p>Do you have an invalid license key? Please contact jTips Support at <a href="mailto:support@jtips.com.au">support@jtips.com.au</a> and confirm your license key is valid for the domain <strong><?php echo $_SERVER['SERVER_NAME']; ?> </strong>.</p> <?php $tabs->endTab(); $tabs->endPane(); ?> </div> </td> </tr> </table> <?php }
function display() { global $jLang; ?> <form action='index2.php' method='post' name='adminForm' enctype='multipart/form-data'> <input type='hidden' name='task' value='' /> <input type='hidden' name='option' value='<?php echo jTipsGetParam($_REQUEST, 'option', 'com_jtips'); ?> ' /> <input type='hidden' name='hidemainmenu' value='0' /> <input type="hidden" name="module" value="Import" /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <?php if (isJoomla15()) { JToolBarHelper::title($jLang['_ADMIN_IMP_HEADER'], 'import'); } else { ?> <table class='adminheading'> <tr> <th><?php echo $jLang['_ADMIN_IMP_HEADER']; ?> </th> </tr> </table> <?php } ?> <?php if ($this->importExists) { ?> <fieldset> <legend><?php echo $jLang['_ADMIN_IMPORT_SETUP_LEGEND']; ?> </legend> <input type="hidden" name="hasFile" id="hasFile" value="1" /> <input type="hidden" name="importFile" value="1" id="importFile" /> <table class='admintable' width="100%"> <tr> <td class="key"><label for="importObject"><?php echo $jLang['_ADMIN_IMP_SELECT_TYPE']; ?> </label></td> <td><?php echo $this->selectLists['objects']; ?> <span id='loading' style='display:none;'><?php echo getAjaxLoading(); ?> </span></td> </tr> <tr id="match_row" style="display:none;"> <td class="key" valign="top"><?php echo $jLang['_ADMIN_IMP_MATCH_SELECT']; ?> :</td> <td><select name="match_on[]" id="match_on" multiple="multiple" class="inputbox"></select></td> </tr> </table> </fieldset> <fieldset> <legend><?php echo $jLang['_ADMIN_IMP_FIELD_MAPPING_LEGEND']; ?> </legend> <table class='adminlist' width="100%"> <thead> <tr> <th width='25%'><?php echo $jLang['_ADMIN_IMP_COL_HEADER']; ?> </th> <th width='25%'><?php echo $jLang['_ADMIN_IMP_FIELD_MAP']; ?> </th> <th width='25%'>Row 1 Data</th> <th width='25%'>Row 2 Data</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < count($this->headers); $i++) { $col = cleanString($this->headers[$i]); $row1 = isset($this->row1Data[$i]) ? $this->row1Data[$i] : ''; $row2 = isset($this->row2Data[$i]) ? $this->row2Data[$i] : ''; ?> <tr class="row<?php echo $i % 2; ?> "> <td class="key" width='25%'><?php echo $col; ?> </td> <td><?php echo jTipsHTML::selectList($this->noneOptions, "importFields[{$col}]", 'disabled id="' . $col . '" class="importFields"', 'value', 'text'); ?> </td> <td style='text-align:left;'><?php echo jTipsHTML::cleanText($row1); ?> </td> <td style='text-align:left;'><?php echo jTipsHTML::cleanText($row2); ?> </td> </tr> <?php } ?> </tbody> </table> </fieldset> <?php } else { ?> <fieldset> <legend><?php echo $jLang['_ADMIN_IMPORT_UPLOAD_LEGEND']; ?> </legend> <input type="hidden" name="hasFile" id="hasFile" value="0" /> <table class='admintable' width="100%"> <tr> <td class="key" width='25%'><label for="importFile"><?php echo $jLang['_ADMIN_IMP_UPLOAD']; ?> </label></td> <td><input type='file' name='importFile' id="importFile" size='40' /></td> </tr> </table> </fieldset> <?php } ?> </form> <?php }
/** * Get the number of seconds to add to the formatted database time * * @param [bool] True if calling from the admin area, false when calling from the front-end * * @return int The number of seconds to add */ static function getOffset($isAdmin = true) { global $mainframe, $jTipsCurrentUser; $offset = 0; if ($isAdmin or !isset($jTipsCurrentUser->id) or empty($jTipsCurrentUser->id)) { if (isJoomla15()) { $offset = $mainframe->getCfg('offset') * 60 * 60; } else { $offset = $mainframe->getCfg('offset_user') * 60 * 60; } //TODO: try to add DST if applicable to this timezone } else { $tz = $jTipsCurrentUser->getPreference('timezone'); if (is_numeric($tz)) { //$dateTimeZone = new DateTimeZone($tz); //$dateTime = new DateTime("now", $dateTimeZone); //$offset = $dateTimeZone->getOffset($dateTime); $offset = $tz * 60 * 60; } else { return TimeDate::getOffset(); } } return $offset; }
function display() { global $jLang; ?> <form action='index2.php' method='post' name='adminForm'> <input type='hidden' name='task' value='list' /> <input type='hidden' name='option' value='<?php echo jTipsGetParam($_REQUEST, 'option', 'com_jtips'); ?> ' /> <input type='hidden' name='module' value='Export' /> <input type='hidden' name='hidemainmenu' value='0' /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <?php if (isJoomla15()) { JToolBarHelper::title($jLang['_ADMIN_CONF_EXPBTN'], 'export'); } else { ?> <table class='adminheading'> <tr><th><?php echo $jLang['_ADMIN_CONF_EXPBTN']; ?> </th></tr> </table> <?php } ?> <fieldset> <legend><?php echo $jLang['_ADMIN_EXP_INFO']; ?> </legend> <table class='admintable' width="100%"> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_EXP_PREVIOUS']; ?> </td> <td><?php echo $this->selectLists['history']; ?> <?php echo $this->selectLists['actions']; ?> <input type='submit' name='doAction' value='Go!' class='button' <?php echo $this->disableExportButton; ?> onclick="this.form.task.value='history'" /></td> </tr> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_EXP_SELECT_TYPE']; ?> </td> <td><?php echo $this->selectLists['objects']; ?> <input type="submit" name="getExport" value="Export Data" class="button" onclick="this.form.task.value='export'" /></td> </tr> </table> </fieldset> </form> <?php }
function loadLicenseFile() { if (isJoomla15()) { $licence = JFile::read($this->licence_file); } else { $licence = file_get_contents($this->licence_file); } $licence = preg_replace('/[\\r\\n]+/', '', $licence); $licence = unserialize(base64_decode($licence)); $this->licence = $licence; return $licence; }
function display() { global $jLang; if (isJoomla15()) { JToolBarHelper::title($this->formData['title'], 'round'); } else { ?> <table class='adminheading'> <tr> <th><?php echo $this->formData['title']; ?> </th> </tr> </table> <?php } ?> <table class="adminform" width="100%"> <tbody> <tr> <td><?php echo $jLang['_ADMIN_ROUND_COPY_INFO']; ?> </td> </tr> </table> <form action="index2.php" name="adminForm" id="adminForm" method="post"> <input type="hidden" name="task" value="" /> <input type="hidden" name="option" value="com_jtips" /> <input type="hidden" name="module" value="Rounds" /> <input type="hidden" name="id" value="<?php echo $this->round_id; ?> " /> <fieldset> <legend><?php echo $jLang['_ADMIN_ROUND_COPY_FROM']; ?> </legend> <table class="admintable" width="100%"> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_ROUND_COPYING']; ?> </td> <td><?php echo $jLang['_ADMIN_ROUND_ROUND']; ?> <?php echo $this->round; ?> - <?php echo $this->season_name; ?> </td> </tr> <tr> <td class="key"><?php echo $jLang['_ADMIN_ROUND_COPY_TO_SEASON']; ?> </td> <td><?php echo $this->season_name; ?> </td> </tr> <tr> <td class="key"><label for="round"><?php echo $jLang['_ADMIN_ROUND_COPY_TO_ROUND']; ?> </label></td> <td><input type="text" name="round" id="round" class="inputbox" size="5" maxlength="3" /></td> </tr> </table> </fieldset> </form> <?php }
function filesWritable($getArray = false) { global $mosConfig_absolute_path; if (isJoomla15()) { //files should be accessable from apache or FTP return true; } $directories = array('/administrator/components/com_jtips', '/components/com_jtips'); clearstatcache(); //Load all the files first $files = array(); foreach ($directories as $dir) { $dirfiles = findAllFiles($mosConfig_absolute_path . $dir, $files, true); $files = array_merge($files, $dirfiles); } jTipsLogger::_log("CHECKING IF WRITABLE!!!"); //jTipsLogger::_log($files); //No check if each is writable if (empty($files)) { //Should NEVER get in here jTipsLogger::_log("Something is very wrong with the system. No jTips files found!!!"); return false; } $files = array_unique($files); $displayArray = array(); foreach ($files as $file) { if (!is_writable($file) and !preg_match('/\\/updates\\/.+\\.zip/', $file)) { $displayArray[] = str_replace($mosConfig_absolute_path . '/', '', $file); } } jTipsLogger::_log($displayArray); if (!empty($displayArray)) { if ($getArray) { return $displayArray; } return false; } return true; }
function sendNotificationEmail($type) { jTipsLogger::_log('preparing to send ' . $type . ' notification email', 'INFO'); global $jTips, $database; $subject = stripslashes($jTips["UserNotify" . $type . "Subject"]); $message = stripslashes($jTips["UserNotify" . $type . "Message"]); $from_name = $jTips['UserNotifyFromName']; $from_email = $jTips['UserNotifyFromEmail']; $variables = array(); $values = array(); foreach (get_object_vars($this) as $key => $val) { if (is_string($key)) { array_push($variables, $key); $values[$key] = $val; } } if (isJoomla15()) { $user = new JUser(); } else { $user = new mosUser($database); } $user->load($this->user_id); foreach (get_object_vars($user) as $key => $val) { if (is_string($key)) { array_push($variables, $key); $values[$key] = $val; } } // find out which season this is for an add it to the avaialble variables $query = "SELECT name FROM #__jtips_seasons WHERE id = '" . $this->season_id . "'"; $database->setQuery($query); $season = $database->loadResult(); $values['competition'] = $season; $values['season'] = $season; $body = parseTemplate($message, $variables, $values); jTipsLogger::_log('sending email: ' . $body, 'INFO'); if (jTipsMail($from_email, $from_name, $this->getUserField('email'), $subject, $body)) { jTipsLogger::_log('notification email sent successfully', 'INFO'); return TRUE; } else { jTipsLogger::_log('sending notification email failed', 'ERROR'); return FALSE; } }
function process() { global $database, $jTips, $mosConfig_absolute_path; $this->clearHistory(); $params = array('round_id' => $this->id); $jSeason = new jSeason($database); $jSeason->load($this->season_id); $jGame = new jGame($database); $jGames = forceArray($jGame->loadByParams($params)); $params = array('season_id' => $this->season_id); $jTipsUser = new jTipsUser($database); $jTipsUsers = forceArray($jTipsUser->loadByParams($params)); $noTips = $scores = $worst_precision = array(); $played = count($jGames); foreach ($jTipsUsers as $jTipsUser) { jTipsLogger::_log("Processing scores for user " . $jTipsUser->id); $score = $matching = $precision = $allAwayScore = 0; if ($jTipsUser->hasTipped($this->id)) { jTipsLogger::_log($jTipsUser->id . " has tipped in round " . $this->id); foreach ($jGames as $jGame) { jTipsLogger::_log("Processing game " . $jGame->id); $params = array('user_id' => $jTipsUser->id, 'game_id' => $jGame->id); $jTip = new jTip($database); $jTip->loadByParams($params); // make sure this is not a bye game if (!$jGame->home_id or !$jGame->away_id or !$jGame->winner_id) { jTipsLogger::_log('attempting to process tips on a bye game, skipping', 'INFO'); continue; } /* * Feature Request 101 - Team Starts * Determine the winner when we take the starts into account * We only care about the starts for picking the winner/draw * For picking the margins and scores, use the actual winner */ if ($jSeason->team_starts) { jTipsLogger::_log('processing team starts'); $homeScore = $awayScore = 0; $homeScore = $jGame->home_score + ($jGame->home_start + 0); $awayScore = $jGame->away_score + ($jGame->away_start + 0); if ($homeScore > $awayScore) { $winnerID = $jGame->home_id; } else { if ($homeScore < $awayScore) { $winnerID = $jGame->away_id; } else { if ($homeScore == $awayScore) { $winnerID = -1; } } } jTipsLogger::_log('feature 101: With starts, the winner is ' . $winnerID . ', otherwise the winner is ' . $jGame->winner_id . " HOME {$homeScore} v AWAY {$awayScore}"); } else { $winnerID = $jGame->winner_id; } if ($jTip->tip_id == $winnerID) { //User tipped right! jTipsLogger::_log("CORRECT TIP by " . $jTipsUser->id . " in round_id " . $this->id . " in game_id " . $jGame->id); //BUG 248 - Add ToughScore if enabled if ($jSeason->tough_score and $jGame->tough_score) { $score += $jGame->tough_score; } if ($winnerID == -1) { $score += isset($jSeason->user_draw) ? $jSeason->user_draw : 0; jTipsLogger::_log("Draw correctly picked!"); } else { $score += isset($jSeason->user_correct) ? $jSeason->user_correct : 0; } $matching++; } if ($winnerID == $jGame->away_id) { $allAwayScore += $jSeason->user_correct; } //Check for correct margins and handle precision score gathering if ($jSeason->pick_margin == 1 and $jGame->has_margin == 1) { $margin = abs($jGame->home_score - $jGame->away_score); if ($jTip->margin == $margin) { $score += isset($jSeason->user_pick_margin) ? $jSeason->user_pick_margin : 0; jTipsLogger::_log("correct margin picked!"); } if ($jSeason->precision_score == 1) { if ($jGame->winner_id == $jTip->tip_id) { $margin_offset = abs($margin - $jTip->margin); } else { $margin_offset = abs($margin + $jTip->margin); } if (isset($worst_precision[$jGame->id]) && $margin_offset > $worst_precision[$jGame->id] || empty($worst_precision[$jGame->id])) { $worst_precision[$jGame->id] = $margin_offset; } $precision += $margin_offset; jTipsLogger::_log("PICK_MARGIN: Adding {$margin_offset} to precision of {$precision}"); } } //Check for correct scores and handle precision score gathering if ($jSeason->pick_score == 1 and $jGame->has_score == 1) { $margin = abs($jGame->home_score - $jGame->away_score); if ($jTip->home_score == $jGame->home_score and $jTip->away_score == $jGame->away_score) { $score += isset($jSeason->user_pick_score) ? $jSeason->user_pick_score : 0; jTipsLogger::_log("Correct scores picked!"); } if ($jSeason->precision_score == 1) { $pickedScoreMargin = abs($jTip->home_score - $jTips->away_score); if ($jGame->winner_id == $jTip->tip_id) { $score_offset = abs($margin - $pickedScoreMargin); } else { $score_offset = abs($margin + $pickedScoreMargin); } if (isset($worst_precision[$jGame->id]) and $score_offset > $worst_precision[$jGame->id] or empty($worst_precision[$jGame->id])) { $worst_precision[$jGame->id] = $score_offset; } $precision += $score_offset; jTipsLogger::_log("PICK_SCORE: Adding {$score_offset} to precision of {$precision}"); jTipsLogger::_log("PREC DEBUG: {$jTipsUser->id}-{$jTipsUser->user_id} Picked Margin: {$pickedScoreMargin}. Actual Margin: {$margin}. Applied Precision: {$score_offset}. Running Precision: {$precision}", 'INFO'); } } //Check for a bonus team selection if ($jSeason->pick_bonus >= 1 and $jGame->has_bonus == 1) { if ($jTip->bonus_id == $jGame->bonus_id && $jGame->bonus_id != -1) { $score += isset($jSeason->user_pick_bonus) ? $jSeason->user_pick_bonus : 0; } } } //was a perfect round picked? if ($matching == $played) { $score += isset($jSeason->user_bonus) ? $jSeason->user_bonus : 0; } //did the user use their 'doubleup' if ($jTipsUser->doubleup == $this->id and $jTips['DoubleUp'] == 1) { $score = $score * 2; } $scores[] = $score; //Save the data to the history object $jHistory = new jHistory($database); $jHistory->user_id = $jTipsUser->id; $jHistory->round_id = $this->id; jTipsLogger::_log("Score for user_id " . $jTipsUser->id . " in round_id " . $this->id . " is {$score}"); $jHistory->points = $score; //Update rank after all users have been saved $jHistory->outof = count($jTipsUsers); //$jHistory->comment = $jTipsUser->comment; if ($jSeason->precision_score == 1) { jTipsLogger::_log("setting precision to {$precision} for user_id " . $jTipsUser->id . " in round_id " . $this->id); $jHistory->precision = $precision; } else { $jHistory->precision = 0; } if ($jHistory->save() !== false) { $results[] = 1; } else { jTipsLogger::_log("Error saving history: " . $jHistory->_error); $results[] = 0; } //remove the current comment $jTipsUser->comment = null; $jTipsUser->save(); // Check if the AlphaUserPoints config option is set if (isJoomla15()) { $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php'; } else { $api_AUP = $mosConfig_absolute_path . 'components/com_alphauserpoints/helper.php'; } if (!$this->scored and $jTips['AlphaUserPoints'] and jTipsFileExists($api_AUP)) { require_once $api_AUP; jTipsLogger::_log('sending ' . $score . ' points for user ' . $jTipsUser->user_id, 'INFO'); $refID = AlphaUserPointsHelper::getAnyUserReferreID($jTipsUser->user_id); AlphaUserPointsHelper::newpoints('plgaup_jtips_total_points', $refID, '', '', $score); } if (!$this->scored and $jTips['JomSocialActivities'] and $jTips['JomSocialUserResults']) { global $mosConfig_absolute_path; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/utils/jTipsJomSocial.php'; jTipsJomSocial::writeRoundResult($jSeason, $this, $jTipsUser->user_id, $score); } } else { $noTips[] = $jTipsUser; } } if (count($noTips) > 0) { ///////////////////////////////////////////////// // Feature Request 71 // Allow users that did not to be assigned // all the away teams // /*if ($jSeason->user_none != -1) { $thisRound = $jSeason->user_none; } else if (is_array($scores) && count($scores) > 0) { $thisRound = min($scores); } else { $thisRound = 0; }*/ if ($jSeason->user_none == -2) { //handle all away teams $thisRound = $allAwayScore; jTipsLogger::_log("didn't tip? You'll be stuck with the away teams. You got {$thisRound}"); } else { if ($jSeason->user_none == -1) { //handle lowest possible score if (is_array($scores) and count($scores) > 0) { $thisRound = min($scores); jTipsLogger::_log("didn't tip? You'll be stuck with the lowest score this round, {$thisRound}"); } else { $thisRound = 0; jTipsLogger::_log("didn't tip? You'll be stuck {$thisRound}"); } } else { //handle allocated score $thisRound = $jSeason->user_none; jTipsLogger::_log("didn't tip? You're getting {$thisRound}"); } } // // END Feature Request 71 //////////////////////////////////////////////////// foreach ($noTips as $jTipsUser) { $jHistory = new jHistory($database); $jHistory->user_id = $jTipsUser->id; $jHistory->round_id = $this->id; $jHistory->points = $thisRound; $jHistory->precision = array_sum($worst_precision); //$jHistory->outof = count($jTipsUsers); //$jHistory->comment = $jTipsUser->comment; if ($jHistory->save() !== false) { $results[] = 1; } else { $results[] = 0; } $jTipsUser->save(); // Check if the AlphaUserPoints config option is set if (isJoomla15()) { $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php'; } else { $api_AUP = $mosConfig_absolute_path . 'components/com_alphauserpoints/helper.php'; } if (!$this->scored and $jTips['AlphaUserPoints'] and jTipsFileExists($api_AUP)) { require_once $api_AUP; jTipsLogger::_log('sending ' . $score . ' points for user ' . $jTipsUser->user_id, 'INFO'); $refID = AlphaUserPointsHelper::getAnyUserReferreID($jTipsUser->user_id); AlphaUserPointsHelper::newpoints('plgaup_jtips_total_points', $refID, '', '', $thisRound); } if (!$this->scored and $jTips['JomSocialActivities']) { global $mosConfig_absolute_path; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/utils/jTipsJomSocial.php'; if ($jTips['JomSocialUserResults']) { jTipsJomSocial::writeRoundResult($jSeason, $this, $jTipsUser->user_id, $score); } if ($jTips['JomSocialOnNoTips']) { jTipsJomSocial::writeOnNoTips($jTipsUser->user_id, $jSeason, $this); } } } } $jHistory = new jHistory($database); $jHistory->setRanks($this->id, true); if (!$this->scored and $jTips['JomSocialActivities']) { // find out who won the round and write it to the JomSocial stream $winners = $this->getRoundWinners(); jTipsJomSocial::writeRoundWinners($winners, $this, $jSeason); } $this->scored = 1; $result = $this->save(); //if ($this->scored != 1) { jTeam::updateLadder($this, $jSeason); //} //$this->scored = 1; //return $this->save(); return $result; }
function display() { global $jTips, $jLang; if (isJoomla15()) { JToolbarHelper::title($this->formData['title'], 'tips'); } else { ?> <table class='adminheading'> <tr><th><?php echo $this->formData['title']; ?> </th></tr> </table> <?php } ?> <form action='index2.php' name='adminForm' id='adminForm' method='post'> <input type="hidden" name="task" value="edit" /> <input type="hidden" name="option" value="com_jtips" /> <input type="hidden" name="module" value="Tips" /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <table class='adminform'> <?php foreach ($this->selectLists as $label => $list) { ?> <tr> <td width="20%"><?php echo $label; ?> : </td> <td><?php echo $list; ?> </td> <td> </td> </tr> <?php } ?> </table> <table class="adminlist"> <thead> <tr> <th colspan="2"><?php echo $jLang['_ADMIN_ROUND_HOME']; ?> </th> <th><?php echo $jLang['_COM_TIPS_HOMESCORE']; ?> </th> <th colspan="2"><?php echo $jLang['_ADMIN_ROUND_AWAY']; ?> </th> <th><?php echo $jLang['_COM_TIPS_AWAYSCORE']; ?> </th> <th width="5" align="center"><?php echo $jLang['_ADMIN_ROUND_DRAW']; ?> </th> <th><?php echo $jLang['_ADMIN_TIPSMAN_SCORE_MARGIN']; ?> </th> <th><?php echo $jLang['_ADMIN_CONF_BP']; ?> </th> </tr> </thead> <tbody> <?php $i = 0; foreach ($this->games as $game_id => $data) { ?> <tr class="row<?php echo $i++ % 2; ?> "> <td width="5" align="center"> <input type="hidden" name="game_id[]" value="<?php echo $game_id; ?> " /> <input type="hidden" name="id[]" value="<?php echo $data['id']; ?> " /> <input type="radio" name="g<?php echo $game_id; ?> [tip_id]" value="<?php echo $data['home']->id; ?> " <?php echo $data['home_tipped']; ?> /> </td> <td><?php echo $data['home']->getName(); ?> </td> <td><input type="text" name="g<?php echo $game_id; ?> [home_score]" size="5" value="<?php echo $data['home_score']; ?> " /></td> <td align="center"><input type="radio" name="g<?php echo $game_id; ?> [tip_id]" value="<?php echo $data['away']->id; ?> " <?php echo $data['away_tipped']; ?> /></td> <td><?php echo $data['away']->getName(); ?> </td> <td><input type="text" name="g<?php echo $game_id; ?> [away_score]" size="5" value="<?php echo $data['away_score']; ?> " /></td> <td align="center"><input type="radio" name="g<?php echo $game_id; ?> [tip_id]" value="-1" <?php echo $data['draw_tipped']; ?> /></td> <td><input type="text" name="g<?php echo $game_id; ?> [margin]" size="5" value="<?php echo $data['margin']; ?> " /></td> <td><?php echo $data['bonus_id']; ?> </td> </tr> <?php } ?> </tbody> </table> </form> <?php }
function display() { global $jTips, $jLang; if (isJoomla15()) { JToolBarHelper::title($this->formData['title'], 'user'); } else { ?> <table class='adminheading'> <tr> <th><?php echo $this->formData['title']; ?> </th> </tr> </table> <?php } ?> <script type='text/javascript'> function submitbutton(pressbutton) { if (pressbutton != 'list') { //are any users selected? if(document.adminForm.boxchecked.value==0) { alert('<?php echo $jLang['_ADMIN_USER_NEW_NO_SELECTION']; ?> '); return; } //is a season selected? if ($('season_id').value == '') { alert("<?php echo $jLang['_ADMIN_SEASON_SELECT_ALERT']; ?> "); return; } } submitform(pressbutton); } </script> <form action='index2.php' name='adminForm' id='adminForm' method='post'> <input type="hidden" name="task" value="edit" /> <input type="hidden" name="option" value="com_jtips" /> <input type="hidden" name="module" value="Users" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="filter_order" value="<?php echo jTipsGetParam($_REQUEST, 'filter_order'); ?> " /> <input type="hidden" name="filter_order_Dir" value="<?php echo jTipsGetParam($_REQUEST, 'filter_order_Dir'); ?> " /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <table class="adminform"> <?php foreach ($this->selectLists as $label => $list) { ?> <tr> <td width="20%"><?php echo $label; ?> : </td> <td><?php echo $list; ?> </td> <td> </td> </tr> <?php } ?> </table> <table class="adminlist"> <thead> <tr> <th align='center' width='1'>#</th> <th align="center" width='20'><input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($this->users); ?> );" /></th> <th><a href="javascript:tableOrdering('name', '<?php echo $this->nextDir; ?> ', 'edit');"><?php echo $jLang['_ADMIN_USERS_FULLNAME']; ?> </a></th> <th><a href="javascript:tableOrdering('username', '<?php echo $this->nextDir; ?> ', 'edit');"><?php echo $jLang['_ADMIN_USERS_USERNAME']; ?> </a></th> <th><a href="javascript:tableOrdering('email', '<?php echo $this->nextDir; ?> ', 'edit');"><?php echo $jLang['_ADMIN_USERS_EMAIL']; ?> </a></th> </tr> </thead> <tbody> <?php $i = 0; foreach ($this->users as $user) { ?> <tr class="row<?php echo $i % 2; ?> "> <td align="center"><?php echo $i + 1; ?> </td> <td align="center"><?php echo jTipsHTML::idBox($i, $user->id); ?> </td> <td><label for="cb<?php echo $i; ?> "><?php echo $user->name; ?> </label></td> <td><?php echo $user->username; ?> </td> <td><a href="mailto:<?php echo $user->email; ?> "><?php echo $user->email; ?> </a></td> </tr> <?php $i++; } ?> </tbody> <?php if (isJoomla15()) { ?> <tfoot> <tr> <td colspan="50"><?php echo $this->pageNav->getListFooter(); ?> </td> </tr> </tfoot> <?php } ?> </table> <?php if (!isJoomla15()) { echo $this->pageNav->getListFooter(); } ?> </form> <?php }
function EditView($title, $formData, $icon = 'generic') { global $jTips, $jLang; jTipsCommonHTML::loadCalendar(); ?> <form action="index2.php" name="adminForm" method="post" enctype="multipart/form-data"> <input type="hidden" name="option" value='<?php echo jTipsGetParam($_REQUEST, 'option', 'com_jtips'); ?> '> <input type='hidden' name='task' value=''> <input type="hidden" name="hidemainmenu" value="0" /> <input type='hidden' name='module' value='<?php echo jTipsGetParam($_REQUEST, 'module', ''); ?> '> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <?php if (isJoomla15()) { JToolBarHelper::title($title, $icon); } else { ?> <table class="adminheading"> <tr><th class="edit"><?php echo $title; ?> </th></tr> </table> <?php } foreach ($formData as $fieldset) { ?> <fieldset> <legend><?php echo $jLang[$fieldset['legend']]; ?> </legend> <table class="admintable" width="100%"> <tbody> <?php $hiddenFields = array(); foreach ($fieldset['fields'] as $row) { if ($row['field']['type'] == 'hidden') { $hiddenFields[] = $row; continue; } if ($row['field']['type'] == 'editor') { $colspan = 2; } else { $colspan = 1; } ?> <tr> <td class="key" width="25%"><label for="<?php echo $row['field']['attributes']['id']; ?> "><?php echo $jLang[$row['label']]; ?> </label></td> <td width="25%" colspan="<?php echo $colspan; ?> "><?php echo parseEditField($row['field']); ?> </td> <?php if ($colspan == 1) { ?> <td width="50%"><?php echo isset($row['description']) ? $jLang[$row['description']] : ""; ?> </td> <?php } ?> </tr><?php } ?> </tbody> <tfoot> </tfoot> </table> <?php //now loop on the hidden fields if (!empty($hiddenFields)) { foreach ($hiddenFields as $def) { echo parseEditField($def['field']); } } ?> </fieldset> <?php } ?> </form> <?php }
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>"; } }
* * */ global $database, $jTips, $jLang, $mosConfig_live_site, $jTipsCurrentUser, $mosConfig_absolute_path; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/utils/functions.inc.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jhistory.class.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jround.class.php'; require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jseason.class.php'; if ($params->get('load_mootools')) { $mainframe->addCustomHeadTag("<script type='text/javascript' src='" . $mosConfig_live_site . "/components/com_jtips/js/mootools.js'></script>"); } /* * quick check to make the xml file the right one so it appears * properly in the list of modules */ if (isJoomla15() and jTipsFileExists(dirname(__FILE__) . '/installer.xml')) { jimport('joomla.filesystem.file'); $data = JFile::read(dirname(__FILE__) . '/installer.xml'); JFile::write(dirname(__FILE__) . '/mod_jtips_dash_comp_ladder.xml', $data); JFile::delete(dirname(__FILE__) . '/installer.xml'); } $jSeason = new jSeason($database); $season_id = getSeasonID(); if (is_numeric($season_id)) { $jSeason->load($season_id); } else { $date = gmdate('Y-m-d'); //Bug 33.4 - Extended params array to default to season for current user $objParams = array('end_time' => array('type' => 'query', 'query' => "> '{$date}'"), 'left_join' => array('type' => 'left_join', 'join_table' => '#__jtips_users', 'lhs_table' => '#__jtips_seasons', 'lhs_key' => 'id', 'rhs_table' => '#__jtips_users', 'rhs_key' => 'season_id')); if (isset($jTipsUser->user_id) and !empty($jTipsUser->user_id)) { $objParams['#__jtips_users.user_id'] = $jTipsUser->user_id;
function display() { global $jTips, $jLang, $mainframe; jTipsCommonHTML::loadCalendar(); if (isJoomla15()) { JToolBarHelper::title($this->formData['title'], 'round'); } else { ?> <table class='adminheading'> <tr> <th><?php echo $this->formData['title']; ?> </th> </tr> </table> <?php } ?> <style type="text/css"> .hide { display:none; } </style> <form action='index2.php' name='adminForm' id='adminForm' method='post'> <input type="hidden" name="task" value="edit" /> <input type="hidden" name="option" value="com_jtips" /> <input type="hidden" name="module" value="Rounds" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="id" id="id" value="<?php echo $this->focus->id; ?> " /> <input type="hidden" name="filter_order" value="<?php echo jTipsGetParam($_REQUEST, 'filter_order'); ?> " /> <input type="hidden" name="filter_order_Dir" value="<?php echo jTipsGetParam($_REQUEST, 'filter_order_Dir'); ?> " /> <input type="hidden" name="<?php echo jTipsSpoofValue(); ?> " value="1" /> <fieldset> <legend><?php echo $jLang['_ADMIN_ROUND_LEGEND']; ?> </legend> <table class='admintable' width="100%"> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_SEASON_SELECT']; ?> </td> <td><?php echo $this->selectLists['season_id']; ?> </td> </tr> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_ROUND_ROUND']; ?> </td> <td><?php echo $this->selectLists['roundnum']; ?> </td> </tr> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_ROUND_START'] . " " . $jLang['_ADMIN_ROUND_DATE'] . " & " . $jLang['_ADMIN_ROUND_TIME']; ?> </td> <td> <input type="text" name="date_start_date" size="30" value="<?php echo $this->date_start_date; ?> " id="date_start_date" /> <img src='components/com_jtips/images/calendar.png' onclick='return showCalendar("date_start_date", "<?php echo $jTips['DateFormat']; ?> ");' border='0' alt='...' align='absmiddle' /> <?php echo $this->date_start_time_hour; ?> :<?php echo $this->date_start_time_minute; ?> <?php echo $this->date_start_time_meridiem; ?> </td> </tr> <tr> <td class="key" width="25%"><?php echo $jLang['_ADMIN_ROUND_END'] . " " . $jLang['_ADMIN_ROUND_DATE'] . " & " . $jLang['_ADMIN_ROUND_TIME']; ?> </td> <td> <input type="text" name="date_end_date" size="30" value="<?php echo $this->date_end_date; ?> " id="date_end_date" /> <img src='components/com_jtips/images/calendar.png' onclick='return showCalendar("date_end_date", "<?php echo $jTips['DateFormat']; ?> ");' border='0' alt='...' align='absmiddle' /> <?php echo $this->date_end_time_hour; ?> :<?php echo $this->date_end_time_minute; ?> <?php echo $this->date_end_time_meridiem; ?> </td> </tr> <tr> <td class="key" width="25%"><label for="show_comments"><?php echo $jLang['_ADMIN_ROUND_SHOW_COMMENTS']; ?> </label></td> <td><input type="checkbox" id="show_comments" onClick="$$('.info').toggleClass('hide');" /></td> </tr> </table> </fieldset> <fieldset> <legend><?php echo $jLang['_ADMIN_ROUND_GAMES_LEGEND']; ?> </legend> <?php if (!$this->focus->getStatus() or !$this->focus->exists()) { ?> <p><input type="button" disabled class="button" onClick="addGameRow();toggleColumns();" id="addgame" value="Add Game" /> <input type="button" disabled class="button" onClick="removeGameRow();toggleColumns();" id="removegame" value="Remove Game(s)" /></p> <?php } ?> <div id="round_loading" style="text-align:center;"><img src="components/com_jtips/images/loading.gif" alt="Loading..." border="0" /></div> <table class="adminlist" id="games_list" style="display:none;opacity:0;"> <thead> <tr> <!--th align='center' width='1'>#</th--> <th align="center" width='20'> </th> <th id="left_team_th"> </th> <th id="right_team_th"> </th> <th><?php echo $jLang['_ADMIN_ROUND_ORDER']; ?> </th> <th class="pick_score"><input type='checkbox' onclick='toggleYesNo(this, "score");' <?php echo (is_numeric($this->status) and $this->focus->exists()) ? "style='display:none;'" : ""; ?> id="pick_score_toggle" /> <label for="pick_score_toggle"><?php echo $jLang['_ADMIN_GAME_HAS_SCORE']; ?> </label></th> <th class="pick_margin"><input type='checkbox' onclick='toggleYesNo(this, "margin");' <?php echo (is_numeric($this->status) and $this->focus->exists()) ? "style='display:none;'" : ""; ?> id="pick_margin_toggle" /> <label for="pick_margin_toggle"><?php echo $jLang['_ADMIN_GAME_HAS_MARGIN']; ?> </label></th> <th class="pick_bonus"><input type='checkbox' onclick='toggleYesNo(this, "bonus");' <?php echo (is_numeric($this->status) and $this->focus->exists()) ? "style='display:none;'" : ""; ?> id="pick_bonus_toggle" /> <label for="pick_bonus_toggle"><?php echo $jLang['_ADMIN_GAME_HAS_BONUS']; ?> </label></th> <th id="left_start_th" class="team_starts"> </th> <th id="right_start_th" class="team_starts"> </th> <th id="tough_score_th" class="tough_score"> </th> <th class="date_time"><?php echo $jLang['_ADMIN_GAME_TIME']; ?> </th> <th id="left_score_th" class="results"> </th> <th id="right_score_th" class="results"> </th> <th class="bonus_results"><?php echo $jLang['_ADMIN_GAME_BONUS']; ?> </th> <th id="info_th" class="info hide"><?php echo $jLang['_ADMIN_ROUNDS_INFO']; ?> </th> </tr> </thead> <tbody id="table"> </tbody> </table> </fieldset> </form> <?php $init = "\n\t\t<script type='text/javascript'>\n\t\twindow.addEvent('domready', function() {\n\t\t\tgetTheRounds(\$('season_id'))\n\t\t});\n\t\t</script>"; if (isJoomla15()) { $mainframe->addCustomHeadTag($init); } else { echo $init; } }