Ejemplo n.º 1
0
 function sortByTWZ()
 {
     // Check for request forgeries
     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));
     $lid = $cid[0];
     // keine Liga gewählt
     if ($lid < 1) {
         $msg = JText::_('MTURN_SORT_TWZ');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
     }
     if (CLM_usertype != 'admin' and CLM_usertype != 'tl') {
         JError::raiseWarning(500, JText::_('TOURNAMENT_NO_ACCESS'));
         return FALSE;
     }
     // tournament started, already some results?
     $query = "SELECT COUNT(id) FROM `#__clm_rnd_spl`" . " WHERE lid =" . $lid;
     $db->setQuery($query);
     $count = $db->loadResult();
     if ($count > 0) {
         JError::raiseWarning(500, JText::_('MTURN_SORTING_NOT_POSSIBLE_EG'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     // load liga parameter
     $db = JFactory::getDBO();
     $id = @$options['id'];
     $query = " SELECT stamm,ersatz,sid,teil FROM #__clm_liga " . " WHERE id = " . $lid;
     $db->setQuery($query);
     $anoboards = $db->loadObjectList();
     $noboards = $anoboards[0]->stamm + $anoboards[0]->ersatz;
     //$noboards	= $anoboards[0]->stamm;
     $sid = $anoboards[0]->sid;
     $teil = $anoboards[0]->teil;
     $query = " SELECT m.tln_nr, m.id, AVG(d.DWZ) as twz " . " FROM #__clm_mannschaften AS m " . " LEFT JOIN #__clm_meldeliste_spieler AS a ON a.sid = m.sid AND a.lid = m.liga AND (a.zps = m.zps OR a.zps = m.sg_zps) AND a.mnr = m.man_nr " . " LEFT JOIN #__clm_dwz_spieler AS d ON d.sid = a.sid AND d.DWZ !=0 AND d.Mgl_Nr = a.mgl_nr AND d.ZPS = a.zps " . " WHERE m.liga = " . $lid . " AND m.sid = " . $sid . " AND a.snr < " . ($noboards + 1) . " GROUP BY m.tln_nr" . " ORDER BY twz DESC, tln_nr ASC";
     $db->setQuery($query);
     $teams = $db->loadObjectList();
     if (!isset($teams)) {
         JError::raiseWarning(500, JText::_('MTURN_SORTING_NOT_POSSIBLE_NM'));
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section);
     }
     $table =& JTable::getInstance('mannschaften', 'TableCLM');
     // $tlnr umsortieren
     $tlnr = 0;
     // alle Spieler durchgehen
     foreach ($teams as $value) {
         $tlnr++;
         $table->load($value->id);
         $table->tln_nr = $tlnr;
         $table->store();
     }
     require_once JPATH_COMPONENT . DS . 'controllers' . DS . 'ergebnisse.php';
     CLMControllerErgebnisse::calculateRanking($sid, $lid);
     // Log schreiben
     $clmLog = new CLMLog();
     $clmLog->aktion = JText::_('MTURN_AKTION_SORT_BY_TWZ');
     $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::_('MTURN_AKTION_SORT_BY_TWZ');
     $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg);
 }
Ejemplo n.º 2
0
 function heim_kampflos()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or die('Invalid Token');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $link = 'index.php?option=' . $option . '&section=' . $section;
     $gast = JText::_('ERGEBNISSE_MSG_HOME');
     CLMControllerErgebnisse::kampflos($gast);
     $msg = JText::_('ERGEBNISSE_MSG_HOME_KL');
     $mainframe->redirect($link, $msg);
 }
Ejemplo n.º 3
0
     $query = "UPDATE #__clm_mannschaften" . " SET rankingpos = " . $ko_heim . " WHERE sid = " . $sid . " AND liga = " . $lid . " AND tln_nr = " . $tln_nr;
     $db->setQuery($query);
     $db->query();
     //echo "<br>ko_heim query: ".$ko_heim."  ".$query;
     //echo "<br>error: ".mysql_errno() . ": " . mysql_error(). "\n";
     // Für Gastmannschaft updaten
     $query = "UPDATE #__clm_mannschaften" . " SET rankingpos = " . $ko_gast . " WHERE sid = " . $sid . " AND liga = " . $lid . " AND tln_nr = " . $gegner;
     $db->setQuery($query);
     $db->query();
     //echo "<br>ko_gast query: ".$ko_gast."  ".$query;
     //echo "<br>error: ".mysql_errno() . ": " . mysql_error(). "\n";
     //die();
 }
 require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_clm' . DS . 'controllers' . DS . 'ergebnisse.php';
 //require_once(JPATH_COMPONENT.DS.'controllers'.DS.'ergebnisse.php');
 CLMControllerErgebnisse::calculateRanking($sid, $lid);
 //require_once(JPATH_COMPONENT.DS.'views'.DS.'runden.php');
 //CLMViewRunden::dwz( $option, 0, $sid, $lid );
 //mtmt ende
 // Mails verschicken ?
 $query = "SELECT mail, name, runden FROM #__clm_liga" . " WHERE sid =" . $sid . " AND id =" . $lid;
 $db->setQuery($query);
 $mail = $db->loadObjectList();
 if ($mail[0]->mail > 0) {
     // Konfigurationsparameter auslesen
     $config =& JComponentHelper::getParams('com_clm');
     // Zur Abwärtskompatibilität mit CLM <= 1.0.3 werden alte Daten aus Language-Datei als Default eingelesen
     $from = $config->get('email_from', JText::_('RESULT_DATA_MAIL'));
     $fromname = $config->get('email_fromname', JText::_('RESULT_DATA_FROM'));
     $bcc = $config->get('email_bcc', $config->get('bcc'));
     // nur wegen sehr leistungsschwachen Providern