function _getData() { // turnier $query = 'SELECT name, teil, typ, tiebr1, tiebr2, tiebr3' . ' FROM #__clm_turniere' . ' WHERE id = ' . $this->param['id']; $this->_db->setQuery($query); $this->turnier = $this->_db->loadObject(); // players $query = 'SELECT *' . ' FROM #__clm_turniere_tlnr' . $this->_sqlWhere(); $this->playersTotal = $this->_getListCount($query); $query .= $this->_sqlOrder() . ' LIMIT ' . $this->limitstart . ', ' . $this->limit; $this->_db->setQuery($query); $this->turPlayers = $this->_db->loadObjectList(); // Flag, ob gestartet $tournament = new CLMTournament($this->param['id'], TRUE); $tournament->checkTournamentStarted(); $this->turnier->started = $tournament->started; // wenn nicht gestartet, check, ob Startnummern okay if (!$tournament->started and !$tournament->checkCorrectSnr()) { JError::raiseWarning(500, JText::_('PLEASE_CORRECT_SNR')); } }
function _getData() { // turnier $query = 'SELECT name, teil, typ, tiebr1, tiebr2, tiebr3, tl, params' . ' FROM #__clm_turniere' . ' WHERE id = ' . $this->param['id']; $this->_db->setQuery($query); $this->turnier = $this->_db->loadObject(); // players $query = 'SELECT a.*, rt.name as koRoundName ' . ' FROM #__clm_turniere_tlnr as a' . ' LEFT JOIN #__clm_turniere_rnd_termine AS rt ON rt.turnier = a.turnier AND rt.nr = a.koRound ' . $this->_sqlWhere(); $this->playersTotal = $this->_getListCount($query); if ($this->limit > 0) { $query .= $this->_sqlOrder() . ' LIMIT ' . $this->limitstart . ', ' . $this->limit; } $this->_db->setQuery($query); $this->turPlayers = $this->_db->loadObjectList(); // Flag, ob gestartet $tournament = new CLMTournament($this->param['id'], true); $tournament->checkTournamentStarted(); $this->turnier->started = $tournament->started; // wenn nicht gestartet, check, ob Startnummern okay if (!$tournament->started and !$tournament->checkCorrectSnr()) { JError::raiseWarning(500, JText::_('PLEASE_CORRECT_SNR')); } }
function checkData() { // aktuelle Turnierdaten laden $tournament = new CLMTournament($this->id, true); if (trim($this->name) == '') { // Name vorhanden $this->setError(CLMText::errorText('NAME', 'MISSING')); return false; } elseif ($this->sid <= 0) { // SaisonID > 0 $this->setError(CLMText::errorText('SEASON', 'IMPOSSIBLE')); return false; } elseif (!is_numeric($this->teil)) { // Teilnehmerzahl = Zahl $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'NOTANUMBER')); return false; } elseif ($this->teil <= 1) { // Teilnehmerzahl >= 2 $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'TOOLOW')); return false; } elseif ($this->teil > 500) { // Teilnehmerzahl $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'TOOBIG')); return false; } elseif ($this->teil < $tournament->getPlayersIn()) { $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'MOREPLAYERSIN')); return false; } elseif (!is_numeric($this->runden)) { // Runden = Zahl $this->setError(CLMText::errorText('ROUNDS_COUNT', 'NOTANUMBER')); return false; } elseif ($this->runden < 1) { // Runden >= 2 $this->setError(CLMText::errorText('ROUNDS_COUNT', 'TOOLOW')); return false; } elseif ($this->runden > 50) { // Runden $this->setError(CLMText::errorText('ROUNDS_COUNT', 'TOOBIG')); return false; } elseif ($this->typ != 3 and ($this->dg < 1 or $this->dg > 4)) { // DG möglich $this->setError(CLMText::errorText('STAGE_COUNT', 'IMPOSSIBLE')); return false; // Runden schon erstellt? dann keine Änderung Typ, Runden, dg möglich! } elseif ($this->typ != $tournament->data->typ and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('MODUS', 'ROUNDSCREATED')); return false; } elseif ($this->runden != $tournament->data->runden and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('ROUNDS_COUNT', 'ROUNDSCREATED')); return false; } elseif ($this->dg != $tournament->data->dg and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('STAGE_COUNT', 'ROUNDSCREATED')); return false; } elseif ($this->teil != $tournament->data->teil and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'ROUNDSCREATED')); return false; /* } elseif ($this->tl <= 0) { $this->setError( CLMText::errorText('TOURNAMENT_DIRECTOR', 'MISSING') ); return false; */ } elseif ($this->tiebr2 != 0 and $this->tiebr2 == $this->tiebr1 or $this->tiebr3 != 0 and ($this->tiebr3 == $this->tiebr1 or $this->tiebr3 == $this->tiebr2)) { $this->setError(CLMText::errorText('TIEBREAKERS', 'NOTDISTINCT')); return false; } // Endtag gegegeben und Datum geändert? if ($this->dateEnd != '0000-00-00' and ($this->dateStart != $tournament->data->dateStart or $this->dateEnd != $tournament->data->dateEnd)) { // zerlegen list($startY, $startM, $startD) = explode("-", $this->dateStart); list($endY, $endM, $endD) = explode("-", $this->dateEnd); // Endtag kleiner Starttag? if (mktime(0, 0, 0, $startM, $startD, $startY) > mktime(0, 0, 0, $endM, $endD, $endY)) { $this->setError(CLMText::errorText('TOURNAMENT_DAYEND', 'TOOLOW')); return false; } } // wurde eine Feinwertung verändert? if ($this->tiebr1 != $tournament->data->tiebr1 or $this->tiebr2 != $tournament->data->tiebr2 or $this->tiebr3 != $tournament->data->tiebr3) { // Rangliste neu berechnen $tournament->setRankingPositions(); } return true; }
function _saveDo() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); if (CLM_usertype != 'admin' and CLM_usertype != 'tl') { JError::raiseWarning(500, JText::_('SECTION_NO_ACCESS')); return FALSE; } // Task $task = JRequest::getVar('task'); // Instanz der Tabelle $row =& JTable::getInstance('turniere', 'TableCLM'); if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); return FALSE; } // Rundenzahl berechnen! if ($row->typ == 2) { $tempTeil = $row->teil; if ($tempTeil % 2 != 0) { // gerade machen $tempTeil++; } $row->runden = $tempTeil - 1; } elseif ($row->typ == 3) { $row->runden = ceil(log($row->teil) / log(2)); } // Parameter $paramsStringArray = array(); foreach ($row->params as $key => $value) { $paramsStringArray[] = $key . '=' . intval($value); } $row->params = implode("\n", $paramsStringArray); if (!$row->checkData()) { // pre-save checks JError::raiseWarning(500, $row->getError()); // Weiterleitung bleibt im Formular !! $this->adminLink->more = array('task' => $task, 'id' => $row->id); return FALSE; } // if new item, order last in appropriate group if (!$row->id) { $this->neu = TRUE; // Flag für neues Turnier $stringAktion = JText::_('TOURNAMENT_CREATED'); // $where = "sid = " . (int) $row->sid; warum nur in Saison? $row->ordering = $row->getNextOrder(); // ( $where ); } else { $this->neu = FALSE; $stringAktion = JText::_('TOURNAMENT_EDITED'); } // save the changes if (!$row->store()) { JError::raiseError(500, $row->getError()); } $row->checkin(); // bei bereits bestehendem Turnier noch calculateRanking if (!$this->neu) { $tournament = new CLMTournament($row->id, TRUE); $tournament->calculateRanking(); $tournament->setRankingPositions(); } // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $stringAktion . ": " . $row->name; $clmLog->params = array('sid' => $row->sid, 'tid' => $row->id); // TurnierID wird als LigaID gespeichert $clmLog->write(); // wenn 'apply', weiterleiten in form if ($task == 'apply') { // Weiterleitung bleibt im Formular $this->adminLink->more = array('task' => 'edit', 'id' => $row->id); } else { // Weiterleitung in Liste $this->adminLink->view = "turmain"; // WL in Liste } return TRUE; }
function cancel() { $add_nz = JRequest::getInt('add_nz'); if ($add_nz == '1') { $tournament = new CLMTournament($this->turnierid, true); $tournament->makeMinusTln(); // Message werden dort erstellt } $this->adminLink->view = "turplayers"; $this->adminLink->more = array('id' => $this->turnierid); $this->adminLink->makeURL(); $this->setRedirect($this->adminLink->url); }
function store() { $rcount = JRequest::getVar('rcount', '', 'post', 'int'); $rlast = JRequest::getVar('rlast', '', 'post', 'int'); // Rundeninformationen in Datenbank schreiben if (!$this->_storeRundenInfos()) { return false; } // Paarungen in Datenbank schreiben if (!$this->_storePaarungen()) { return false; } if ($rlast < $rcount) { return true; } //Spielfreidummys l�schen if (!$this->_deleteSpielfreiDummys()) { return false; } //Kopieren in CLM-Tabellen if (!$this->_copyToCLMTables()) { return false; } $turnier = new CLMTournament($this->_tid, true); //Punkte und Feinwertungen neu berechnen $turnier->calculateRanking(); //Rangliste neu berechnen $turnier->setRankingPositions(); //Import war erfolgreich return true; }
function checkData() { // aktuelle Turnierdaten laden $tournament = new CLMTournament($this->id, TRUE); if (trim($this->name) == '') { // Name vorhanden $this->setError(CLMText::errorText('NAME', 'MISSING')); return false; } elseif ($this->sid <= 0) { // SaisonID > 0 $this->setError(CLMText::errorText('SEASON', 'IMPOSSIBLE')); return false; } elseif (!is_numeric($this->teil)) { // Teilnehmerzahl = Zahl $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'NOTANUMBER')); return false; } elseif ($this->teil <= 1) { // Teilnehmerzahl >= 2 $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'TOOLOW')); return false; } elseif ($this->teil > 500) { // Teilnehmerzahl $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'TOOBIG')); return false; } elseif ($this->teil < $tournament->getPlayersIn()) { $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'MOREPLAYERSIN')); return false; } elseif (!is_numeric($this->runden)) { // Runden = Zahl $this->setError(CLMText::errorText('ROUNDS_COUNT', 'NOTANUMBER')); return false; } elseif ($this->runden < 1) { // Runden >= 2 $this->setError(CLMText::errorText('ROUNDS_COUNT', 'TOOLOW')); return false; } elseif ($this->runden > 50) { // Runden $this->setError(CLMText::errorText('ROUNDS_COUNT', 'TOOBIG')); return false; } elseif ($this->typ != 3 and ($this->dg < 1 or $this->dg > 2)) { // DG möglich $this->setError(CLMText::errorText('STAGE_COUNT', 'IMPOSSIBLE')); return false; // Runden schon erstellt? dann keine Änderung Typ, Runden, dg möglich! } elseif ($this->typ != $tournament->data->typ and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('MODUS', 'ROUNDSCREATED')); return false; } elseif ($this->runden != $tournament->data->runden and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('ROUNDS_COUNT', 'ROUNDSCREATED')); return false; } elseif ($this->dg != $tournament->data->dg and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('STAGE_COUNT', 'ROUNDSCREATED')); return false; } elseif ($this->teil != $tournament->data->teil and $tournament->data->rnd == 1) { $this->setError(CLMText::errorText('PARTICIPANT_COUNT', 'ROUNDSCREATED')); return false; } elseif ($this->tl <= 0) { $this->setError(CLMText::errorText('TOURNAMENT_DIRECTOR', 'MISSING')); return false; } elseif ($this->tiebr2 != 0 and $this->tiebr2 == $this->tiebr1 or $this->tiebr3 != 0 and ($this->tiebr3 == $this->tiebr1 or $this->tiebr3 == $this->tiebr2)) { $this->setError(CLMText::errorText('TIEBREAKERS', 'NOTDISTINCT')); return false; } // wurde eine Feinwertung verändert? if ($this->tiebr1 != $tournament->data->tiebr1 or $this->tiebr2 != $tournament->data->tiebr2 or $this->tiebr3 != $tournament->data->tiebr3) { // Rangliste neu berechnen $tournament->setRankingPositions(); } return true; }
function _setRankingDo() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $clmAccess = clm_core::$access; if ($clmAccess->access('BE_tournament_edit_detail') === false) { //if (clm_core::$access->getType() != 'admin' AND clm_core::$access->getType() != 'tl') { JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS')); return false; } $tournament = new CLMTournament($this->id, true); $tournament->checkTournamentStarted(); if (!$tournament->started) { JError::raiseWarning(500, JText::_('RANKING_NOT_POSSIBLE') . ": " . JText::_('NO_RESULTS_ENTERED')); return false; } elseif ($tournament->data->typ == 3) { JError::raiseWarning(500, JText::_('RANKING_NOT_POSSIBLE') . ": " . JText::_('MODUS_TYP_3')); return false; } $tournament->calculateRanking(); $tournament->setRankingPositions(); $stringMessage = JText::_('SET_RANKING_DONE'); // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $stringMessage; $clmLog->params = array('sid' => $tournament->data->sid, 'tid' => $this->id); $clmLog->write(); $app = JFactory::getApplication(); $app->enqueueMessage($stringMessage); return true; }
function _setRankingDo() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); if (CLM_usertype != 'admin' and CLM_usertype != 'tl') { JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS')); return FALSE; } $tournament = new CLMTournament($this->id, TRUE); $tournament->checkTournamentStarted(); if (!$tournament->started) { JError::raiseWarning(500, JText::_('RANKING_NOT_POSSIBLE') . ": " . JText::_('NO_RESULTS_ENTERED')); return FALSE; } elseif ($tournament->data->typ == 3) { JError::raiseWarning(500, JText::_('RANKING_NOT_POSSIBLE') . ": " . JText::_('MODUS_TYP_3')); return FALSE; } $tournament->calculateRanking(); $tournament->setRankingPositions(); $stringMessage = JText::_('SET_RANKING_DONE'); // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $stringMessage; $clmLog->params = array('sid' => $tournament->data->sid, 'tid' => $this->id); $clmLog->write(); $app =& JFactory::getApplication(); $app->enqueueMessage($stringMessage); return TRUE; }
function _saveDo() { JRequest::checkToken() or die('Invalid Token'); if (CLM_usertype != 'admin' and CLM_usertype != 'tl') { JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS')); return FALSE; } $turnier = $this->turnierid; $task = JRequest::getVar('task'); $cid = JRequest::getVar('cid', array(0), '', 'array'); // JArrayHelper::toInteger($cid, array(0)); // weiteren Daten aus TlnTabelle $query = "SELECT MAX(mgl_nr), MAX(snr) FROM `#__clm_turniere_tlnr`" . " WHERE turnier = " . $this->turnierid; $this->_db->setQuery($query); list($maxFzps, $maxSnr) = $this->_db->loadRow(); $maxFzps++; // fiktive ZPS für manuell eingegeben Spieler $maxSnr++; // maximale snr für alle Spieler // Turnierdaten $tournament = new CLMTournament($this->turnierid, TRUE); $playersIn = $tournament->getPlayersIn(); $turParams = new JParameter($tournament->data->params); $param_useastwz = $turParams->get('useAsTWZ', 0); // Turnier schon vorher voll? if (!$this->_checkTournamentOpen($playersIn, $tournament->data->teil)) { return FALSE; } $name = trim(JRequest::getVar('name')); // Spieler aus manueller Nachmeldung speichern if ($name != "") { // weitere Angaben holen $verein = JRequest::getString('verein'); // $dwz = JRequest::getInt('dwz'); $natrating = JRequest::getInt('natrating', 0); $fideelo = JRequest::getInt('fideelo', 0); $titel = JRequest::getString('titel'); $geschlecht = JRequest::getString('geschlecht', 'NULL'); $birthYear = JRequest::getString('birthYear', '0000'); $twz = $this->_getTWZ($param_useastwz, $natrating, $fideelo); $query = " INSERT INTO #__clm_turniere_tlnr" . " (`sid`, `turnier`, `snr`, `name`, `birthYear`, `geschlecht`, `verein`, `twz`, `NATrating`, `FIDEelo`, `titel`, `mgl_nr` ,`zps`)" . " VALUES" . " ('" . $tournament->data->sid . "', '" . $this->turnierid . "', '" . $maxSnr++ . "', '{$name}', '{$birthYear}', '{$geschlecht}', '{$verein}', '{$twz}', '{$natrating}', '{$fideelo}', '{$titel}', '" . $maxFzps . "', '99999')"; $this->_db->setQuery($query); if ($this->_db->query()) { $this->app->enqueueMessage(JText::_('PLAYER') . " " . $name . " " . JText::_('ADDED')); $playersIn++; // den angemeldeten Spielern zufügen return TRUE; } else { $this->app->enqueueMessage(JText::_('DB_ERROR')); return FALSE; } } // wenn hier ein Spieler eingetragen wurde, geht es nicht mehr durch die Liste... foreach ($cid as $id) { // noch Platz im Turnier? if ($this->_checkTournamentOpen($playersIn, $tournament->data->teil)) { // ausgelesene Daten $mgl = substr($id, 5); $zps = substr($id, 0, 5); // weitere Daten des Spielers ermitteln // in CLM DB suchen $query = "SELECT a.Spielername, a.Geburtsjahr, a.Geschlecht, a.FIDE_Titel, a.FIDE_Elo, a.FIDE_ID, FIDE_Land, a.DWZ, v.Vereinname" . " FROM `#__clm_dwz_spieler` as a" . " LEFT JOIN dwz_vereine as v ON v.ZPS = a.ZPS" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid" . " WHERE a.ZPS = '{$zps}'" . " AND a.Mgl_Nr = " . $mgl . " AND s.archiv = 0 "; $this->_db->setQuery($query); if (!($data = $this->_db->loadObject())) { // in DSB DB suchen $query = "SELECT a.Spielername, a.Geburtsjahr, a.Geschlecht, a.FIDE_Titel, a.FIDE_Elo, a.FIDE_ID, FIDE_Land, a.DWZ, v.Vereinname" . " FROM `dwz_spieler` as a " . " LEFT JOIN dwz_vereine as v ON v.ZPS = a.ZPS " . " WHERE a.ZPS = '{$zps}'" . " AND a.Mgl_Nr = " . $mgl; $this->_db->setQuery($query); $data = $this->_db->loadObject(); } if (isset($data->Spielername)) { // checken ob Spieler schon eingetragen, um Doppelungen zu vermeiden $query = "SELECT COUNT(*) FROM #__clm_turniere_tlnr" . " WHERE `turnier` = '" . $this->turnierid . "' AND `mgl_nr` = '{$mgl}' AND `zps` = '{$zps}'"; $this->_db->setQuery($query); if ($this->_db->loadResult() > 0) { JError::raiseWarning(500, JText::_('PLAYER') . " " . $data->Spielername . " " . JText::_('ALREADYIN')); } else { $twz = $this->_getTWZ($param_useastwz, $data->DWZ, $data->FIDE_Elo); $query = " INSERT INTO #__clm_turniere_tlnr" . " (`sid`, `turnier`, `snr`, `name`, `birthYear`, `geschlecht`, `verein`, `twz`, `NATrating`, `FIDEelo`, `FIDEid`, `FIDEcco`, `titel`,`mgl_nr` ,`zps`) " . " VALUES" . " ('" . $tournament->data->sid . "','" . $this->turnierid . "', '" . $maxSnr++ . "', '" . mysql_real_escape_string($data->Spielername) . "', '" . $data->Geburtsjahr . "', '" . $data->Geschlecht . "','" . mysql_real_escape_string($data->Vereinname) . "', '" . $twz . "', '" . $data->DWZ . "', '" . $data->FIDE_Elo . "', '" . $data->FIDE_ID . "', '" . $data->FIDE_Land . "', '" . $data->FIDE_Titel . "', '{$mgl}', '{$zps}')"; $this->_db->setQuery($query); if ($this->_db->query()) { $playersIn++; $this->app->enqueueMessage(JText::_('PLAYER') . " " . $data->Spielername . " " . JText::_('ADDED')); } else { JError::raiseWarning(500, JText::_('DB_ERROR')); } } } else { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'UNKNOWN')); } } // sonst war Turnier voll } // je nach Task: Message und Weiterleitung switch ($task) { case 'apply': $stringAktion = JText::_('PLAYERS_ADDED'); break; case 'save': default: $stringAktion = JText::_('PLAYERS_SAVED'); $this->adminLink->view = "turplayers"; // WL in Liste break; } // Plätze frei? $openSpots = $tournament->data->teil - $playersIn; if ($openSpots > 0) { JError::raiseNotice(500, JText::_('PARTICIPANTS_WANTED') . ": " . $openSpots); } else { JError::raiseNotice(500, CLMText::errorText('PARTICIPANTLIST', 'FULL')); } // Message // $this->app->enqueueMessage($stringAktion); // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $stringAktion; $clmLog->params = array('sid' => $tournament->data->sid, 'tid' => $this->turnierid); // TurnierID wird als LigaID gespeichert $clmLog->write(); return TRUE; }
function _deleteDo() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); // Instanz der Tabelle $row = JTable::getInstance('turniere', 'TableCLM'); $row->load($this->turnierid); $clmAccess = clm_core::$access; if ($row->tl != clm_core::$access->getJid() and $clmAccess->access('BE_tournament_edit_round') !== true or $clmAccess->access('BE_tournament_edit_round') === false) { JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS')); return false; } $user = JFactory::getUser(); // Reale RundenNummer, DG aus RundenID ermitteln, tl_ok $query = 'SELECT sid, nr, dg, tl_ok' . ' FROM #__clm_turniere_rnd_termine' . ' WHERE id = ' . $this->roundid; $this->_db->setQuery($query); list($sid, $runde, $dg, $tl_ok) = $this->_db->loadRow(); // wenn Runde schon bestätigt, löschen nicht erlauben if ($tl_ok == 1) { JError::raiseWarning(500, CLMText::errorText('ROUND', 'ALREADYAPPROVED')); return false; } // bisher höchstes Brett dieser Runde ermitteln $query = 'SELECT MAX(brett)' . ' FROM #__clm_turniere_rnd_spl' . ' WHERE turnier = ' . $this->turnierid . ' AND runde = ' . $runde; $this->_db->setQuery($query); list($brettMax) = $this->_db->loadRow(); //echo "<br>brettM: ".$brettMax." "; //var_dump(list($brettMax)); // letzte Paarung löschen $query = "DELETE FROM #__clm_turniere_rnd_spl" . " WHERE sid = " . $sid . " AND turnier = " . $this->turnierid . " AND runde = " . $runde . " AND brett = " . $brettMax . " LIMIT 2 "; //echo "<br>query: ".$query; //die(' del?'); $this->_db->setQuery($query); if (!$this->_db->query()) { JError::raiseError(500, $this->_db->getErrorMsg()); } JError::raiseNotice(500, JText::_('MATCH_DELETED')); // Rangliste neu berechnen! $tournament = new CLMTournament($this->turnierid, true); $tournament->calculateRanking(); $tournament->setRankingPositions(); // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = JText::_('MATCH_DELETED'); $clmLog->params = array('tid' => $this->turnierid, 'rnd' => $this->roundid); // TurnierID wird als LigaID gespeichert $clmLog->write(); return true; }
function _resetDo() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); if (CLM_usertype != 'admin' and CLM_usertype != 'tl') { JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS')); return FALSE; } $user =& JFactory::getUser(); // Reale RundenNummer, DG aus RundenID ermitteln, tl_ok $query = 'SELECT nr, dg, tl_ok' . ' FROM #__clm_turniere_rnd_termine' . ' WHERE id = ' . $this->roundid; $this->_db->setQuery($query); list($runde, $dg, $tl_ok) = $this->_db->loadRow(); // wenn Runde schon bestätigt, zurücksetzen nicht erlauben if ($tl_ok == 1) { JError::raiseWarning(500, CLMText::errorText('ROUND', 'ALREADYAPPROVED')); return FALSE; } // sind überhaupt Ergebnisse eingetragen? $query = "SELECT COUNT(*) FROM #__clm_turniere_rnd_spl" . " WHERE turnier = " . $this->turnierid . " AND runde = " . $runde . " AND dg = " . $dg . " AND ergebnis IS NOT NULL"; $this->_db->setQuery($query); $resultCount = $this->_db->loadResult(); if ($resultCount == 0) { JError::raiseWarning(500, CLMText::errorText('RESULTS', 'NOTEXISTING')); return FALSE; } // Runde anpassen $query = "UPDATE #__clm_turniere_rnd_termine" . " SET gemeldet = NULL, zeit ='000e0-00-00 00:00:00', editor = " . $user->id . ", edit_zeit = NOW()" . " WHERE id = " . $this->roundid; $this->_db->setQuery($query); $this->_db->query(); // Ergebnisse löschen $query = "UPDATE #__clm_turniere_rnd_spl" . " SET ergebnis = NULL" . " WHERE turnier = " . $this->turnierid . " AND runde = " . $runde . " AND dg = " . $dg; $this->_db->setQuery($query); $this->_db->query(); JError::raiseNotice(500, CLMText::sgpl($resultCount / 2, JText::_('RESULT'), JText::_('RESULTS')) . " " . JText::_('RESET')); // Rangliste neu berechnen! $tournament = new CLMTournament($this->turnierid, TRUE); $tournament->calculateRanking(); $tournament->setRankingPositions(); // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = JText::_('RESULTS') . " " . JText::_('RESET'); $clmLog->params = array('tid' => $this->turnierid, 'rnd' => $this->roundid); // TurnierID wird als LigaID gespeichert $clmLog->write(); return TRUE; }
function _order($inc) { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid); $turnierid = $cid[0]; // access? $tournament = new CLMTournament($turnierid, TRUE); if (!$tournament->checkAccess()) { JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS')); return FALSE; } $row =& JTable::getInstance('turniere', 'TableCLM'); if (!$row->load($turnierid)) { JError::raiseWarning(500, CLMText::errorText('TOURNAMENT', 'NOTEXISTING')); return FALSE; } $row->move($inc, ''); $app =& JFactory::getApplication(); $app->enqueueMessage($row->name . ": " . JText::_('ORDERING_CHANGED')); return TRUE; }