Exemplo n.º 1
0
$id = jTipsGetParam($_REQUEST, 'id', false);
if (!$id or !is_numeric($id)) {
    // BUG 373 - Round fails to copy
    jTipsLogger::_log('No round id specified to copy!', 'ERROR');
    mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $jLang['_ADMIN_ROUND_COPY_FAIL']);
}
$focus = new jRound($database);
$focus->load($id);
$focus->id = null;
$focus->round = jTipsGetParam($_REQUEST, 'round', '');
$focus->scored = 0;
if (!$focus->round) {
    jTipsLogger::_log('No Round number entered when copying round, determine next one.', 'ERROR');
    $query = "SELECT MAX(round)+1 AS nextround FROM #__jtips_rounds WHERE season_id = '" . $focus->season_id . "'";
    $database->setQuery($query);
    $focus->round = $database->loadResult();
}
$focus->save();
$query = "SELECT id FROM #__jtips_games WHERE round_id = '" . $database->getEscaped($id) . "'";
$database->setQuery($query);
$game_ids = $database->loadResultArray();
if (!empty($game_ids)) {
    foreach ($game_ids as $gid) {
        $jGame = new jGame($database);
        $jGame->load($gid);
        $jGame->round_id = $focus->id;
        $jGame->id = null;
        $jGame->save();
    }
}
mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $jLang['_ADMIN_ROUND_COPY_SUCCESS']);
Exemplo n.º 2
0
$end_time_time = jTipsGetParam($_REQUEST, 'date_end_time_hour', '') . ":" . str_pad($end_minute, 2, '0', STR_PAD_LEFT) . jTipsGetParam($_REQUEST, 'date_end_time_meridiem', '');
if (!preg_match('/\\d/', $end_time_time)) {
    $end_time_time = strftime($jTips['TimeFormat']);
}
$end_time = $end_time_date . " " . $end_time_time;
//BUG 263 - set the date fields if we are in J1.0
if (!isJoomla15()) {
    $jRound->end_time = TimeDate::toDisplayDate($jRound->end_time);
}
$jRound->end_time = TimeDate::toDatabaseDateTime($end_time);
$jRound->season_id = $season_id;
$jRound->round = jTipsGetParam($_REQUEST, 'roundnum', 0);
if (!is_numeric($jRound->scored)) {
    $jRound->scored = 0;
}
if ($jRound->save()) {
    $message = 'Round Saved!';
} else {
    $message = 'Save Failed: ' . $jRound->_error;
}
$games = jTipsGetParam($_REQUEST, 'game', array());
for ($i = 0; $i < count($games); $i++) {
    $jGame = new jGame($database);
    if (jTipsGetParam($_REQUEST, 'id', false)) {
        $game_id = jTipsGetParam($games, $i, -1);
        $jGame->load($game_id);
        $newRound = false;
    } else {
        $newRound = true;
        //BUG 253 - save past rounds easily
    }
Exemplo n.º 3
0
 * Website: www.jtips.com.au
 * @author Jeremy Roberts
 * @copyright Copyright &copy; 2009, jTips
 * @license Commercial - See website for details
 * 
 * @since 2.1.10 - 20/05/2009
 * @version 1.0.0
 * @package jTips
 * 
 * Description: Marks selected rounds as uncomplete
 * which then allows editing fully a round.
 * 
 * // BUG 351 - allow uncompleting a round
 */
jTipsSpoofCheck();
global $mosConfig_absolute_path, $database, $jLang;
require_once $mosConfig_absolute_path . '/administrator/components/com_jtips/classes/jround.class.php';
$cid = jTipsGetParam($_REQUEST, 'cid', array());
if ($cid === false or is_array($cid) and count($cid) == 0) {
    //should never get here
    mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $jLang['_ADMIN_ROUNDS_NONE_TO_PROCESS']);
}
jTipsLogger::_log('uncompleting rounds');
foreach ($cid as $id) {
    $jRound = new jRound($database);
    $jRound->load($id);
    $jRound->scored = 0;
    $jRound->save();
}
$msg = count($cid) . ' ' . $jLang['_ADMIN_ROUNDS_UNCOMPLETED'];
mosRedirect('index2.php?option=com_jtips&module=Rounds&task=list', $msg);