function &getUser($season_id, $rounds, $show_detail) { // load the season $db =& JFactory::getDBO(); $season = new jSeason($db); $season->load($season_id); $current_round_id = $season->getCurrentRound(); // echo "<br>CURRENT ROUND ID: " .$current_round_id; // get the round number for the current round $query = "SELECT round FROM #__jtips_rounds WHERE id = " . $db->Quote($current_round_id); $db->setQuery($query); $current_round_number = $db->loadResult(); // echo "<br>CURRENT ROUND NUM: " .$current_round_number; // is the current round a multiple of $rounds? $mod = $current_round_number % $rounds; // echo "<br>MOD = " .$mod; // upper limit $upper = $current_round_number - $mod; if ($upper < 0) { $upper = 0; } // echo "<br>UPPER = " .$upper; // lower limit $lower = $upper - $rounds + 1; if ($lower < 0) { $lower = 0; } // echo "<br>LOWER = " .$lower; // get the round numbers for all the rounds between $round_numbers = array(); for ($i = $lower; $i <= $upper; $i++) { $round_numbers[] = $i; } // get the ids for these rounds $query = "SELECT id FROM #__jtips_rounds WHERE round IN (" . implode(", ", $round_numbers) . ") AND season_id = " . $db->Quote($season_id); $db->setQuery($query); $ids = $db->loadResultArray(); // get the scores for the rounds between the lower and upper limits $query = " SELECT user_id, SUM(points) AS total FROM #__jtips_history " . " WHERE round_id IN (" . implode(", ", $ids) . ") " . " GROUP BY user_id ORDER BY total DESC"; // echo $query; $db->setQuery($query, 0, 1); $win = $db->loadObject(); $jTipsUser = new jTipsUser($db); $jTipsUser->load($win->user_id); $data = array('who' => $jTipsUser, 'points' => $win->total); if ($show_detail) { $query = "SELECT #__jtips_rounds.round, #__jtips_history.points, #__jtips_history.rank FROM #__jtips_history " . " JOIN #__jtips_rounds ON #__jtips_history.round_id = #__jtips_rounds.id " . " WHERE user_id = {$win->user_id} AND #__jtips_history.round_id IN (" . implode(", ", $ids) . ") " . " ORDER BY #__jtips_rounds.round ASC"; $db->setQuery($query); $data['results'] = $db->loadAssocList(); } else { $data['results'] = array(); } return $data; }
$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; } $jSeasons = forceArray($jSeason->loadByParams($objParams)); if (count($jSeasons) > 0) { $jSeason =& array_shift($jSeasons); } } $jRound = new jRound($database); $round_id = $jSeason->getCurrentRound(); $jRound->load($round_id);
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);
function getSeasonName() { global $database; if (!isset($this->season_name)) { $jSeason = new jSeason($database); $jSeason->load($this->season_id); $this->season_name = $jSeason->name; } return $this->season_name; }
} else { require_once $mosConfig_absolute_path . '/components/com_jtips/views/CompetitionLadder/ShowTipsRender.php'; } if (!isJoomla15()) { //Trash anything we have so far ob_clean(); ob_start(); } $render = new jTipsRenderShowTips(); $user_id = jTipsGetParam($_REQUEST, 'uid', ''); $jTipsUser = new jTipsUser($database); $jTipsUser->load($user_id); $render->assign('jTipsUser', $jTipsUser); $round_id = jTipsGetParam($_REQUEST, 'rid', ''); $jSeason = new jSeason($database); $jSeason->load($jTipsUser->season_id); $render->assign('jSeason', $jSeason); $jRound = new jRound($database); if ($round_id == false) { $complete = 0; while ($complete !== 1) { $tempRound = new jRound($database); if ($round_id == false) { $round_id = $jSeason->getCurrentRound(); } $tempRound->load($round_id); $round_id = $tempRound->getPrev(); if (!is_numeric($round_id)) { break; } $jRound = new jRound($database);
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jtip.class.php'; jTipsLogger::_log('about to start saving tips'); //TODO: remove this if (empty($jTipsCurrentUser->id)) { die('No jTips User!'); } $jRound = new jRound($database); $jRound->load(jTipsGetParam($_REQUEST, 'round_id', 0)); // BUG 389 - Can save tips by hacking HTML with Firebug if (!$jRound->id or $jRound->getStatus() !== false) { // trying to post to an invalid round or round in progress jTipsRedirect('index.php?option=com_jtips&Itemid=' . $Itemid, $jLang['_COM_CANNOT_POST_CLOSED']); exit; } $jSeason = new jSeason($database); $jSeason->load($jRound->season_id); $jGame = new jGame($database); $jGameParams = array('round_id' => $jRound->id); $jGames = forceArray($jGame->loadByParams($jGameParams)); $myTips = array(); $isUpdate = null; foreach ($jGames as $jGame) { $game_id = 'game' . $jGame->id; jTipsLogger::_log('saving tips for game ' . $jGame->id); $jTip = new jTip($database); $jTipParams = array('user_id' => $jTipsCurrentUser->id, 'game_id' => $jGame->id); $jTip->loadByParams($jTipParams); if ($jTip->exists() === false || empty($jTip->user_id) || empty($jTip->game_id)) { $jTip->user_id = $jTipsCurrentUser->id; $jTip->game_id = $jGame->id; if (is_null($isUpdate)) {
function _getTotalPoints() { $jSeason = new jSeason($this->_db); $jSeason->load($this->season_id); $winPoints = $this->wins * (isset($jSeason->team_win) ? $jSeason->team_win : 1); $losePoints = $this->losses * (isset($jSeason->team_lose) ? $jSeason->team_lose : 0); $drawPoints = $this->draws * (isset($jSeason->team_draw) ? $jSeason->team_draw : 0); //handle the bonus points if ($jSeason->team_bonus) { $bonusPoints = $this->_getBonusPoints($jSeason); } else { $bonusPoints = 0; } return $winPoints + $losePoints + $drawPoints + $bonusPoints; }
* * @since 2.1 - 30/09/2008 * @copyright Copyright © 2009, jTips * @author Jeremy Roberts * @package jTips * @version 2.1 * * Description: Save the season data from the posted form */ global $mainframe, $database, $mosConfig_absolute_path; //Make sure this is not a hack job jTipsSpoofCheck(); require_once 'components/com_jtips/classes/jseason.class.php'; $jSeason = new jSeason($database); if ($id = jTipsGetParam($_REQUEST, 'id', FALSE)) { $jSeason->load($id); } $jSeason->bind($_REQUEST); //BUG 263 - set the date fields if we are in J1.0 if (!isJoomla15()) { $jSeason->start_time = TimeDate::toDisplayDate($jSeason->start_time); $jSeason->end_time = TimeDate::toDisplayDate($jSeason->end_time); } if ($_FILES['image']['name'] and imageDirCheck()) { $logofile = 'images/jtips/' . $_FILES['image']['name']; if (isJoomla15()) { jimport('joomla.filesystem.file'); jTipsLogger::_log('MOVING ' . $_FILES['image']['tmp_name'] . ' TO ' . $logofile, 'ERROR'); //JFile::move($_FILES['image']['tmp_name'], $mosConfig_absolute_path.'/'.$logofile); //BUG 270 - to complete upload, use the upload function, not move JFile::upload($_FILES['image']['tmp_name'], $mosConfig_absolute_path . '/' . $logofile);
function loadByParams($params = array(), $limit = FALSE, $offset = FALSE) { global $database; $extra_clause = ""; if ($limit !== FALSE and !empty($limit)) { $extra_clause .= " LIMIT {$limit}"; } if ($offset !== FALSE and !empty($offset)) { $extra_clause .= " OFFSET {$offset}"; } $query = "SELECT " . $this->_tbl . ".id FROM " . $this->_tbl . " " . buildWhere($params) . " {$extra_clause};"; jTipsLogger::_log($params, 'jSeason->loadByParams:'); $database->setQuery($query); $database->query(); if ($database->getNumRows() > 1) { $jObjs = array(); $list = (array) $database->loadResultArray(); foreach ($list as $id) { $jObj = new jSeason($database); $jObj->load($id); array_push($jObjs, $jObj); } return $jObjs; } else { if ($database->getNumRows() == 1) { $load_id = $database->loadResult(); $this->load($load_id); return $this; } else { return FALSE; } } }
* @copyright Copyright © 2009, jTips * @license Commercial - See website for details * * @since 2.1.9 - 06/04/2009 * @version 1.0.0 * @package jTips * * Description: */ require_once 'components/com_jtips/classes/jround.class.php'; require_once 'components/com_jtips/classes/jseason.class.php'; require_once 'components/com_jtips/modules/Rounds/copy.tmpl.php'; global $database, $jTips, $jLang; $tpl = new CopyMode(); $tpl->formData['title'] = $jLang['_ADMIN_ROUND_COPY']; // load the round id being copied $focus = new jRound($database); $ids = jTipsGetParam($_REQUEST, 'cid', array()); if (!empty($ids)) { $id = array_shift($ids); $focus->load($id); } else { mosRedirect('index2.php?option=com_jtips&module=Rounds&task=list', $jLang['_ADMIN_ROUND_COPY_NOROUND']); } $tpl->round = $focus->round; $tpl->round_id = $focus->id; // load the season info $jSeason = new jSeason($database); $jSeason->load($focus->season_id); $tpl->season_name = $jSeason->name; $tpl->display();
function getLast(&$jTipsUser, $field = 'points') { global $database; $jSeason = new jSeason($database); $jSeason->load($jTipsUser->season_id); $jRound = new jRound($database); $jRound->load($jSeason->getLatestRound()); if ($jRound->scored != 1) { $jRound->load($jRound->getPrev()); } //$prev_id = $jRound->getPrev(); //$jRound->load($prev_id); $query = "SELECT `{$field}` FROM #__jtips_history WHERE user_id = " . $jTipsUser->id . " AND round_id = " . $jRound->id . ";"; //jTipsDebug($query); $database->setQuery($query); $res = $database->loadResult(); return is_numeric($res) ? floatval($res) : 0; }
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; }
/** * Sends an email to the user confirming their selections * TODO: Make the email customisable * * @param object The jTipsUser to send to * @param array The set of tips for the user */ function sendTipsConfirmation($jTipsUser, $tips) { global $database, $jTips; if (!$jTips['TipsNotifyEnable']) { jTipsLogger::_log('tips confirmation email disabled', 'INFO'); return true; } jTipsLogger::_log('building tips confirmation email'); $jSeason = new jSeason($database); $jSeason->load($jTipsUser->season_id); $from_name = $jTips['UserNotifyFromName']; $from_email = $jTips['UserNotifyFromEmail']; if ($jTips['DisplayName'] == 'user') { $name = 'username'; } else { $name = 'name'; } $subject = "Selection Confirmation"; $content = "Hi " . $jTipsUser->getUserField($name) . ",<br /><br />" . "Thanks for submitting your tips!<br /><br />" . "You picked:<br /><br />"; foreach ($tips as $jTip) { $jGame = new jGame($database); $jGame->load($jTip->game_id); $home = new jTeam($database); $away = new jTeam($database); $home->load($jGame->home_id); $away->load($jGame->away_id); $phrase = 'to defeat'; if ($jTip->tip_id == $home->id or $jTip->tip_id == '-1') { $tipped =& $home; $notTipped =& $away; } else { $tipped =& $away; $notTipped =& $home; } if ($jTip->tip_id == '-1') { $phrase = 'to draw with'; } $content .= $tipped->getName() . " {$phrase} " . $notTipped->getName(); if ($jSeason->pick_margin == 1 and $jGame->has_margin == 1) { $content .= " by " . ($jTip->margin ? $jTip->margin : '0'); } if ($jSeason->pick_score == 1 and $jGame->has_score == 1) { $content .= " with a final score of "; if ($jTip->tip_id == $home->id or $jTip->tip_id == '-1') { $content .= $jTip->home_score . " to " . $jTip->away_score; } else { $content .= $jTip->away_score . " to " . $jTip->home_score; } } $content .= "<br />"; } $content .= "<br />"; $content .= "Good Luck!<br />"; $content .= $from_name; //BUG 223 - Send the email in plaintext for best compatibility, so convert the line breaks $content = str_replace('<br />', "\n", $content); jTipsLogger::_log($content, 'ERROR'); jTipsLogger::_log('sending tips confirmation email to ' . $jTipsUser->getUserField('email') . ' from <' . $from_email . '>'); if (jTipsMail($from_email, $from_name, $jTipsUser->getUserField('email'), $subject, $content)) { jTipsLogger::_log('tips email confirmation sent', 'INFO'); return true; } else { jTipsLogger::_log('failed to sent tips confirmation email', 'ERROR'); return false; } }
function fillInAdditionalFields() { global $database; $jTipsUser = new jTipsUser($database); $jTipsUser->load($this->user_id); $this->user =& $jTipsUser; $jTeam = new jTeam($database); if ($this->tip_id > 0) { $jTeam->load($this->tip_id); } $this->team =& $jTeam; $jGame = new jGame($database); $jGame->load($this->game_id); $jRound = new jRound($database); $jRound->load($jGame->round_id); $this->round =& $jRound; $this->round_num = $jRound->round; $jSeason = new jSeason($database); $jSeason->load($jRound->season_id); $this->season =& $jSeason; }
require_once $include_path . 'classes/jteam.class.php'; require_once $include_path . 'classes/jgame.class.php'; include $include_path . 'config.jtips.php'; /* * 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_teams.xml', $data); JFile::delete(dirname(__FILE__) . '/installer.xml'); } //Get the season $jSeason = new jSeason($database); $jSeason->load(getSeasonID()); if (isset($jSeason->id) and !empty($jSeason->id)) { //parse info here $fieldOptions = array('-1' => '--None--', 'points' => 'Points', 'wins' => 'Wins', 'played' => 'Played', 'points_for' => 'GF', 'points_against' => 'GA'); ?> <table width="100%" border="0" id="mod_jtips_team_table" cellspacing="0"> <thead> <tr class="sectiontableheader jtableheader"> <th>#</th> <th><?php echo $jLang['_COM_TLD_TEAM']; ?> </th> <?php if ($team_field != '-1') { ?>