/** * bearbeitet und überprüft Daten * */ function checkData() { $this->name = trim($this->name); if (strlen($this->name) == 0) { $this->setError(CLMText::errorText('ROUND_NAME', 'MISSING')); return false; } elseif ($this->nr < 1) { $this->setError(CLMText::errorText('ROUND_NR', 'MISSING')); return false; } // weitere if ($this->tl_ok == 1) { // Bestätigung gesetzt? $tournamentRound = new CLMTournamentRound($this->turnier, $this->id); if (!$tournamentRound->checkResultsComplete()) { $this->setError(CLMText::errorText('RESULTS', 'INCOMPLETE')); return false; } } if ($this->startzeit != '') { if (!CLMText::isTime($this->startzeit, true, false)) { $this->setError(CLMText::errorText('RUNDE_STARTTIME', 'IMPOSSIBLE')); return false; } } return true; }
function checkData() { if (trim($this->name) == '') { // Name vorhanden $this->setError(CLMText::errorText('NAME', 'MISSING')); return false; } 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; } // Task $task = JRequest::getVar('task'); // Instanz der Tabelle $row =& JTable::getInstance('turplayeredit', 'TableCLM'); $row->load($this->playerid); // Daten zu dieser ID laden // Spieler existent? if (!$row->id) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOTEXISTING')); return FALSE; // Runde gehört zu Turnier? } elseif ($row->turnier != $this->turnierid) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOACCESS')); return FALSE; } if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); return FALSE; } if (!$row->check(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); return FALSE; } if (!$row->store()) { JError::raiseError(500, $row->getError()); return FALSE; } $row->checkin(); $text = JText::_('PARTICIPANT_EDITED') . ": " . $row->name; // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $text; $clmLog->params = array('sid' => $row->sid, 'tid' => $this->turnierid); // TurnierID wird als LigaID gespeichert $clmLog->write(); $app =& JFactory::getApplication(); $app->enqueueMessage($text); // wenn 'apply', weiterleiten in form if ($task == 'apply') { // Weiterleitung bleibt im Formular $this->adminLink->more = array('playerid' => $this->playerid); } else { // Weiterleitung in Liste $this->adminLink->more = array('id' => $this->turnierid); $this->adminLink->view = "turplayers"; // WL in Liste } return TRUE; }
function checkData() { // aktuelle Daten laden $accesspoint = new CLMAccesspoint($this->id, true); if (trim($this->accesspoint) == '') { // Name vorhanden $this->setError(CLMText::errorText('NAME', 'MISSING')); return false; } return true; }
/** * Overloaded check function * * @access public * @return boolean * @see JTable::check * @since 1.5 */ function checkData() { // aktuelle Daten laden // $category = new CLMCategory($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 ($this->tl <= 0) { $this->setError( CLMText::errorText('TOURNAMENT_DIRECTOR', 'MISSING') ); return false; */ } return true; }
function check() { if (trim($this->name) == '') { // Name vorhanden $this->setError(CLMText::errorText('NAME', 'MISSING')); return false; } elseif (!is_numeric($this->NATrating)) { // TWZ = Zahl $this->setError(CLMText::errorText('RATING', 'NOTANUMBER')); return false; } elseif (!is_numeric($this->FIDEelo)) { // TWZ = Zahl $this->setError(CLMText::errorText('FIDE_ELO', 'NOTANUMBER')); return false; } elseif (!is_numeric($this->twz)) { // TWZ = Zahl $this->setError(CLMText::errorText('TWZ', 'NOTANUMBER')); return false; } return true; }
function _order($inc) { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid); $termineid = $cid[0]; $row = JTable::getInstance('termine', 'TableCLM'); if (!$row->load($termineid)) { JError::raiseWarning(500, CLMText::errorText('TERMINE_TASK', 'NOTEXISTING')); return false; } $row->move($inc, ''); $app = JFactory::getApplication(); $app->enqueueMessage($row->name . ": " . JText::_('ORDERING_CHANGED')); return true; }
function _saveDo() { JRequest::checkToken() or die('Invalid Token'); // Instanz der Tabelle $row = JTable::getInstance('turniere', 'TableCLM'); $row->load($this->turnierid); // Daten zu dieser ID laden $clmAccess = clm_core::$access; if ($row->tl != clm_core::$access->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $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; } $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 clm_class_params($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 = clm_core::$load->gen_twz($param_useastwz, $natrating, $fideelo); $query = " INSERT INTO #__clm_turniere_tlnr" . " (`sid`, `turnier`, `snr`, `name`, `birthYear`, `geschlecht`, `verein`, `twz`, `start_dwz`, `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); if (!is_numeric($mgl)) { $mgl = -1; } $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 #__clm_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 " . " AND a.sid = " . clm_core::$access->getSeason(); $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 = clm_core::$load->gen_twz($param_useastwz, $data->DWZ, $data->FIDE_Elo); $query = " INSERT INTO #__clm_turniere_tlnr" . " (`sid`, `turnier`, `snr`, `name`, `birthYear`, `geschlecht`, `verein`, `twz`, `start_dwz`, `FIDEelo`, `FIDEid`, `FIDEcco`, `titel`,`mgl_nr` ,`zps`) " . " VALUES" . " ('" . $tournament->data->sid . "','" . $this->turnierid . "', '" . $maxSnr++ . "', '" . clm_escape($data->Spielername) . "', '" . $data->Geburtsjahr . "', '" . $data->Geschlecht . "','" . clm_escape($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 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 _activeDo() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid); $tlnrID = $cid[0]; // Teilnehmerdaten holen $tlnr = JTable::getInstance('turnier_teilnehmer', 'TableCLM'); $tlnr->load($tlnrID); // Daten zu dieser ID laden // Teilnehmer existent? if (!$tlnr->id) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOTEXISTING')); return false; // Teilnehmer gehört zu Turnier? } elseif ($tlnr->turnier != $this->id) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOACCESS')); return false; } $task = JRequest::getCmd('task'); $active = $task == 'active'; // zu vergebender Wert 0/1 // jetzt schreiben $tlnr->tlnrStatus = $active; if (!$tlnr->store()) { JError::raiseError(500, $row->getError()); return false; } $app = JFactory::getApplication(); if ($active) { $app->enqueueMessage($tlnr->name . ": " . " " . JText::_('PLAYER_ACTIVE')); } else { $app->enqueueMessage($tlnr->name . ": " . " " . JText::_('PLAYER_DEACTIVE')); } // Log $clmLog = new CLMLog(); $clmLog->aktion = JText::_('PLAYER') . " " . $tlnr->name . " (ID: " . $tlnrID . "): " . $task; $clmLog->params = array('tid' => $this->id); // 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); $catid = $cid[0]; // access? $category = new CLMCategory($catid, true); if (!$category->checkAccess()) { JError::raiseWarning(500, JText::_('CATEGORY_NO_ACCESS')); return false; } $row = JTable::getInstance('categories', 'TableCLM'); if (!$row->load($catid)) { JError::raiseWarning(500, CLMText::errorText('CATEGORY', 'NOTEXISTING')); return false; } $row->move($inc, ''); $app = JFactory::getApplication(); $app->enqueueMessage($row->name . ": " . JText::_('ORDERING_CHANGED')); 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; }
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 _approveDo() { // 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; } // Turnierdaten holen $turnier =& JTable::getInstance('turniere', 'TableCLM'); $turnier->load($this->turnierid); // Daten zu dieser ID laden $round =& JTable::getInstance('turnier_runden', 'TableCLM'); $round->load($this->roundid); // Daten zu dieser ID laden // Runde existent? if (!$round->id) { JError::raiseWarning(500, CLMText::errorText('ROUND', 'NOTEXISTING')); return FALSE; // Runde gehört zu Turnier? } elseif ($round->turnier != $this->turnierid) { JError::raiseWarning(500, CLMText::errorText('ROUND', 'NOACCESS')); return FALSE; } $task = JRequest::getCmd('task'); $approve = $task == 'approve'; // zu vergebender Wert 0/1 // weiterer Check: Ergebnisse vollständig? if ($approve == 1) { $tournamentRound = new CLMTournamentRound($this->turnierid, $this->roundid); if (!$tournamentRound->checkResultsComplete()) { JError::raiseWarning(500, CLMText::errorText('RESULTS', 'INCOMPLETE')); return FALSE; } } // jetzt schreiben $round->tl_ok = $approve; if (!$round->store()) { JError::raiseError(500, $row->getError()); return FALSE; } $app =& JFactory::getApplication(); if ($approve) { $app->enqueueMessage(JText::_('ROUND') . " " . JText::_('CLM_APPROVED')); } else { $app->enqueueMessage(JText::_('ROUND') . " " . JText::_('CLM_UNAPPROVED')); } // Log $clmLog = new CLMLog(); $clmLog->aktion = JText::_('ROUND') . " " . $row->name . " (ID: " . $this->roundid . "): " . $task; $clmLog->params = array('tid' => $this->turnierid); // TurnierID wird als LigaID gespeichert $clmLog->write(); return TRUE; }
function makeMinusTln() { if ($this->data->typ != 1) { JError::raiseNotice(500, CLMText::errorText('TOURNAMENT', 'WRONGMODUS')); return FALSE; } elseif ($this->checkTournamentStarted()) { JError::raiseNotice(500, CLMText::errorText('TOURNAMENT', 'ALREADYSTARTED')); return FALSE; } $query = "UPDATE #__clm_turniere" . " SET teil = teil - 1" . " WHERE id = " . $this->turnierid; $this->_db->setQuery($query); if (!$this->_db->query()) { JError::raiseNotice(500, JText::_('DB_ERROR')); return FALSE; } $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('PARTICIPANT_COUNT_LESSENED_TO') . ": " . ($this->data->teil - 1)); 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 > 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 _order($inc) { // 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; } $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid); $tlnid = $cid[0]; $row =& JTable::getInstance('turnier_teilnehmer', 'TableCLM'); if (!$row->load($tlnid)) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOTEXISTING')); return FALSE; } $row->move($inc, ''); $app =& JFactory::getApplication(); $app->enqueueMessage(JText::_('ORDERING_CHANGED')); return TRUE; }
function _saveDo() { JRequest::checkToken() or die('Invalid Token'); // Instanz der Tabelle $row = JTable::getInstance('turniere', 'TableCLM'); $row->load($this->turnierid); // Daten zu dieser ID laden $clmAccess = clm_core::$access; if ($row->tl != clm_core::$access->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $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; } // Task $task = JRequest::getVar('task'); // Instanz der Tabelle $row =& JTable::getInstance('turnier_teilnehmer', 'TableCLM'); $row->load($this->playerid); // Daten zu dieser ID laden // Spieler existent? if (!$row->id) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOTEXISTING')); return false; // Runde gehört zu Turnier? } elseif ($row->turnier != $this->turnierid) { JError::raiseWarning(500, CLMText::errorText('PLAYER', 'NOACCESS')); return false; } if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); return false; } if (!$row->check(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); return false; } if (!$row->store()) { JError::raiseError(500, $row->getError()); return false; } clm_core::$api->direct("db_tournament_delDWZ", array($this->turnierid, false)); $text = JText::_('PARTICIPANT_EDITED') . ": " . $row->name; // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $text; $clmLog->params = array('sid' => $row->sid, 'tid' => $this->turnierid); // TurnierID wird als LigaID gespeichert $clmLog->write(); $app = JFactory::getApplication(); $app->enqueueMessage($text); // wenn 'apply', weiterleiten in form if ($task == 'apply') { // Weiterleitung bleibt im Formular $this->adminLink->more = array('playerid' => $this->playerid); } else { // Weiterleitung in Liste $this->adminLink->more = array('id' => $this->turnierid); $this->adminLink->view = "turplayers"; // WL in Liste } return true; }
function _order($inc) { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); // Instanz der Tabelle $row = JTable::getInstance('turniere', 'TableCLM'); $row->load($this->id); // Daten zu dieser ID laden $clmAccess = clm_core::$access; if ($row->tl != clm_core::$access->getJid() and $clmAccess->access('BE_tournament_edit_detail') !== true or $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; } $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid); $rundenid = $cid[0]; $row = JTable::getInstance('turnier_runden', 'TableCLM'); if (!$row->load($rundenid)) { JError::raiseWarning(500, CLMText::errorText('ROUND', 'NOTEXISTING')); return false; } $row->move($inc, ''); $app = JFactory::getApplication(); $app->enqueueMessage($row->name . ": " . JText::_('ORDERING_CHANGED')); return true; }