function _getCLMVerein(&$options) { $zps = clm_escape(JRequest::getVar('zps')); $db = JFactory::getDBO(); $id = @$options['id']; $query = "SELECT name " . " FROM #__clm_vereine " . " WHERE zps = '{$zps}' "; return $query; }
function _getCLMSaisons(&$options) { $sid = JRequest::getInt('saison', '1'); $zps = clm_escape(JRequest::getVar('zps')); $db = JFactory::getDBO(); $id = @$options['id']; $query = ' SELECT a.name, a.id, a.archiv FROM #__clm_saison AS a' . " ORDER BY a.name DESC "; return $query; }
function __construct() { parent::__construct(); $id = clm_escape(JRequest::getVar('id')); if (!isset($id) or $id == 0) { $array = JRequest::getVar('cid', 0, '', 'array'); $this->setId(clm_escape($array[0])); } else { $this->setID($id); } }
function __construct() { parent::__construct(); $this->turnierid = JRequest::getInt('turnier', 0); $this->spRang = JRequest::getInt('spRang', 0); //Sonderranglisten $this->orderby = clm_escape(JRequest::getVar('orderby', 'pos')); $this->_getTurnierData(); $this->_getTurnierPlayers(); $this->_getTurnierMatches(); }
function _getSchnellmenu(&$options) { $sid = JRequest::getInt('saison', '1'); $liga = JRequest::getInt('liga', '1'); $start = clm_escape(JRequest::getVar('start', '1')); $db = JFactory::getDBO(); if ($start == '1') { $date = date("Y-m-d"); } else { $date = $start; } $query = " (SELECT a.datum AS datum FROM #__clm_runden_termine AS a " . " LEFT JOIN #__clm_liga AS l ON l.id = a.liga " . " WHERE l.published != '0' AND TO_DAYS(datum)+183 >= TO_DAYS('" . $date . "') )" . " UNION ALL" . " (SELECT b.startdate AS datum FROM #__clm_termine AS b " . " WHERE b.published != '0' AND TO_DAYS(b.startdate)+183 >= TO_DAYS('" . $date . "') )" . " UNION ALL" . " (SELECT c.datum AS datum FROM #__clm_turniere_rnd_termine AS c " . " WHERE TO_DAYS(datum)+183 >= TO_DAYS('" . $date . "') )" . " ORDER BY datum ASC"; return $query; }
function _getCLMSpieler(&$options) { $mainframe = JFactory::getApplication(); $option = JRequest::getCmd('option'); $sid = JRequest::getInt('saison', '1'); $zps = clm_escape(JRequest::getVar('zps')); $db = JFactory::getDBO(); $id = @$options['id']; $query = "SELECT Spielername as name, Mgl_Nr as id, Status, Geburtsjahr, DWZ as dwz, DWZ_Index, FIDE_Elo as elo" . " FROM #__clm_dwz_spieler " . " WHERE ZPS = '{$zps}' " . " AND sid = '{$sid}' "; $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order_mgl', 'filter_order', 'name', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir_mgl', 'filter_order_Dir', 'ASC', 'word'); $query .= " ORDER BY " . $filter_order . " " . $filter_order_Dir . ", name "; return $query; }
function getSpielerliste() { if (!empty($this->_splist)) { return $this->_splist; } set_time_limit(30); $swt_id = clm_escape(JRequest::getVar('swt_id', 0, 'default', 'int')); $swt_db_data = $this->getDataSWTdb(); $anz_mannschaften = $swt_db_data['anz_mannschaften']; for ($m = 1; $m <= $anz_mannschaften; $m++) { $sql = ' SELECT s.man_id, s.snr, s.mgl_nr as mgl_nr, s.zps as zps, d.Mgl_Nr, d.ZPS, d.Spielername as name,' . ' CONCAT_WS(" - ", s.snr, d.Spielername) as text, s.id as id' . ' FROM #__clm_swt_meldeliste_spieler as s' . ' LEFT JOIN #__clm_swt_mannschaften as m' . ' ON s.man_id = m.id' . ' LEFT JOIN #__clm_dwz_spieler as d' . ' ON s.mgl_nr = d.Mgl_Nr AND s.zps = d.ZPS AND s.sid = d.sid' . ' WHERE m.swt_id = ' . $swt_id . ' AND m.tln_nr = ' . $m . ' ORDER BY s.snr ASC'; $tmp = $this->_getList($sql); if ($tmp == null) { $tmp = array(); } $this->_splist[$m] = $tmp; } if ($this->debug_ausgaben > 2) { echo "<pre>_splist: "; print_r($this->_splist); echo "</pre>"; } return $this->_splist; }
function __construct() { parent::__construct(); $array = JRequest::getVar('cid', 0, '', 'array'); $this->setId(clm_escape($array[0])); }
static function daten_edit() { $mainframe = JFactory::getApplication(); // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $db = JFactory::getDBO(); $option = JRequest::getCmd('option'); $section = JRequest::getVar('section'); $sid = JRequest::getVar('sid'); $name = JRequest::getVar('name'); $mglnr = JRequest::getVar('mglnr'); $dwz = JRequest::getVar('dwz'); $dwz_index = JRequest::getVar('dwz_index'); $geschlecht = JRequest::getVar('geschlecht'); $geburtsjahr = JRequest::getVar('geburtsjahr'); $zps = JRequest::getVar('zps'); $status = JRequest::getVar('status'); // Prüfen ob Name und Mitgliedsnummer angegeben wurden if ($name == "" or $mglnr == "" or $mglnr == "0") { JError::raiseWarning(500, JText::_('DWZ_NAME_NR')); $link = 'index.php?option=' . $option . '§ion=' . $section; $mainframe->redirect($link, $msg); } // Prüfen ob Mitgliedsnummer existiert $filter_mgl = $mainframe->getUserStateFromRequest("{$option}.filter_mgl", 'filter_mgl', 0, 'int'); $query = "SELECT Mgl_Nr FROM #__clm_dwz_spieler " . " WHERE ZPS ='{$zps}'" . " AND sid = '{$sid}'" . " AND Mgl_Nr = '{$mglnr}'"; $db->setQuery($query); $mgl_exist = $db->loadObjectList(); if (!$mgl_exist) { JError::raiseWarning(500, JText::_('DWZ_SPIELER_NO')); JError::raiseNotice(6000, JText::_('DWZ_NACHM')); $link = 'index.php?option=' . $option . '§ion=' . $section; $mainframe->redirect($link, $msg); } // Datensatz updaten $query = "UPDATE #__clm_dwz_spieler " . " SET Spielername = '" . clm_escape($name) . "' " . " , Mgl_Nr = '" . clm_escape($mglnr) . "' " . " , DWZ = '" . clm_escape($dwz) . "' " . " , DWZ_Index = '" . clm_escape($dwz_index) . "' " . " , Geschlecht = '" . clm_escape($geschlecht) . "' " . " , Geburtsjahr = '" . clm_escape($geburtsjahr) . "' " . " , Status = '" . clm_escape($status) . "' " . " WHERE ZPS = '" . clm_escape($zps) . "' " . " AND sid = '" . clm_escape($sid) . "'" . " AND Mgl_Nr = '" . clm_escape($mglnr) . "'"; $db->setQuery($query); $db->query(); // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = "Spielerdaten geändert"; $clmLog->params = array('sid' => $sid, 'zps' => $zps, 'mgl_nr' => $mglnr); $clmLog->write(); $msg = JText::_('DWZ_SPIELER_AENDERN'); $link = 'index.php?option=' . $option . '§ion=' . $section; $mainframe->redirect($link, $msg); }
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 _copyToCLMTables() { $swt_tid = clm_escape(JRequest::getVar('swt_tid')); $update = JRequest::getVar('update'); $tid = JRequest::getVar('tid'); // Turnier kopieren // Nur kopieren, wenn das Turnier noch nicht kopiert wurde (d.h. die tid in der #__swt_turniere noch nicht geupdated wurde bzw. == 0 ist) if ($this->_getTid($swt_tid) == 0) { if (!$this->_copyTurnier($swt_tid, $update, $tid)) { JFactory::getApplication()->enqueueMessage(JText::_('SWT_STORE_ERROR_COPY_TOURNAMENT'), 'error'); return false; } } // Nachdem das Turnier kopiert wurde existiert auf jeden Fall eine Turnier-ID != 0 // Diese soll nun f�r die weiteren Aufgaben benutzt werden $tid = $this->_getTid($swt_tid); // Teilnehmer kopieren if (!$this->_copyTeilnehmer($swt_tid, $update, $tid)) { JFactory::getApplication()->enqueueMessage(JText::_('SWT_STORE_ERROR_COPY_PLAYERS'), 'error'); return false; } // RundenInfos kopieren if (!$this->_copyRundenInfos($swt_tid, $update, $tid)) { JFactory::getApplication()->enqueueMessage(JText::_('SWT_STORE_ERROR_COPY_ROUNDS'), 'error'); return false; } // Paarungen kopieren if (!$this->_copyPaarungen($swt_tid, $update, $tid)) { JFactory::getApplication()->enqueueMessage(JText::_('SWT_STORE_ERROR_COPY_MATCHES'), 'error'); return false; } return true; }
function _sqlWhere() { // init $where = array(); if ($this->param['parentid'] > 0) { if (isset($this->parentChilds[$this->param['parentid']])) { $arrayAllCatid = $this->parentChilds[$this->param['parentid']]; $arrayAllCatid[] = $this->param['parentid']; } else { $arrayAllCatid[] = $this->param['parentid']; } $where[] = '( ( id = ' . implode(' OR id = ', $arrayAllCatid) . ' ) OR ( parentid = ' . implode(' OR parentid = ', $arrayAllCatid) . ' ) )'; } if ($this->param['search']) { $where[] = 'LOWER(c.name) LIKE ' . $this->_db->Quote('%' . clm_escape($this->param['search']) . '%', false); } if ($this->param['state']) { if ($this->param['state'] == 'P') { $where[] = 'c.published = 1'; } elseif ($this->param['state'] == 'U') { $where[] = 'c.published = 0'; } } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; return $where; }
function _getPlayerList() { if ($this->param['vid'] != '0') { $sqlZPS = " AND ds.ZPS = '" . $this->param['vid'] . "'"; } elseif ($this->param['verband'] != '000' and $this->param['verband'] != '0') { // alle Nuller hinten abschneiden... $verband = $this->param['verband']; while (substr($verband, -1) == '0') { $verband = substr_replace($verband, "", -1); } $sqlZPS = " AND ds.ZPS LIKE '" . $verband . "%'"; } else { $sqlZPS = ""; } if ($this->param['search'] != '') { $sqlName = ' AND LOWER(ds.Spielername) LIKE ' . $this->_db->Quote('%' . clm_escape($this->param['search']) . '%', false); } else { $sqlName = ''; } if ($this->param['dwz'] == 28) { // > 2600 $sqlDWZ = ' AND ds.DWZ >= 2600'; } elseif ($this->param['dwz'] != 0) { //$sqlDWZ = ' AND ds.DWZ < '.($this->param['dwz']*100); //klkl $sqlDWZ = ' AND ( ds.DWZ < ' . $this->param['dwz'] * 100 . ' OR ds.DWZ IS NULL )'; } else { $sqlDWZ = ''; } // SELECT $query = 'SELECT ds.*, dv.Vereinname, tt.snr ' . ' FROM #__clm_dwz_spieler AS ds' . ' LEFT JOIN #__clm_dwz_vereine AS dv ON dv.ZPS = ds.ZPS AND dv.sid = ds.sid' . ' LEFT JOIN #__clm_turniere_tlnr AS tt ON tt.zps = ds.ZPS AND tt.sid = ds.sid AND tt.mgl_nr = ds.Mgl_Nr AND tt.turnier =' . $this->param['id'] . ' WHERE ds.sid = ' . $this->turnier->sid . $sqlZPS . $sqlName . $sqlDWZ . " AND ds.sid = " . clm_core::$access->getSeason() . $this->_sqlOrder(); $this->_db->setQuery($query); $this->PlayersCount = $this->_getListCount($query); $this->PlayersList = $this->_getList($query, $this->limitstart, $this->limit); }
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'); $row = JTable::getInstance('vereine', 'TableCLM'); $msg = JRequest::getVar('id'); if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); } // pre-save checks if (!$row->check()) { JError::raiseError(500, $row->getError()); } // if new item, order last in appropriate group $aktion = "Verein editiert"; if (!$row->id) { $aktion = "Verein angelegt"; $where = "sid = " . (int) $row->sid; $row->ordering = $row->getNextOrder($where); } // Kontrolle ob ZPS bereits existiert $query = " SELECT COUNT(zps) as count FROM #__clm_vereine " . " WHERE ZPS = '" . clm_escape($row->zps) . "'" . " AND sid = {$row->sid} "; $db->setQuery($query); $zps_exist = $db->loadObjectList(); if ($zps_exist[0]->count > 0 and !$row->id) { JError::raiseWarning(500, JText::_('VEREINE_IST')); $link = 'index.php?option=' . $option . '§ion=' . $section; $mainframe->redirect($link); } // save the changes if (!$row->store()) { JError::raiseError(500, $row->getError()); } switch ($task) { case 'apply': $msg = JText::_('VEREINE_AENDERN'); $link = 'index.php?option=' . $option . '§ion=' . $section . '&task=edit&cid[]=' . $row->id; break; case 'save': default: $msg = JText::_('VEREINE_SPEICHERN'); $link = 'index.php?option=' . $option . '§ion=' . $section; break; } // Log schreiben $clmLog = new CLMLog(); $clmLog->aktion = $aktion; $clmLog->params = array('sid' => $row->sid, 'lid' => $row->liga, 'zps' => $row->zps); $clmLog->write(); $mainframe->redirect($link, $msg, "message"); }
function store() { $db = JFactory::getDBO(); //Namen aller Formularfelder als Array $spalten = array("tid", "name", "sid", "dateStart", "dateEnd", "catidAlltime", "catidEdition", "typ", "tiebr1", "tiebr2", "tiebr3", "rnd", "teil", "runden", "dg", "tl", "bezirk", "bezirkTur", "vereinZPS", "published", "started", "finished", "invitationText", "bemerkungen", "bem_int", "ordering", "sieg", "siegs", "remis", "remiss", "nieder", "niederk"); //Strings f�r Felder und Werte erstellen $fields = ''; $values = ''; foreach ($spalten as $spalte) { $fields .= "`" . $spalte . "`,"; $values .= " '" . clm_escape(JRequest::getVar($spalte, '')) . "',"; } // Parameter $paramsStringArray = array(); foreach (JRequest::getVar('params', '') as $key => $value) { $paramsStringArray[] = $key . '=' . intval($value); } $fields .= " `params`"; $values .= " '" . implode("\n", $paramsStringArray) . " '"; $insert_query = "INSERT IGNORE INTO \r\n\t\t\t\t\t\t\t\t#__clm_swt_turniere" . " \r\n\t\t\t\t\t\t\t\t( " . $fields . " ) " . " \tVALUES \r\n\t\t\t\t\t\t\t\t( " . $values . " ); "; $db->setQuery($insert_query); if ($db->query()) { JRequest::setVar('swt_tid', $db->insertid()); return true; } else { print $db->getErrorMsg(); return false; } }
function _getCLMML(&$options) { $sid = JRequest::getInt('saison', '1'); $lid = JRequest::getInt('lid', '1'); $zps = clm_escape(JRequest::getVar('zps')); $man = JRequest::getInt('man', '1'); $db = JFactory::getDBO(); $query = "SELECT a.zps, a.sg_zps " . " FROM #__clm_mannschaften as a" . " WHERE a.sid = {$sid} AND a.zps = '{$zps}' " . " AND a.liga = {$lid} AND a.man_nr = {$man} AND a.published = 1 "; $db->setQuery($query); $team = $db->loadObjectList(); if (count($team) > 0) { $team_sg_zps = $team[0]->sg_zps; } else { $team_sg_zps = ''; } $query = "SELECT a.jid as mf, a.name as mfname " . " FROM #__clm_user as a" . " WHERE (zps = '" . $zps . "' OR FIND_IN_SET(zps,'" . $team_sg_zps . "' ) != 0 )" . " AND sid = " . $sid . " AND published = 1"; return $query; }
function _sqlWhere() { // init $where = array(); $where[] = 'a.turnier = ' . $this->param['id']; // Saison - nur Filter, wenn eingestellt if ($this->param['vid'] != '0') { $where[] = 'a.zps = ' . $this->_db->Quote($this->param['vid']); } if ($this->param['search'] != '') { $where[] = 'LOWER(a.name) LIKE ' . $this->_db->Quote('%' . clm_escape($this->param['search']) . '%', false); } $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : ''; return $where; }
function _getCLMName(&$options) { $sid = JRequest::getInt('saison', '1'); $zps = clm_escape(JRequest::getVar('zps')); $db = JFactory::getDBO(); $id = @$options['id']; $query = "SELECT Vereinname " . " FROM #__clm_dwz_vereine " . " WHERE zps = '{$zps}' " . " AND sid = " . $sid; return $query; }
function _getCLMSpielerliste(&$options) { $sid = JRequest::getInt('saison', '1'); $zps = clm_escape(JRequest::getVar('zps')); $db = JFactory::getDBO(); $id = @$options['id']; $query = " SELECT DISTINCT a.Spielername, a.ZPS, a.Mgl_Nr, a.sid FROM #__clm_dwz_spieler AS a" . " WHERE a.sid= '{$sid}'" . " AND ZPS= '{$zps}'" . " GROUP BY Spielername" . " ORDER BY a.Spielername ASC "; return $query; }
function store() { // DB-Zugriff $db = JFactory::getDBO(); //Liga-Parameter aufbereiten $default['params'] = JRequest::getVar('params'); $paramsStringArray = explode("\n", $default['params']); $default_params = array(); foreach ($paramsStringArray as $value) { $ipos = strpos($value, '='); if ($ipos !== false) { $key = substr($value, 0, $ipos); if (substr($key, 0, 2) == "\\'") { $key = substr($key, 2, strlen($key) - 4); } if (substr($key, 0, 1) == "'") { $key = substr($key, 1, strlen($key) - 2); } $default_params[$key] = substr($value, $ipos + 1); } } //Liga-Parameter aktualisieren $default_params['anz_sgp'] = JRequest::getVar('anz_sgp'); $default_params['color_order'] = JRequest::getVar('color_order'); //Liga-Parameter zusammenfassen $paramsStringArray = array(); foreach ($default_params as $key => $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; } $default['params'] = implode("\n", $paramsStringArray); JRequest::setVar('params', $default['params']); $mturnier = JRequest::getVar('mturnier', 0, 'default', 'int'); JRequest::setVar('liga_mt', $mturnier); $spalten = array('lid', 'name', 'sl', 'sid', 'rang', 'teil', 'stamm', 'ersatz', 'runden', 'durchgang', 'runden_modus', 'heim', 'sieg', 'remis', 'nieder', 'antritt', 'man_sieg', 'man_remis', 'man_nieder', 'man_antritt', 'sieg_bed', 'b_wertung', 'auf', 'auf_evtl', 'ab', 'ab_evtl', 'mail', 'sl_mail', 'order', 'published', 'ordering', 'bem_int', 'liga_mt', 'tiebr1', 'tiebr2', 'tiebr3', 'params'); $fields = ''; $values = ''; foreach ($spalten as $spalte) { $fields .= '`' . $spalte . '`,'; $values .= ' "' . clm_escape(JRequest::getVar($spalte)) . '",'; } $fields = substr($fields, 0, -1); $values = substr($values, 0, -1); $insert_query = ' INSERT IGNORE INTO #__clm_swt_liga' . ' ( ' . $fields . ' ) ' . ' VALUES ( ' . $values . ' ); '; $db->setQuery($insert_query); if ($db->query()) { JRequest::setVar('swt_id', $db->insertid()); return true; } else { print $db->getErrorMsg(); return false; } }