예제 #1
0
 /**
  * Updates the team points based on the round passed in
  */
 static function updateLadder($jRound, $jSeason)
 {
     jTipsLogger::_log('updating team ladder for round ' . $jRound->id);
     global $database;
     $params = array('round_id' => $jRound->id);
     $jGame = new jGame($database);
     $jGames = forceArray($jGame->loadByParams($params));
     $byeTeams = array();
     foreach ($jGames as $jGame) {
         $home = new jTeam($database);
         $away = new jTeam($database);
         $homeLoaded = $awayLoaded = false;
         if ($jGame->home_id) {
             $home->load($jGame->home_id);
             $homeLoaded = true;
         }
         if ($jGame->away_id) {
             $away->load($jGame->away_id);
             $awayLoaded = true;
         }
         if (!$homeLoaded and $awayLoaded) {
             $byeTeams[] = $away;
         }
         if ($homeLoaded and !$awayLoaded) {
             $byeTeams[] = $home;
         }
         if (!$homeLoaded or !$awayLoaded) {
             continue;
         }
         // nothing to process here
         $home->wins = $home->_getNumberOfWins();
         $home->losses = $home->_getNumberOfLosses();
         $home->draws = $home->_getNumberOfDraws();
         $home->points_for = $home->_getPointsFor();
         $home->points_against = $home->_getPointsAgainst();
         $home->points = $home->_getTotalPoints();
         $away->wins = $away->_getNumberOfWins();
         $away->losses = $away->_getNumberOfLosses();
         $away->draws = $away->_getNumberOfDraws();
         $away->points_for = $away->_getPointsFor();
         $away->points_against = $away->_getPointsAgainst();
         $away->points = $away->_getTotalPoints();
         $home->save();
         $away->save();
     }
     if (!empty($byeTeams)) {
         foreach ($byeTeams as $team) {
             $team->wins = $team->_getNumberOfWins();
             $team->losses = $team->_getNumberOfLosses();
             $team->draws = $team->_getNumberOfDraws();
             $team->points_for = $team->_getPointsFor();
             $team->points_against = $team->_getPointsAgainst();
             $team->points = $team->_getTotalPoints();
             $team->points += $jSeason->team_bye;
             $team->save();
         }
     }
 }
예제 #2
0
파일: save.php 프로젝트: joomux/jTips
     * This is the only part that requires actual apache access to the images directory
     * Difficult to resize an image if apache cannot write the image anywhere
     */
    $ti = new ThumbnailImage();
    $ti->src_file = $_FILES['logo']['tmp_name'];
    $ti->dest_type = THUMB_JPEG;
    $ti->dest_file = $mosConfig_absolute_path . '/images/jtips/' . $filename_100;
    $ti->max_width = 100;
    $ti->max_height = 100;
    $ti->Output();
    $ti = null;
    $ti = new ThumbnailImage();
    $ti->src_file = $_FILES['logo']['tmp_name'];
    $ti->dest_type = THUMB_JPEG;
    $ti->dest_file = $mosConfig_absolute_path . '/images/jtips/' . $filename_25;
    $ti->max_width = 25;
    $ti->max_height = 25;
    $ti->Output();
    $jTeam->logo = 'images/jtips/' . $filename;
} else {
    if (jTipsGetParam($_REQUEST, 'remove_logo', 0) == 1) {
        $jTeam->logo = '';
    }
}
if (!$jTeam->save()) {
    $message = 'Save Failed!';
} else {
    $message = 'Team Saved!';
}
//show_teams($option);
mosRedirect('index2.php?option=com_jtips&task=list&module=Teams', $message);