Exemple #1
0
<?php

defined('_JEXEC') or defined('_VALID_MOS') or die('Restricted Access');
/**
 * Website: www.jtips.com.au
 * @author Jeremy Roberts
 * @copyright Copyright &copy; 2009, jTips
 * @license Commercial - See website for details
 * 
 * @since 2.1 - 08/10/2008
 * @version 2.1
 * @package jTips
 * 
 * Description: Delete the selected rounds and their related games
 */
jTipsSpoofCheck();
global $mainframe, $database;
require_once 'components/com_jtips/classes/jgame.class.php';
require_once 'components/com_jtips/classes/jround.class.php';
$cids = jTipsGetParam($_REQUEST, 'cid', array());
$jRound = new jRound($database);
$success = 0;
foreach ($cids as $rid) {
    if ($jRound->destroy($rid)) {
        $success++;
    } else {
        jTipsLogger::_log("Failed to delete round with id: {$rid} - " . $jRound->_error);
    }
}
$message = "{$success} / " . count($cids) . " " . $jLang['_ADMIN_ROUND_DELETED'];
mosRedirect('index2.php?option=com_jtips&task=list&module=Rounds', $message);
Exemple #2
0
 $jSeason = new jSeason($database);
 $jSeason->load($id);
 jTipsLogger::_log('Deleting season ' . $jSeason->name);
 $params = array('season_id' => $id);
 $jRound = new jRound($database);
 $jRounds = $jSeason->loadByParams($params);
 if (!is_array($jRounds)) {
     if ($jRound->exists()) {
         $jRounds = array($jRound);
     } else {
         $jRounds = array();
     }
 }
 jTipsLogger::_log('deleting rounds from season');
 foreach ($jRounds as $jRound) {
     array_push($destroyed, $jRound->destroy());
 }
 $jTipsUser = new jTipsUser($database);
 $jTipsUsers = $jTipsUser->loadByParams($params);
 if (!is_array($jTipsUsers)) {
     if ($jTipsUser->exists()) {
         $jTipsUsers = array($jTipsUser);
     } else {
         $jTipsUsers = array();
     }
 }
 jTipsLogger::_log('deleting users from season');
 foreach ($jTipsUsers as $jTipsUser) {
     array_push($destroyed, $jTipsUser->destroy());
 }
 array_push($destroyed, $jSeason->destroy());