$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()); if (in_array(FALSE, $destroyed)) { $message = 'Season(s) not cleanly removed!'; } else { $message = 'Season(s) deleted!'; }
* @version 2.1 * @package jTips * * Description: */ require_once 'components/com_jtips/classes/juser.class.php'; global $database, $jLicence; $season_id = jTipsGetParam($_REQUEST, 'season_id', false); $result = array(); $success = $fail = 0; if (is_numeric($season_id)) { foreach (jTipsGetParam($_REQUEST, 'cid', array()) as $uid) { $jTipsUser = new jTipsUser($database); $params = array('user_id' => $uid, 'season_id' => $season_id); $jTipsUser->loadByParams($params); if ($jTipsUser->exists() === false) { $jTipsUser->user_id = $uid; $jTipsUser->season_id = $season_id; $jTipsUser->status = 1; $saved = $jTipsUser->save(); if ($saved !== false) { $success++; array_push($result, 1); } else { $fail++; array_push($result, 0); } } else { $fail++; array_push($result, 0); }