/** * 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 _approveDo() { // 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_round') !== true or $clmAccess->access('BE_tournament_edit_round') === 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); $roundID = $cid[0]; // Rundendaten holen $round = JTable::getInstance('turnier_runden', 'TableCLM'); $round->load($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->id) { 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->id, $cid[0]); 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($round->name . " " . JText::_('CLM_APPROVED')); } else { $app->enqueueMessage($round->name . " " . JText::_('CLM_UNAPPROVED')); } // Log $clmLog = new CLMLog(); $clmLog->aktion = JText::_('ROUND') . " " . $round->name . " (ID: " . $roundID . "): " . $task; $clmLog->params = array('tid' => $this->id); // 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; }