Beispiel #1
0
 function _saveDo()
 {
     // 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;
     }
     $invitationText = JRequest::getVar('invitationText', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $query = "UPDATE #__clm_turniere" . " SET invitationText = " . $this->_db->Quote($invitationText) . " WHERE id = " . $this->id;
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         JError::raiseWarning(500, JText::_('DB_ERROR'));
         return false;
     }
     $this->app->enqueueMessage(JText::_('INVITATION_EDITED'));
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('INVITATION_EDITED');
     $clmLog->params = array('tid' => $this->id);
     // TurnierID wird als LigaID gespeichert
     $clmLog->write();
     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 _saveDo()
 {
     // 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;
     }
     $invitationText = JRequest::getVar('invitationText', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $query = "UPDATE #__clm_turniere" . " SET invitationText = " . $this->_db->Quote($invitationText) . " WHERE id = " . $this->id;
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         JError::raiseWarning(500, JText::_('DB_ERROR'));
         return FALSE;
     }
     $this->app->enqueueMessage(JText::_('INVITATION_EDITED'));
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('INVITATION_EDITED');
     $clmLog->params = array('tid' => $this->id);
     // TurnierID wird als LigaID gespeichert
     $clmLog->write();
     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::_('TOURNAMENT_NO_ACCESS'));
         return FALSE;
     }
     // Task
     $task = JRequest::getVar('task');
     // Instanz der Tabelle
     $row =& JTable::getInstance('turnier_runden', 'TableCLM');
     $row->load($this->param['roundid']);
     // bind
     if (!$row->bind(JRequest::get('post'))) {
         JError::raiseError(500, $row->getError());
         return FALSE;
     }
     // check
     if (!$row->checkData()) {
         JError::raiseWarning(500, $row->getError());
         return FALSE;
     }
     // save the changes
     if (!$row->store()) {
         JError::raiseError(500, $row->getError());
         return FALSE;
     }
     $row->checkin();
     if ($this->task == 'apply') {
         $this->adminLink->view = "turroundform";
         $this->adminLink->more = array('turnierid' => $this->param['turnierid'], 'roundid' => $this->param['roundid']);
     } else {
         $this->adminLink->view = "turrounds";
         $this->adminLink->more = array('id' => $this->param['turnierid']);
     }
     $stringAktion = JText::_('ROUND_EDITED');
     $app =& JFactory::getApplication();
     $app->enqueueMessage($stringAktion);
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = $stringAktion;
     $clmLog->params = array('tid' => $this->param['turnierid']);
     // TurnierID wird als LigaID gespeichert
     $clmLog->write();
     return TRUE;
 }
 function save()
 {
     $mainframe = JFactory::getApplication();
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $db = JFactory::getDBO();
     $task = JRequest::getVar('task');
     $user = JFactory::getUser();
     $meldung = $user->get('id');
     $row = JTable::getInstance('ligen', 'TableCLM');
     $cid = JRequest::getVar('id');
     $row->load($cid);
     $sid = $row->sid;
     $lid = $row->id;
     $n1time = '00:00:00';
     if ($row->durchgang > 1) {
         $runden_counter = $row->durchgang * $row->runden;
     } else {
         $runden_counter = $row->runden;
     }
     for ($x = 0; $x < $runden_counter; $x++) {
         if ($row->runden_modus == 4) {
             $pairings = pow(2, $row->runden - 1 - $x);
         } elseif ($row->runden_modus == 5) {
             $pairings = pow(2, $row->runden - 2 - $x);
             if ($pairings == 0) {
                 $pairings = 1;
             }
         } else {
             $pairings = $row->teil / 2;
         }
         if ($x + 1 > 3 * $row->runden) {
             $dg = 4;
             $cnt = $x - 3 * $row->runden;
         } elseif ($x + 1 > 2 * $row->runden) {
             $dg = 3;
             $cnt = $x - 2 * $row->runden;
         } elseif ($x + 1 > $row->runden) {
             $dg = 2;
             $cnt = $x - $row->runden;
         } else {
             $dg = 1;
             $cnt = $x;
         }
         for ($y = 0; $y < $pairings; $y++) {
             $ndate = JRequest::getVar('D' . $dg . 'R' . ($cnt + 1) . 'P' . ($y + 1) . 'Date');
             $ntime = JRequest::getVar('D' . $dg . 'R' . ($cnt + 1) . 'P' . ($y + 1) . 'Time');
             if ($ntime != '00:00:00' and $n1time == '00:00:00') {
                 $n1time = $ntime;
             }
             $query = "UPDATE #__clm_rnd_man" . " SET pdate = '" . $ndate . "'" . " , ptime = '" . $ntime . "'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . ($cnt + 1) . " AND paar = " . ($y + 1) . " AND dg = " . $dg . " AND heim = 1 ";
             $db->setQuery($query);
             $db->query();
             $query = "UPDATE #__clm_rnd_man" . " SET pdate = '" . $ndate . "'" . " , ptime = '" . $ntime . "'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . ($cnt + 1) . " AND paar = " . ($y + 1) . " AND dg = " . $dg . " AND heim = 0 ";
             $db->setQuery($query);
             $db->query();
         }
         $query = "UPDATE #__clm_rnd_man" . " SET ptime = '" . $n1time . "'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND pdate > '1970-01-01' " . " AND ptime = '00:00:00' ";
         $db->setQuery($query);
         $db->query();
     }
     switch ($task) {
         case 'apply':
             $msg = JText::_('PAARUNG_AENDERN_IST');
             $link = 'index.php?option=' . $option . '&section=' . $section . '&cid[]=' . $cid;
             break;
         case 'save':
         default:
             $msg = JText::_('PAARUNG_AENDERN_IST');
             if ($row->liga_mt == 1) {
                 //mtmt
                 //$link = 'index.php?option='.$option.'&section=mturniere';
                 $link = 'index.php?option=' . $option . '&view=view_tournament_group&liga=0';
             } else {
                 //$link = 'index.php?option='.$option.'&section=ligen';
                 $link = 'index.php?option=' . $option . '&view=view_tournament_group&liga=1';
             }
             break;
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('PAARUNG_DT_LOG');
     $clmLog->params = array('sid' => $sid, 'lid' => $lid, 'cids' => $cid);
     $clmLog->write();
     $mainframe->redirect($link, $msg);
 }
Beispiel #6
0
 function spieler_delete()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $db =& JFactory::getDBO();
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $spieler = JRequest::getVar('del_spieler');
     $sid = JRequest::getVar('sid');
     // SL nicht zulassen !
     if (CLM_usertype != 'admin' and CLM_usertype != 'dv' and CLM_usertype != 'dwz') {
         JError::raiseWarning(500, JText::_('DWZ_REFERENT') . CLM_usertype);
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link, $msg);
     }
     // Spieler muß ausgewählt sein
     if ($spieler == 0) {
         JError::raiseWarning(500, JText::_('DWZ_SPIELER_LOESCH'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link, $msg);
     }
     $zps = $mainframe->getUserStateFromRequest("{$option}.filter_vid", 'filter_vid', 0, 'var');
     $query = "DELETE FROM #__clm_dwz_spieler" . " WHERE ZPS = '{$zps}'" . " AND Mgl_Nr = " . $spieler . " AND sid =" . $sid;
     $db->setQuery($query);
     $db->query();
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = "Spielerdaten gelöscht";
     $clmLog->params = array('sid' => $sid, 'zps' => $zps, 'mgl_nr' => $spieler);
     $clmLog->write();
     $msg = JText::_('DWZ_SPIELER_MITGLIED') . ' ' . $spieler . ' ' . JText::_('DWZ_LOESCH');
     $link = 'index.php?option=' . $option . '&section=' . $section;
     $mainframe->redirect($link, $msg);
 }
Beispiel #7
0
 function _saveDo()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     // Instanz der Tabelle
     $row = JTable::getInstance('turniere', 'TableCLM');
     $row->load($this->param['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) {
         //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_runden', 'TableCLM');
     $row->load($this->param['roundid']);
     // bind
     if (!$row->bind(JRequest::get('post'))) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     // check
     if (!$row->checkData()) {
         JError::raiseWarning(500, $row->getError());
         return false;
     }
     // save the changes
     if (!$row->store()) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     if ($row->startzeit != '00:00') {
         $db = JFactory::getDBO();
         $startzeit = $row->startzeit . ':00';
         $query = " UPDATE #__clm_turniere_rnd_termine " . " SET startzeit = '" . $startzeit . "' " . " WHERE turnier = " . $row->turnier . " AND sid = " . $row->sid . " AND startzeit = '00:00:00' ";
         $db->setQuery($query);
         $db->query();
     }
     if ($this->task == 'apply') {
         $this->adminLink->view = "turroundform";
         $this->adminLink->more = array('turnierid' => $this->param['turnierid'], 'roundid' => $this->param['roundid']);
     } else {
         $this->adminLink->view = "turrounds";
         $this->adminLink->more = array('id' => $this->param['turnierid']);
     }
     $stringAktion = JText::_('ROUND_EDITED');
     $app = JFactory::getApplication();
     $app->enqueueMessage($stringAktion);
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = $stringAktion;
     $clmLog->params = array('tid' => $this->param['turnierid']);
     // TurnierID wird als LigaID gespeichert
     $clmLog->write();
     return true;
 }
 function spielfrei()
 {
     JRequest::checkToken() or die('Invalid Token');
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     JArrayHelper::toInteger($cid, array(0));
     // keine Meldeliste gewählt //
     if ($cid[0] < 1) {
         $msg = JText::_('MANNSCHAFTEN_MANNSCHAFT_AUS');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
     }
     // load the row from the db table
     $row =& JTable::getInstance('mannschaften', 'TableCLM');
     $row->load($cid[0]);
     $tlnr = $row->tln_nr;
     // load the row from the db table
     $rowliga =& JTable::getInstance('ligen', 'TableCLM');
     $liga = $row->liga;
     $rowliga->load($liga);
     $link = 'index.php?option=' . $option . '&section=' . $section;
     // Prüfen ob User Berechtigung zum publizieren hat
     if ($rowliga->sl != CLM_ID and CLM_usertype !== 'admin') {
         JError::raiseWarning(500, JText::_('MANNSCHAFTEN_MANNSCHAFT_SPIELFREI'));
         $mainframe->redirect($link);
     }
     $query = "UPDATE #__clm_rnd_man" . " SET gemeldet = 1 " . " WHERE sid = " . $row->sid . " AND lid = " . $row->liga . " AND ( tln_nr = {$tlnr} OR gegner = {$tlnr}) ";
     $db->setQuery($query);
     $db->query();
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('MANNSCHAFT_LOG_NO_GAMES');
     $clmLog->params = array('sid' => $row->sid, 'lid' => $row->liga, 'man' => $tlnr, 'cids' => $cid[0]);
     $clmLog->write();
     $msg = JText::_('MANNSCHAFTEN_MANNSCHAFT_SPIELF');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
 }
 function dwz_del()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $db =& JFactory::getDBO();
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     JArrayHelper::toInteger($cid);
     // keine Runde/Liga gewählt
     if ($cid[0] < 1) {
         JError::raiseWarning(500, JText::_('RUNDE_NO_LOESCH'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     //Liga einschl. Saison wird durch User im Screen bestimmt
     $data =& JTable::getInstance('runden', 'TableCLM');
     // load the row from the db table
     $data->load($cid[0]);
     $liga =& JTable::getInstance('ligen', 'TableCLM');
     $liga->load($data->liga);
     $sid = $data->sid;
     $lid = $data->liga;
     // Zeiger setzen auf ligaweite DWZ-Auswertung
     $dwz = 0;
     // Prüfen ob User Berechtigung zum auswerten hat
     if ($liga->sl !== CLM_ID and CLM_usertype !== 'admin') {
         JError::raiseWarning(500, JText::_('RUNDE_ST_AUSWER'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link);
     }
     // Löschen der DWZ-Auswertung zur LigaSaison
     $query = "UPDATE #__clm_meldeliste_spieler" . " SET DWZ = 0" . " , I0 = 0" . " , Punkte = 0" . " , Partien = 0" . " , WE = 0" . " , Leistung = 0" . " , EFaktor = 0" . " , Niveau = 0" . " WHERE sid = " . $sid . " AND lid = " . $lid;
     $db->setQuery($query);
     $db->query();
     // DWZ Anzeige in Runden löschen
     $query = " UPDATE #__clm_runden_termine " . " SET dwz = 0 " . " WHERE  sid = " . $sid . " AND liga = " . $lid;
     $db->setQuery($query);
     $db->query();
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('RUNDE_LOG_DWZ_DEL');
     $clmLog->nr_aktion = 102;
     //klkl
     $clmLog->params = array('sid' => $sid, 'lid' => $liga_dwz->lid, 'cids' => $cids);
     //klkl
     $clmLog->write();
     $msg = JText::_('RUNDE_DWZ_IST_LOESCH');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
 }
Beispiel #10
0
 function saveIt($apply = false)
 {
     $mainframe = JFactory::getApplication();
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $db = JFactory::getDBO();
     $row = JTable::getInstance('ligen', 'TableCLM');
     $msg = JRequest::getVar('id');
     $sid_alt = JRequest::getVar('sid_alt');
     $sid = JRequest::getVar('sid');
     if (!$row->bind(JRequest::get('post'))) {
         JError::raiseError(500, $row->getError());
     }
     //Liga-Parameter zusammenfassen
     $row->params['anz_sgp'] = JRequest::getVar('anz_sgp');
     if ($row->params['noBoardResults'] == '1') {
         $row->params['noOrgReference'] = '1';
     }
     if ($row->params['noOrgReference'] == '1') {
         $row->params['incl_to_season'] = '0';
     }
     $paramsStringArray = array();
     foreach ($row->params as $key => $value) {
         ////$paramsStringArray[] = $key.'='.intval($value);
         //if (substr($key,0,2) == "\'") $key = substr($key,2,strlen($key)-4);
         //if (substr($key,0,1) == "'") $key = substr($key,1,strlen($key)-2);
         $paramsStringArray[] = $key . '=' . $value;
     }
     $row->params = implode("\n", $paramsStringArray);
     // pre-save checks
     if (!$row->check()) {
         JError::raiseError(500, $row->getError());
     }
     $teil = $row->teil;
     // if new item, order last in appropriate group
     $aktion = JText::_('LIGEN_AKTION_LEAGUE_EDIT');
     $neu_id = 0;
     $ungerade_id = 0;
     if (!$row->id) {
         $neu_id = 1;
         $aktion = JText::_('LIGEN_AKTION_NEW_LEAGUE');
         $where = "sid = " . (int) $row->sid;
         $row->ordering = $row->getNextOrder($where);
         // Bei ungerader Anzahl Mannschaften Teilnehmerzahl um 1 erhöhen
         if ($row->teil % 2 != 0) {
             $ungerade_id = 1;
             $row->teil = $row->teil + 1;
             $tln = $row->teil;
             JError::raiseWarning(500, JText::_('LIGEN_MANNSCH', true));
         }
     }
     $row->liga_mt = 0;
     //mtmt 0 = liga  1 = mannschaftsturnier
     // save the changes
     if (!$row->store()) {
         JError::raiseError(500, $row->getError());
     }
     $liga_man = $row->id;
     $liga_rnd = $row->runden;
     $liga_dg = $row->durchgang;
     $publish = $row->published;
     // Wenn sid gewechselt wurde, alle Daten in neue Saison verschieben
     if ($sid_alt != $sid and $sid_alt != "") {
         JError::raiseNotice(6000, JText::_('LIGEN_SAISON_AEND'));
         $query = " UPDATE #__clm_mannschaften " . " SET sid = " . $sid . " WHERE liga = " . $liga_man . " AND sid = " . $sid_alt;
         $db->setQuery($query);
         $db->query();
         $query = " UPDATE #__clm_meldeliste_spieler " . " SET sid = " . $sid . " WHERE lid = " . $liga_man . " AND sid = " . $sid_alt;
         $db->setQuery($query);
         $db->query();
         $query = " UPDATE #__clm_rnd_man " . " SET sid = " . $sid . " WHERE lid = " . $liga_man . " AND sid = " . $sid_alt;
         $db->setQuery($query);
         $db->query();
         $query = " UPDATE #__clm_rnd_spl " . " SET sid = " . $sid . " WHERE lid = " . $liga_man . " AND sid = " . $sid_alt;
         $db->setQuery($query);
         $db->query();
         $query = " UPDATE #__clm_runden_termine " . " SET sid = " . $sid . " WHERE liga = " . $liga_man . " AND sid = " . $sid_alt;
         $db->setQuery($query);
         $db->query();
     }
     // Bei ungerader Anzahl Mannschaften "spielfrei" hinzufügen
     if ($ungerade_id == "1") {
         $query = " INSERT INTO #__clm_mannschaften " . " ( `sid`,`name`,`liga`,`zps`,`liste`,`edit_liste`,`man_nr`,`tln_nr`,`mf`) " . " VALUES ('{$sid}','spielfrei','{$liga_man}','0','0','62','0','{$tln}','0') ";
         $db->setQuery($query);
         $db->query();
         JError::raiseNotice(6000, JText::_('LIGEN_MANNSCH_1'));
     }
     // Mannschaftsrunden anlegen
     if ($neu_id == "1") {
         clm_core::$api->db_tournament_genRounds($liga_man, true);
         // Mannschaften anlegen
         for ($x = 1; $x < 1 + $teil; $x++) {
             $man_name = JText::_('LIGEN_STD_TEAM') . " " . $x;
             if ($x < 10) {
                 $man_nr = $liga_man . '0' . $x;
             } else {
                 $man_nr = $liga_man . $x;
             }
             $query = " INSERT INTO #__clm_mannschaften " . " (`sid`,`name`,`liga`,`zps`,`liste`,`edit_liste`,`man_nr`,`tln_nr`,`mf`,`published`) " . " VALUES ('{$sid}','{$man_name}','{$liga_man}','1','0','0','{$man_nr}','{$x}','0','{$publish}') ";
             $db->setQuery($query);
             $db->query();
         }
     }
     clm_core::$api->db_tournament_ranking($liga_man, true);
     //require_once(JPATH_COMPONENT.DS.'controllers'.DS.'ergebnisse.php');
     //CLMControllerErgebnisse::calculateRanking($sid,$liga_man);
     if ($apply) {
         $msg = JText::_('LIGEN_AENDERN');
         $link = 'index.php?option=' . $option . '&section=' . $section . '&cid[]=' . $row->id;
     } else {
         $msg = JText::_('LIGEN_LIGA');
         $link = 'index.php?option=' . $option . '&view=view_tournament_group&liga=1';
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = $aktion;
     $clmLog->params = array('sid' => $row->sid, 'lid' => $row->id);
     $clmLog->write();
     $mainframe->redirect($link, $msg);
 }
Beispiel #11
0
 function publish()
 {
     // 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;
     }
     // TODO? evtl global inconstruct anlegen
     $user = JFactory::getUser();
     $cid = JRequest::getVar('cid', array(), '', 'array');
     JArrayHelper::toInteger($cid);
     $task = JRequest::getCmd('task');
     $publish = $task == 'publish';
     // zu vergebender Wert 0/1
     // Inhalte übergeben?
     if (empty($cid)) {
         JError::raiseWarning(500, 'NO_ITEM_SELECTED');
     } else {
         // ja, Inhalte vorhanden
         $cids = implode(',', $cid);
         $query = 'UPDATE #__clm_turniere_rnd_termine' . ' SET published = ' . (int) $publish . ' WHERE id IN ( ' . $cids . ' )' . ' AND ( checked_out = 0 OR ( checked_out = ' . (int) $user->get('id') . ' ) )';
         $this->_db->setQuery($query);
         if (!$this->_db->query()) {
             JError::raiseWarning(500, JText::_('DB_ERROR', true));
         }
         $app = JFactory::getApplication();
         if ($publish) {
             $app->enqueueMessage(CLMText::sgpl(count($cid), JText::_('ROUND'), JText::_('ROUNDS')) . " " . JText::_('CLM_PUBLISHED'));
         } else {
             $app->enqueueMessage(CLMText::sgpl(count($cid), JText::_('ROUND'), JText::_('ROUNDS')) . " " . JText::_('CLM_UNPUBLISHED'));
         }
         // Log
         $clmLog = new CLMLog();
         $clmLog->aktion = JText::_('ROUND') . " " . $row->name . ": " . $task;
         $clmLog->params = array('tid' => $this->id);
         // TurnierID wird als LigaID gespeichert
         $clmLog->write();
     }
     $this->adminLink->makeURL();
     $this->setRedirect($this->adminLink->url);
 }
Beispiel #12
0
 function wertpunkte()
 {
     JRequest::checkToken() or die('Invalid Token');
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     JArrayHelper::toInteger($cid, array(0));
     // keine Liga gewählt
     if ($cid[0] < 1) {
         $msg = JText::_('LIGEN_WERTUNG');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
     }
     // Ligadaten und Paarungsdaten holen
     $query = "SELECT a.id as lid,a.sid,a.stamm,durchgang,a.rnd " . " FROM #__clm_liga as a" . " WHERE a.id = " . $cid[0];
     $db->setQuery($query);
     $liga = $db->loadObjectList();
     $lid = $liga[0]->lid;
     $sid = $liga[0]->sid;
     $stamm = $liga[0]->stamm;
     // Mannschaftsdaten sammeln
     $mdata = "SELECT a.sid, a.lid, a.runde, a.dg, a.paar, a.heim " . " FROM #__clm_rnd_man as a " . " WHERE a.lid = " . $lid;
     $db->setQuery($mdata);
     $mdata = $db->loadObjectList();
     foreach ($mdata as $mdata) {
         // Wertpunkte Heim berechnen
         $query = "SELECT punkte, brett " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $mdata->sid . " AND lid = " . $mdata->lid . " AND runde = " . $mdata->runde . " AND paar = " . $mdata->paar . " AND dg = " . $mdata->dg . " AND heim = " . $mdata->heim;
         $db->setQuery($query);
         $sdata = $db->loadObjectList();
         $wpunkte = 0;
         foreach ($sdata as $sdata) {
             $wpunkte = $wpunkte + ($stamm + 1 - $sdata->brett) * $sdata->punkte;
         }
         // Mannschaftstabelle updaten
         $query = "UPDATE #__clm_rnd_man" . " SET wertpunkte = " . $wpunkte . " WHERE sid = " . $mdata->sid . " AND lid = " . $mdata->lid . " AND runde = " . $mdata->runde . " AND paar = " . $mdata->paar . " AND dg = " . $mdata->dg . " AND heim = " . $mdata->heim;
         $db->setQuery($query);
         $db->query();
     }
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('LIGEN_AKTION_LEAGUE_WERTPUNKTE_SET');
     $table =& JTable::getInstance('ligen', 'TableCLM');
     $table->load($cid[0]);
     $clmLog->params = array('cids' => implode(',', $cid), 'lid' => $table->id, 'sid' => $table->sid);
     $clmLog->write();
     $msg = JText::_('LIGEN_AKTION_LEAGUE_WERTPUNKTE_SET');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
 }
Beispiel #13
0
 function copy()
 {
     $cids = JRequest::getVar('cid', array(0), 'post', 'array');
     $n = count($cids);
     $row = JTable::getInstance('accessgroupsform', 'TableCLM');
     $rn = 0;
     if ($n > 0) {
         foreach ($cids as $id) {
             if ($row->load((int) $id)) {
                 $row->id = 0;
                 $row->name = JText::_('COPY_OF') . ' ' . $row->name;
                 $row->usertype = 'c_' . $row->usertype;
                 $row->published = 0;
                 $row->kind = 'USER';
                 if (!$row->store()) {
                     $this->setError($this->_db->getErrorMsg());
                     return false;
                 }
             }
         }
     }
     if ($n > 1) {
         $msg = JText::_('LIGEN_AKTION_ENTRYS');
     } else {
         $msg = JText::_('LIGEN_AKTION_ENTRY');
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('ACCESSGROUP_COPIED_LOG');
     $clmLog->params = array('sid' => clm_core::$access->getSeason(), 'cids' => $row->usertype);
     $clmLog->write();
     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 save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $db =& JFactory::getDBO();
     $task = JRequest::getVar('task');
     $user =& JFactory::getUser();
     $meldung = $user->get('id');
     $row =& JTable::getInstance('ligen', 'TableCLM');
     $cid = JRequest::getVar('id');
     $row->load($cid);
     $sid = $row->sid;
     $lid = $row->id;
     if ($row->durchgang > 1) {
         $runden_counter = 2 * $row->runden;
     } else {
         $runden_counter = $row->runden;
     }
     for ($x = 0; $x < $runden_counter; $x++) {
         if ($row->runden_modus == 4) {
             $pairings = pow(2, $row->runden - 1 - $x);
         } elseif ($row->runden_modus == 5) {
             $pairings = pow(2, $row->runden - 2 - $x);
             if ($pairings == 0) {
                 $pairings = 1;
             }
         } else {
             $pairings = $row->teil / 2;
         }
         if ($x + 1 > $row->runden) {
             $dg = 2;
             $cnt = $x - $row->runden;
         } else {
             $dg = 1;
             $cnt = $x;
         }
         for ($y = 0; $y < $pairings; $y++) {
             $heim = JRequest::getVar('D' . $dg . 'R' . ($cnt + 1) . 'P' . ($y + 1) . 'Heim');
             $gast = JRequest::getVar('D' . $dg . 'R' . ($cnt + 1) . 'P' . ($y + 1) . 'Gast');
             $query = "UPDATE #__clm_rnd_man" . " SET tln_nr = " . $heim . " , gegner = " . $gast . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . ($cnt + 1) . " AND paar = " . ($y + 1) . " AND dg = " . $dg . " AND heim = 1 ";
             $db->setQuery($query);
             $db->query();
             $query = "UPDATE #__clm_rnd_man" . " SET tln_nr = " . $gast . " , gegner = " . $heim . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . ($cnt + 1) . " AND paar = " . ($y + 1) . " AND dg = " . $dg . " AND heim = 0 ";
             $db->setQuery($query);
             $db->query();
         }
     }
     switch ($task) {
         case 'apply':
             $msg = JText::_('PAARUNG_AENDERN_IST');
             $link = 'index.php?option=' . $option . '&section=' . $section . '&cid[]=' . $cid;
             break;
         case 'save':
         default:
             $row->checkin();
             $msg = JText::_('PAARUNG_AENDERN_IST');
             if ($row->liga_mt == 1) {
                 //mtmt
                 $link = 'index.php?option=' . $option . '&section=mturniere';
             } else {
                 $link = 'index.php?option=' . $option . '&section=ligen';
             }
             break;
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('PAARUNG_LOG');
     $clmLog->params = array('sid' => $sid, 'lid' => $lid, 'cids' => $cid);
     $clmLog->write();
     $mainframe->redirect($link, $msg);
 }
 /**
  * eigentliche Lösch-Funktion
  *
  */
 function _deleteDo()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $cid = JRequest::getVar('cid', array(), '', 'array');
     JArrayHelper::toInteger($cid);
     // vorerst nur ein markiertes Turnier übernehmen // später über foreach mehrere?
     $termineid = $cid[0];
     // access? nur admin darf löschen
     $clmAccess = clm_core::$access;
     if ($clmAccess->access('BE_event_delete') === false) {
         JError::raiseWarning(500, JText::_('NO_ACCESS'));
         return false;
     }
     // termindaten laden
     $row = JTable::getInstance('termine', 'TableCLM');
     $row->load($termineid);
     // ob Termin existent?
     if (!$row->load($termineid)) {
         JError::raiseWarning(500, CLMText::errorText('TERMINE_TASK', 'NOTEXISTING'));
         return false;
     }
     // Termin löschen
     $query = " DELETE FROM #__clm_termine " . " WHERE id = " . $termineid;
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         JError::raiseError(500, $this->_db->getErrorMsg());
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('TERMINE_TASK') . " " . JText::_('CLM_DELETED');
     $clmLog->params = array();
     $clmLog->write();
     // Message
     $app = JFactory::getApplication();
     $app->enqueueMessage($row->name . ": " . JText::_('TERMINE_TASK') . " " . JText::_('CLM_DELETED'));
     return true;
 }
 function kampflos($gast)
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $db =& JFactory::getDBO();
     $link = 'index.php?option=' . $option . '&section=' . $section;
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid);
     // load the row from the db table
     $row =& JTable::getInstance('ergebnisse', 'TableCLM');
     $row->load($cid[0]);
     $sid = $row->sid;
     $lid = $row->lid;
     $rnd = $row->runde;
     $paar = $row->paar;
     $dg = $row->dg;
     $liga_sl =& JTable::getInstance('ligen', 'TableCLM');
     $liga_sl->load($row->lid);
     $bretter = $liga_sl->stamm;
     $sieg = $liga_sl->sieg;
     $antritt = $liga_sl->antritt;
     $man_sieg = $liga_sl->man_sieg;
     $man_antritt = $liga_sl->man_antritt;
     if ($liga_sl->sl !== CLM_ID and CLM_usertype !== 'admin') {
         JError::raiseWarning(500, JText::_('ERGEBNISSE_LIGEN_ARBEIT'));
         $mainframe->redirect($link);
     }
     $query = " SELECT a.sid,a.lid,a.runde, a.paar,a.dg,a.heim,a.tln_nr, a.gegner, m.zps as hzps, g.zps as gzps FROM #__clm_rnd_man as a " . " LEFT JOIN #__clm_mannschaften as m ON m.liga = a.lid AND m.sid = a.sid AND m.tln_nr = a.tln_nr " . " LEFT JOIN #__clm_mannschaften as g ON g.liga = a.lid AND g.sid = a.sid AND g.tln_nr = a.gegner " . " WHERE a.lid = {$lid} AND a.runde = {$rnd} AND a.paar = {$paar} AND a.dg = {$dg}" . " AND ( m.zps =0 OR g.zps = 0) AND a.heim = 1";
     $db->setQuery($query);
     $data = $db->loadObjectList();
     // Wenn "Spielfrei" kampflos gesetzt wurde
     if ($data[0]->hzps == "0" and $gast == "heim" or $data[0]->gzps == "0" and $gast == "gast") {
         JError::raiseWarning(500, JText::_('ERGEBNISSE_SPIELFREI'));
         $mainframe->redirect($link);
     }
     // Datum und Uhrzeit für Meldezeitpunkt
     $date =& JFactory::getDate();
     $now = $date->toMySQL();
     $user =& JFactory::getUser();
     $meldung = $user->get('id');
     $brett_punkte = $bretter * ($sieg + $antritt);
     $man_punkte = $man_sieg + $man_antritt;
     $query = "UPDATE #__clm_rnd_man" . " SET brettpunkte = '" . $brett_punkte . "'" . " , manpunkte = '" . $man_punkte . "'" . " , zeit = '{$now}'" . " , gemeldet = '{$meldung}'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paar . " AND dg = " . $dg;
     if ($gast == "heim") {
         $query = $query . " AND heim = 1 ";
     } else {
         $query = $query . " AND heim = 0 ";
     }
     $db->setQuery($query);
     $db->query();
     $query = "UPDATE #__clm_rnd_man" . " SET brettpunkte = '0'" . " , manpunkte = '0'" . " , zeit = '{$now}'" . " , gemeldet = '{$meldung}'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paar . " AND dg = " . $dg;
     if ($gast == "heim") {
         $query = $query . " AND heim = 0 ";
     } else {
         $query = $query . " AND heim = 1 ";
     }
     $db->setQuery($query);
     $db->query();
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('ERGEBNISSE_AKTION_KL');
     $clmLog->params = array('sid' => $sid, 'lid' => $lid, 'rnd' => $rnd, 'paar' => $paar, 'dg' => $dg);
     $clmLog->write();
 }
Beispiel #18
0
 function _deleteDo()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $cid = JRequest::getVar('cid', array(), '', 'array');
     JArrayHelper::toInteger($cid);
     // vorerst nur eine markiertes  übernehmen // später über foreach mehrere?
     $catid = $cid[0];
     // access?
     $category = new CLMCategory($catid, TRUE);
     if (!$category->checkAccess(true, false, false)) {
         JError::raiseWarning(500, JText::_('CATEGORY_NO_ACCESS'));
         return false;
     }
     if (!$category->checkDelete()) {
         JError::raiseWarning(500, JText::_('CATEGORY_NO_DELETE'));
         return false;
     }
     // Daten laden
     $row = JTable::getInstance('categories', 'TableCLM');
     $row->load($catid);
     // falls Cat existent?
     if (!$row->load($catid)) {
         JError::raiseWarning(500, CLMText::errorText('CATEGORY', 'NOTEXISTING'));
         return false;
     }
     // Category löschen
     $query = " DELETE FROM #__clm_categories " . " WHERE id = " . $catid;
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         JError::raiseError(500, $this->_db->getErrorMsg());
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('CATEGORY_DELETED');
     $clmLog->params = array('catid' => $catid);
     $clmLog->write();
     // Message
     $app = JFactory::getApplication();
     $app->enqueueMessage($row->name . ": " . JText::_('CATEGORY_DELETED'));
     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;
 }
Beispiel #20
0
 function dwz_del()
 {
     $mainframe = JFactory::getApplication();
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $db = JFactory::getDBO();
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     JArrayHelper::toInteger($cid);
     // keine Saison gewählt
     if ($cid[0] < 1) {
         JError::raiseWarning(500, JText::_('SAISON_NO_LOESCH'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     //Saison wird durch User im Screen bestimmt
     $row = JTable::getInstance('saisons', 'TableCLM');
     $row->load($cid[0]);
     // load the row from the db table
     $sid = $row->id;
     // Löschen der DWZ-Auswertung zur Saison
     $result = clm_core::$api->db_season_delDWZ($sid, true);
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('SAISON_LOG_DWZ_DEL');
     $clmLog->nr_aktion = 102;
     $clmLog->params = array('sid' => $sid, 'lid' => 0);
     $clmLog->write();
     $msg = JText::_('SAISON_DWZ_IST_LOESCH');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
 }
 function copy()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $this->setRedirect('index.php?option=' . $option . '&section=' . $section);
     $cid = JRequest::getVar('cid', null, 'post', 'array');
     $db =& JFactory::getDBO();
     $table =& JTable::getInstance('gruppen', 'TableCLM');
     $user =& JFactory::getUser();
     $n = count($cid);
     // Prüfen ob User Berechtigung zum kopieren hat
     $sql = " SELECT l.sl FROM #__clm_mannschaften as a " . " LEFT JOIN #_clm_liga as l ON ( l.id= a.liga AND l.sid = a.sid) " . " WHERE a.id = " . $cid[0];
     $db->setQuery($sql);
     $lid = $db->loadObjectList();
     // Wenn User nicht Admin oder DWZ prüfen ob SL der Staffel
     if (CLM_usertype !== 'admin' and $lid[0]->sl != $jid) {
         JError::raiseWarning(500, JText::_('GRUPPEN_KOPIE'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link);
     } else {
         if ($n > 0) {
             foreach ($cid as $id) {
                 if ($table->load((int) $id)) {
                     $table->id = 0;
                     $table->Gruppe = 'Kopie von ' . $table->Gruppe;
                     $table->published = 0;
                     if (!$table->store()) {
                         return JError::raiseWarning($table->getError());
                     }
                 } else {
                     return JError::raiseWarning(500, $table->getError());
                 }
             }
         } else {
             return JError::raiseWarning(500, JText::_('GRUPPEN_NO_SELECT'));
         }
         if ($n > 1) {
             $msg = ' Einträge kopiert !';
         } else {
             $msg = ' Eintrag kopiert !';
         }
         // Log schreiben
         $clmLog = new CLMLog();
         $clmLog->aktion = "Gruppe(n) kopiert";
         $table =& JTable::getInstance('gruppen', 'TableCLM');
         $table->load($cid[0]);
         $clmLog->params = array('sid' => $table->sid, 'lid' => $table->liga, 'zps' => $table->zps, 'cids' => implode(',', $cid));
         $clmLog->write();
         $this->setMessage(JText::_($n . $msg));
     }
 }
Beispiel #22
0
 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;
 }
Beispiel #23
0
 function copy_saison()
 {
     $mainframe = JFactory::getApplication();
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $db = JFactory::getDBO();
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $clmAccess = clm_core::$access;
     if ($clmAccess->access('BE_user_copy') === false) {
         JError::raiseWarning(500, JText::_('USERS_ADMIN', true));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // id Vorsaison bestimmen
     $sql = " SELECT id FROM #__clm_saison " . " WHERE archiv = 1 " . " ORDER BY id DESC LIMIT 1";
     $db->setQuery($sql);
     $check = $db->loadResult();
     // keine Vorsaison existent !
     if (!$check) {
         JError::raiseWarning(500, JText::_('USERS_NO_VORSAISON'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // id aktuelle Saison bestimmen
     $sql = " SELECT id FROM #__clm_saison " . " WHERE archiv = 0 AND published = 1" . " ORDER BY id ASC LIMIT 1";
     $db->setQuery($sql);
     $sid = $db->loadResult();
     // keine Sid gefunden
     if (!$sid) {
         JError::raiseWarning(500, JText::_('USERS_NO_AKTUELLE_SAISON'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // Anzahl User bestimmen
     $sql = " SELECT COUNT(id) FROM #__clm_user WHERE sid = " . $check;
     $db->setQuery($sql);
     $count = $db->loadResult();
     // keine User gefunden
     if (!$count) {
         JError::raiseWarning(500, JText::_('USERS_NO'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // schon vorhandenen Benutzer in aktueller Saison bestimmen und in Array
     $sql = " SELECT jid FROM #__clm_user " . " WHERE sid =" . $sid . " ORDER BY jid ASC ";
     $db->setQuery($sql);
     $akt_user = $db->loadObjectList();
     $arr_user = array();
     foreach ($akt_user as $jid_user) {
         $arr_user[] = $jid_user->jid;
     }
     $users = implode(',', $arr_user);
     if (!$users) {
         $users = 0;
     }
     // Alle User aus Vorsaison ohne Account in der aktuellen Saison laden
     $sql = " SELECT id FROM #__clm_user " . " WHERE sid = " . $check . ' AND jid NOT IN (' . $users . ') ' . " ORDER BY id ASC ";
     $db->setQuery($sql);
     $spieler = $db->loadObjectList();
     // keine User zu kopieren
     if (count($spieler) == "0") {
         JError::raiseWarning(500, JText::_('USERS_ALLE_IST'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // User laden und mit neuer Saison speichern
     $row = JTable::getInstance('users', 'TableCLM');
     for ($x = 0; $x < count($spieler); $x++) {
         $row->load($spieler[$x]->id);
         $row->id = "0";
         $row->sid = $sid;
         if (!$row->store()) {
             return JError::raiseWarning($row->getError());
         }
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = "User Vorsaison kopiert";
     $clmLog->params = array('jid' => $jid, 'cids' => $users);
     $clmLog->write();
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
 }
 function kampflos($gast)
 {
     $mainframe = JFactory::getApplication();
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $db = JFactory::getDBO();
     $link = 'index.php?option=' . $option . '&section=' . $section;
     $cid = JRequest::getVar('cid', array(), '', 'array');
     JArrayHelper::toInteger($cid);
     if (count($cid) < 1) {
         JError::raiseWarning(500, JText::_('ERGEBNISSE_SELECT', true));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // load the row from the db table
     $row = JTable::getInstance('ergebnisse', 'TableCLM');
     $row->load($cid[0]);
     $sid = $row->sid;
     $lid = $row->lid;
     $rnd = $row->runde;
     $paar = $row->paar;
     $dg = $row->dg;
     $liga_sl = JTable::getInstance('ligen', 'TableCLM');
     $liga_sl->load($row->lid);
     $bretter = $liga_sl->stamm;
     $sieg = $liga_sl->sieg;
     $antritt = $liga_sl->antritt;
     $man_sieg = $liga_sl->man_sieg;
     $man_antritt = $liga_sl->man_antritt;
     //Liga-Parameter aufbereiten
     $paramsStringArray = explode("\n", $liga_sl->params);
     $params = array();
     foreach ($paramsStringArray as $value) {
         $ipos = strpos($value, '=');
         if ($ipos !== false) {
             $key = substr($value, 0, $ipos);
             $params[$key] = substr($value, $ipos + 1);
         }
     }
     if (!isset($params['noOrgReference'])) {
         //Standardbelegung
         $params['noOrgReference'] = '0';
     }
     // Prüfen ob User Berechtigung zum editieren hat
     $clmAccess = clm_core::$access;
     if ($liga_sl->liga_mt == "0") {
         $mppoint = 'league';
         $csection = 'ligen';
     } else {
         $mppoint = 'teamtournament';
         $csection = 'mturniere';
     }
     if ($clmAccess->access('BE_' . $mppoint . '_edit_result') === false) {
         JError::raiseWarning(500, JText::_('LIGEN_STAFFEL_TOTAL'));
         $section = 'runden';
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
     }
     if ($liga_sl->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_result') !== true) {
         //if ( $liga_sl->sl !== clm_core::$access->getJid() AND clm_core::$access->getType() !== 'admin') {
         JError::raiseWarning(500, JText::_('ERGEBNISSE_LIGEN_ARBEIT'));
         $mainframe->redirect($link);
     }
     $query = " SELECT a.sid,a.lid,a.runde, a.paar,a.dg,a.heim,a.tln_nr, a.gegner, m.zps as hzps, g.zps as gzps FROM #__clm_rnd_man as a " . " LEFT JOIN #__clm_mannschaften as m ON m.liga = a.lid AND m.sid = a.sid AND m.tln_nr = a.tln_nr " . " LEFT JOIN #__clm_mannschaften as g ON g.liga = a.lid AND g.sid = a.sid AND g.tln_nr = a.gegner " . " WHERE a.lid = {$lid} AND a.runde = {$rnd} AND a.paar = {$paar} AND a.dg = {$dg}" . " AND a.heim = 1";
     $db->setQuery($query);
     $data = $db->loadObjectList();
     // Wenn "Spielfrei" kampflos gesetzt wurde
     if (($data[0]->hzps == "0" and ($gast == "heim" or $gast == "home") or $data[0]->gzps == "0" and ($gast == "gast" or $gast == "away")) and $params['noOrgReference'] == '0') {
         JError::raiseWarning(500, JText::_('ERGEBNISSE_SPIELFREI'));
         $mainframe->redirect($link);
     }
     // Datum und Uhrzeit für Meldezeitpunkt
     $date = JFactory::getDate();
     $now = $date->toSQL();
     $user = JFactory::getUser();
     $meldung = $user->get('id');
     if ($gast == "heim" or $gast == "home") {
         $comment = JText::_('ERGEBNISSE_COMMENT_HOME_KL');
     } else {
         $comment = JText::_('ERGEBNISSE_COMMENT_GUEST_KL');
     }
     $brett_punkte = $bretter * ($sieg + $antritt);
     $man_punkte = $man_sieg + $man_antritt;
     $query = "UPDATE #__clm_rnd_man" . " SET brettpunkte = '" . $brett_punkte . "'" . " , manpunkte = '" . $man_punkte . "'" . " , ergebnis = 5 " . " , kampflos = 1 " . " , zeit = '{$now}'" . " , gemeldet = '{$meldung}'" . " , comment = '{$comment}'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paar . " AND dg = " . $dg;
     if ($gast == "heim" or $gast == "home") {
         $query = $query . " AND heim = 1 ";
     } else {
         $query = $query . " AND heim = 0 ";
     }
     $db->setQuery($query);
     $db->query();
     $query = "UPDATE #__clm_rnd_man" . " SET brettpunkte = '0'" . " , manpunkte = '0'" . " , ergebnis = 4 " . " , kampflos = 1 " . " , zeit = '{$now}'" . " , gemeldet = '{$meldung}'" . " , comment = '{$comment}'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paar . " AND dg = " . $dg;
     if ($gast == "heim" or $gast == "home") {
         $query = $query . " AND heim = 0 ";
     } else {
         $query = $query . " AND heim = 1 ";
     }
     $db->setQuery($query);
     $db->query();
     if ($liga_sl->runden_modus == 4 or $liga_sl->runden_modus == 5 and $rnd < $liga_sl->runden) {
         // KO Turnier
         if ($gast == "heim" or $gast == "home") {
             $ko_heim = $rnd;
             $ko_gast = $rnd - 1;
         } else {
             $ko_heim = $rnd - 1;
             $ko_gast = $rnd;
         }
         // Für Heimmannschaft updaten
         $query = "UPDATE #__clm_mannschaften" . " SET rankingpos = " . $ko_heim . " WHERE sid = " . $sid . " AND liga = " . $lid . " AND tln_nr = " . $data[0]->tln_nr;
         $db->setQuery($query);
         $db->query();
         $query = "UPDATE #__clm_mannschaften" . " SET rankingpos = " . $ko_gast . " WHERE sid = " . $sid . " AND liga = " . $lid . " AND tln_nr = " . $data[0]->gegner;
         $db->setQuery($query);
         $db->query();
     }
     // errechnte/aktualisiere Rangliste
     clm_core::$api->db_tournament_ranking($data[0]->lid, true);
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('ERGEBNISSE_AKTION_KL');
     $clmLog->params = array('sid' => $sid, 'lid' => $lid, 'rnd' => $rnd, 'paar' => $paar, 'dg' => $dg);
     $clmLog->write();
 }
Beispiel #25
0
 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;
 }
Beispiel #26
0
 function convert_db()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $db =& JFactory::getDBO();
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     // Konfigurationsparameter auslesen
     $config =& JComponentHelper::getParams('com_clm');
     $version = $config->get('version', 0);
     $lv = $config->get('lv', 705);
     // DB auf deutsche Version ändern
     if ($version == "0") {
     }
     // DB auf niederländische Version ändern
     if ($version == "1") {
         // Prüfen ob benötigte Dateien vorhanden sind
         $path = 'components' . DS . $option . DS . upload . DS;
         $leden = $path . 'leden.csv';
         $verenigingen = $path . 'verenigingen.csv';
         if (!file_exists($leden)) {
             JError::raiseWarning(500, JText::_('DB_DATEI_LEDEN'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
         }
         if (!file_exists($verenigingen)) {
             JError::raiseWarning(500, JText::_('DB_DATEI_VEREINIGEN'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
         }
         // Tabellen bearbeiten
         $sql = "ALTER TABLE `dwz_spieler` CHANGE `Mgl_Nr` `Mgl_Nr` CHAR( 7 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `dwz_verbaende` CHANGE `Verband` `Verband` CHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL," . " CHANGE `LV` `LV` CHAR( 2 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL," . " CHANGE `Uebergeordnet` `Uebergeordnet` CHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `dwz_vereine` CHANGE `Verband` `Verband` CHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL," . " CHANGE `LV` `LV` CHAR( 2 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `#__clm_dwz_spieler` CHANGE `Mgl_Nr` `Mgl_Nr` VARCHAR( 7 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `#__clm_dwz_vereine` CHANGE `Verband` `Verband` CHAR( 4 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL," . " CHANGE `LV` `LV` CHAR( 2 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `#__clm_meldeliste_spieler` CHANGE `mgl_nr` `mgl_nr` MEDIUMINT( 7 ) UNSIGNED NOT NULL DEFAULT '0' ";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `#__clm_rangliste_spieler` CHANGE `Mgl_Nr` `Mgl_Nr` MEDIUMINT( 7 ) UNSIGNED NOT NULL DEFAULT '0'";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `#__clm_rnd_spl` CHANGE `spieler` `spieler` MEDIUMINT( 7 ) UNSIGNED NULL DEFAULT NULL," . " CHANGE `gegner` `gegner` MEDIUMINT( 7 ) UNSIGNED NULL DEFAULT NULL";
         $db->setQuery($sql);
         $db->query();
         ///////////////////////////////////
         // Noch KEINE SWT Unterstützung !!
         ///////////////////////////////////
         $sql = "ALTER TABLE `#__clm_turniere_rnd_spl` CHANGE `spieler` `spieler` MEDIUMINT( 7 ) UNSIGNED NULL DEFAULT NULL , " . " CHANGE `gegner` `gegner` MEDIUMINT( 7 ) UNSIGNED NULL DEFAULT NULL ";
         $db->setQuery($sql);
         $db->query();
         $sql = "ALTER TABLE `#__clm_turniere_tlnr` CHANGE `mgl_nr` `mgl_nr` MEDIUMINT( 7 ) UNSIGNED NOT NULL DEFAULT '0' ";
         $db->setQuery($sql);
         $db->query();
         // alte Verbände löschen
         $sql = "TRUNCATE TABLE `dwz_verbaende`";
         $db->setQuery($sql);
         $db->query();
         // Verbände in SQL DB
         $sql = " REPLACE INTO `dwz_verbaende` (`Verband`, `LV`, `Uebergeordnet`, `Verbandname`) VALUES " . "('00','00','0000','KNSB')," . "('01','01','0000','FSB')," . "('02','02','0000','NOSBO')," . "('03','03','0000','SBO')," . "('04','04','0000','OSBO')," . "('06','06','0000','SGS')," . "('08','08','0000','SGA')," . "('09','09','0000','NHSB')," . "('11','11','0000','LeiSB')," . "('12','12','0000','HSB')," . "('14','14','0000','RSB')," . "('16','16','0000','ZSB')," . "('17','17','0000','NBSB')," . "('19','19','0000','LiSB')," . "('20','20','0000','Onbekend')," . "('30','30','0000','Scholen')";
         $db->setQuery($sql);
         $db->query();
         unset($sql);
         // Vereine in SQL DB
         // alte Vereine löschen
         $del_sql = "TRUNCATE TABLE `dwz_vereine`";
         $db->setQuery($del_sql);
         $db->query();
         $Nr = 0;
         $fp = fopen($verenigingen, "r");
         while ($zeile = fgetcsv($fp, 500, ",")) {
             $Nr++;
             if ($Nr == 2) {
                 $sql = $sql . "(" . $zeile[0] . "," . substr($zeile[0], 0, -3) . "'," . substr($zeile[0], 0, -3) . "'," . $zeile[1] . ")";
             }
             if ($Nr > 2) {
                 $sql = $sql . ",(" . $zeile[0] . "," . substr($zeile[0], 0, -3) . "'," . substr($zeile[0], 0, -3) . "'," . $zeile[1] . ")";
             }
         }
         fclose($fp);
         $pre_sql_verein = " REPLACE INTO `dwz_vereine` (`ZPS`, `LV`, `Verband`, `Vereinname`) VALUES ";
         $dat = $pre_sql_verein . $sql;
         $db->setQuery($dat);
         $db->query();
         // Spieler in SQL DB
         // alte Vereine löschen
         $del_sql = "TRUNCATE TABLE `dwz_spieler`";
         $db->setQuery($del_sql);
         $db->query();
         // 1)  Relatienummer		Mgl_nr
         // 2)  VerenigingID		ZPS
         // 3)  LidmaatschapTypeID	Mitgliedschaftstyp, H=Haupt, D=Passiv
         // 4)  Achternaam;		Nachname
         // 5)  Tussenvoegsel		Zwischenstück (van, van der, etc.)
         // 6)  Voornaam			Vorname
         // 7)  Voorletters		Vorbuchstaben
         // 8)  FIDEnaam			FIDE Name
         // 9)  Geslacht			Geschlecht
         // 10) Geboren			Geburtstag
         // 11) Nationaliteit		Nationalität
         // 12) KNSBRating		DWZ
         // 13) KNSBJeugdRating		Jugend Rating
         // 14) AantalJeugdPartijen	Anzahl Jugend Partien
         // 15) AantalPartijen		Anzahl Partien
         // 16) FIDERating		FIDERating
         // 17) FIDEid			FIDEid
         // 18) Titel			Titel
         // 19) BondID			Bund ID (Verband)
         unset($zeile);
         $Nr = 0;
         $fp = fopen($leden, "r");
         while ($zeile = fgetcsv($fp, 500, ";")) {
             $Nr++;
             /*
             	if($Nr == 2) {
             	$ssql = $ssql."('".$zeile[1]."','".$zeile[0]."','".$zeile[2]."','".$zeile[3].",".$zeile[5]."','".$zeile[8]."','".$zeile[9]."','".$zeile[11]."','','".$zeile[15]."','".$zeile[17]."','".$zeile[16]."','".$zeile[10]."')";
             		}
             */
             $pre_sql = " REPLACE INTO `dwz_spieler` (`ZPS`, `Mgl_Nr`, `Status`, `Spielername`,`Geschlecht`,`Geburtsjahr`,`DWZ`,`DWZ_Index`,`FIDE_Elo`,`FIDE_Titel`,`FIDE_ID`,`FIDE_Land`) VALUES ";
             if ($Nr > 1 and $lv == $zeile[18]) {
                 $ssql = "('" . $zeile[1] . "','" . $zeile[0] . "','" . $zeile[2] . "','" . $zeile[7] . "','" . $zeile[8] . "','" . $zeile[9] . "','" . $zeile[11] . "','','" . $zeile[15] . "','" . $zeile[17] . "','" . $zeile[16] . "','" . $zeile[10] . "')";
             }
             $dat = $pre_sql . $ssql;
             $db->setQuery($dat);
             $db->query();
         }
         fclose($fp);
     }
     // Log
     // Konfigurationsparameter auslesen
     $config =& JComponentHelper::getParams('com_clm');
     $version = $config->get('version', 0);
     if ($version == "0") {
         $db_version = "deutsche";
     }
     if ($version == "1") {
         $db_version = "niederländische";
     }
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = "DB auf {$version} geändert";
     $clmLog->params = array('cids' => $file['size']);
     $clmLog->write();
     $msg = JText::_('DB_DATENBANK') . ' ' . $db_version . ' ' . JText::_('DB_VERSION');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
 }
Beispiel #27
0
 function check()
 {
     JRequest::checkToken() or die('Invalid Token');
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     JArrayHelper::toInteger($cid, array(0));
     // keine Runde gewählt
     if ($cid[0] < 1) {
         $msg = JText::_('RUNDE_RUNDE_PRUE');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
     }
     $row = JTable::getInstance('runden', 'TableCLM');
     $row->load($cid[0]);
     $liga = JTable::getInstance('ligen', 'TableCLM');
     $liga->load($row->liga);
     if ($liga->liga_mt == "0") {
         $mppoint = 'league';
         $csection = 'ligen';
     } else {
         $mppoint = 'teamtournament';
         $csection = 'mturniere';
     }
     $clmAccess = clm_core::$access;
     // Prüfen ob User Berechtigung hat
     //if ( $liga->sl !== clm_core::$access->getJid() AND clm_core::$access->getType() !== 'admin') {
     if ($liga->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_round') !== true or $clmAccess->access('BE_' . $mppoint . '_edit_round') === false) {
         JError::raiseWarning(500, JText::_('RUNDE_ST_PRUEFEN'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link);
     }
     $table = JTable::getInstance('runden', 'TableCLM');
     $table->load($cid[0]);
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('RUNDE_LOG_VERIFIED');
     $table = JTable::getInstance('runden', 'TableCLM');
     $table->load($cid[0]);
     $clmLog->params = array('sid' => $table->sid, 'lid' => $table->liga, 'rnd' => $table->nr);
     $clmLog->write();
     // Link MUSS hardcodiert sein !!!
     $mainframe->redirect('index.php?option=' . $option . '&section=check&task=edit&cid[]=' . $cid[0]);
 }
Beispiel #28
0
 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 copy()
 {
     $mainframe = JFactory::getApplication();
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $cid = JRequest::getVar('cid', null, 'post', 'array');
     $db = JFactory::getDBO();
     $table =& JTable::getInstance('ranglisten', 'TableCLM');
     $user = JFactory::getUser();
     $n = count($cid);
     $this->setRedirect('index.php?option=' . $option . '&section=' . $section);
     // Prüfen ob User Berechtigung zum kopieren hat
     $clmAccess = clm_core::$access;
     if ($clmAccess->access('BE_club_edit_ranking') === false) {
         JError::raiseWarning(500, JText::_('RANGLISTE_ADMIN'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link);
     } else {
         if ($n > 0) {
             foreach ($cid as $id) {
                 if ($table->load((int) $id)) {
                     $table->id = 0;
                     $table->published = 0;
                     if (!$table->store()) {
                         return JError::raiseWarning($table->getError());
                     }
                 } else {
                     return JError::raiseWarning(500, $table->getError());
                 }
             }
         } else {
             return JError::raiseWarning(500, JText::_('RANGLISTE_NO_SELECT'));
         }
         if ($n > 1) {
             $msg = JText::_('RANGLISTE_MSG_COPY_ENTRYS');
         } else {
             $msg = JText::_('RANGLISTE_MSG_COPY_ENTRY');
         }
         // Log schreiben
         $clmLog = new CLMLog();
         $clmLog->aktion = JText::_('RANGLISTE_LOG_COPIED');
         $table =& JTable::getInstance('ranglisten', 'TableCLM');
         $table->load($cid[0]);
         $clmLog->params = array('sid' => $table->sid, 'lid' => $lid, 'zps' => $table->zps, 'cids' => implode(',', $cid));
         $clmLog->write();
         $this->setMessage(JText::_($n . $msg));
     }
 }
Beispiel #30
0
 public static function spielfrei()
 {
     JRequest::checkToken() or die('Invalid Token');
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     JArrayHelper::toInteger($cid, array(0));
     // keine Meldeliste gewählt //
     if ($cid[0] < 1) {
         $msg = JText::_('MANNSCHAFTEN_MANNSCHAFT_AUS');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
     }
     // load the row from the db table
     $row = JTable::getInstance('mannschaften', 'TableCLM');
     $row->load($cid[0]);
     $tlnr = $row->tln_nr;
     // load the row from the db table
     $rowliga = JTable::getInstance('ligen', 'TableCLM');
     $liga = $row->liga;
     $rowliga->load($liga);
     $link = 'index.php?option=' . $option . '&section=' . $section;
     // Prüfen ob User Berechtigung zum publizieren hat
     $clmAccess = clm_core::$access;
     if ($clmAccess->access('BE_team_edit') === false) {
         $section = 'info';
         JError::raiseWarning(500, JText::_('TEAM_NO_ACCESS'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link);
     }
     if ($rowliga->sl != clm_core::$access->getJid() and $clmAccess->access('BE_team_edit') !== true) {
         //if ( $rowliga->sl != clm_core::$access->getJid() AND clm_core::$access->getType() !== 'admin') {
         JError::raiseWarning(500, JText::_('MANNSCHAFTEN_MANNSCHAFT_SPIELFREI'));
         $mainframe->redirect($link);
     }
     $query = "DELETE FROM #__clm_rnd_spl" . " WHERE sid = " . $row->sid . " AND lid = " . $row->liga . " AND tln_nr = {$tlnr} ";
     $db->setQuery($query);
     $db->query();
     $query = "UPDATE #__clm_rnd_man" . " SET brettpunkte = NULL, manpunkte = NULL, bp_sum = NULL, mp_sum = NULL, gemeldet = 1, wertpunkte = NULL " . " WHERE sid = " . $row->sid . " AND lid = " . $row->liga . " AND ( tln_nr = {$tlnr} OR gegner = {$tlnr}) ";
     $db->setQuery($query);
     $db->query();
     $query = "UPDATE #__clm_mannschaften" . " SET name = 'spielfrei', zps = '0', man_nr = 0, liste = 0, edit_liste = 0, mf = 0, sg_zps = '0', published = 0 " . " WHERE sid = " . $row->sid . " AND liga = " . $row->liga . " AND tln_nr = {$tlnr} ";
     $db->setQuery($query);
     $db->query();
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('MANNSCHAFT_LOG_NO_GAMES');
     $clmLog->params = array('sid' => $row->sid, 'lid' => $row->liga, 'man' => $tlnr, 'cids' => $cid[0]);
     $clmLog->write();
     $msg = JText::_('MANNSCHAFTEN_MANNSCHAFT_SPIELF');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
 }