public static function runde(&$row, $lists, $option)
    {
        CLMViewRunden::setRundeToolbar($row->sid);
        JRequest::setVar('hidemainmenu', 1);
        JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'extrainfo');
        $cliga = intval(JRequest::getVar('liga'));
        // Liga-Parameter holen
        $db = JFactory::getDBO();
        $sql = "SELECT params FROM #__clm_liga as l" . " WHERE l.id = " . $row->liga;
        $db->setQuery($sql);
        $tparams = $db->loadObjectList();
        //Liga-Parameter aufbereiten
        $paramsStringArray = explode("\n", $tparams[0]->params);
        $lparams = 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);
                }
                $lparams[$key] = substr($value, $ipos + 1);
            }
        }
        if (!isset($lparams['round_date'])) {
            //Standardbelegung
            $lparams['round_date'] = '0';
        }
        ?>
	<script language="javascript" type="text/javascript">

		 Joomla.submitbutton = function (pressbutton) { 		
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}
			// do field validation
			if (form.name.value == "") {
				alert( "<?php 
        echo JText::_('RUNDE_NAME_ANGEBEN', true);
        ?>
" );
			} else if (form.nr.value == "") {
				alert( "<?php 
        echo JText::_('RUNDE_NUMMER_ANGEBEN', true);
        ?>
" );
			} else if (form.datum.value == "") {
				alert( "<?php 
        echo JText::_('RUNDE_DATE_ANGEBEN', true);
        ?>
" );
			} else if ( getSelectedValue('adminForm','sid') == 0 ) {
				alert( "<?php 
        echo JText::_('RUNDE_SAISON_AUSWAEHLEN', true);
        ?>
" );
			} else if ( getSelectedValue('adminForm','liga') == 0 ) {
				alert( "<?php 
        echo JText::_('RUNDE_LIGA_AUSWAEHLEN', true);
        ?>
" );
			} else {
				submitform( pressbutton );
			}
		}
		</script>

		<form action="index.php" method="post" name="adminForm" id="adminForm">

		<div class="width-50 fltlft">
		<fieldset class="adminform">
		<legend><?php 
        echo JText::_('RUNDE_DETAILS');
        ?>
</legend>

		<table class="admintable">
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
        echo JText::_('RUNDE') . ' : ';
        ?>
</label>
			</td>
			<td>
			<input class="inputbox" type="text" name="name" id="name" size="30" maxlength="60" value="<?php 
        echo $row->name;
        ?>
" />
			</td>
		</tr>

		<tr>
			<td class="key" nowrap="nowrap">
			<label for="nr"><?php 
        echo JText::_('RUNDE_NR') . ' : ';
        ?>
</label>
			</td>
			<td>
			<input class="inputbox" type="text" name="nr" id="nr" size="5" maxlength="5" value="<?php 
        echo $row->nr;
        ?>
" />
			</td>
		</tr>

		   <tr>
            		<td width="100" class="key">
                	<label for="datum">
                    	<?php 
        echo JText::_('RUNDE_SPIELTAG') . ' : ';
        ?>
                	</label>
            		</td>
            		<td>
                	<?php 
        echo JHtml::_('calendar', $row->datum, 'datum', 'datum', '%Y-%m-%d', array('class' => 'text_area', 'size' => '12', 'maxlength' => '19'));
        ?>
            		</td>
        	</tr>
	<?php 
        if ($lparams['round_date'] == '0') {
            ?>
		<tr>
			<td class="key" nowrap="nowrap">
				<label for="startzeit" >
					<span class="editlinktip hasTip" title="<?php 
            echo JText::_('RUNDE_STARTTIME_HINT');
            ?>
">
					<?php 
            echo JText::_('RUNDE_STARTTIME') . ' : ';
            ?>
</span>
				</label>
			</td>
			<td>
			<input class="inputbox" type="time" name="startzeit" id="startzeit" size="8" maxlength="10" value="<?php 
            echo substr($row->startzeit, 0, 5);
            ?>
"  />
			</td>
        </tr>
	<?php 
        }
        if ($lparams['round_date'] == '1') {
            ?>
	   <tr>
           	<td width="100" class="key">
               	<label for="enddatum">
                  	<?php 
            echo JText::_('RUNDE_ENDDATUM') . ' : ';
            ?>
               	</label>
           	</td>
           	<td>
				<?php 
            if ($row->enddatum < '1970-01-02' and $row->datum > '1970-01-01') {
                $row->enddatum = $row->datum;
            }
            ?>
               	<?php 
            echo JHtml::_('calendar', $row->enddatum, 'enddatum', 'enddatum', '%Y-%m-%d', array('class' => 'text_area', 'size' => '12', 'maxlength' => '19'));
            ?>
			</td>
   		</tr>
	<?php 
        }
        ?>
		<tr>
       		<td width="100" class="key">
               	<label for="deadlineday">
					<span class="editlinktip hasTip" title="<?php 
        echo JText::_('RUNDE_DEADLINEDAY_HINT');
        ?>
">
                   	<?php 
        echo JText::_('RUNDE_DEADLINEDAY') . ' : ';
        ?>
               	</label>
       		</td>
       		<td>
               	<?php 
        echo JHtml::_('calendar', $row->deadlineday, 'deadlineday', 'deadlineday', '%Y-%m-%d', array('class' => 'text_area', 'size' => '12', 'maxlength' => '19'));
        ?>
				<input class="inputbox" type="time" name="deadlinetime" id="deadlinetime" size="8" maxlength="10" value="<?php 
        echo substr($row->deadlinetime, 0, 5);
        ?>
"  />
       		</td>
       	</tr>
		<tr>
			<td class="key" nowrap="nowrap"><label for="sid"><?php 
        echo JText::_('RUNDE_SAISON') . ' : ';
        ?>
</label>
			</td>
			<td>
			<?php 
        echo $lists['saison'];
        ?>
			</td>
		</tr>

		<tr>
			<td class="key" ><label for="liga"><?php 
        echo JText::_('RUNDE_LIGA') . ' : ';
        ?>
</label>
			</td>
			<td>
			<?php 
        echo $lists['liga'];
        ?>
			</td>
		</tr>

		<tr>
			<td class="key" nowrap="nowrap"><label for="verein"><?php 
        echo JText::_('RUNDE_MELDUNG_MOEGLICH') . ' : ';
        ?>
</label>
			</td>
			<td><fieldset class="radio">
			<?php 
        echo $lists['complete'];
        ?>
			</fieldset></td>
		</tr>

		<tr>
			<td class="key" nowrap="nowrap"><label for="mf"><?php 
        echo JText::_('RUNDE_SL_FREIGABE') . ' : ';
        ?>
</label>
			</td>
			<td><fieldset class="radio">
			<?php 
        echo $lists['slok'];
        ?>
			</fieldset></td>
		</tr>
		
		<tr>
			<td class="key" nowrap="nowrap"><label for="published"><?php 
        echo JText::_('JPUBLISHED') . ' : ';
        ?>
</label>
			</td>
			<td><fieldset class="radio">
			<?php 
        echo $lists['published'];
        ?>
			</fieldset></td>
		</tr>


		</table>
		</fieldset>
		</div>

 <div class="width-50 fltrt">
  <fieldset class="adminform">
   <legend><?php 
        echo JText::_('REMARKS');
        ?>
</legend>
	<table class="adminlist">
	<legend><?php 
        echo JText::_('REMARKS_PUBLIC');
        ?>
</legend>
	<br>
	<tr>
	<td width="100%" valign="top">
	<textarea class="inputbox" name="bemerkungen" id="bemerkungen" cols="40" rows="5" style="width:90%"><?php 
        echo str_replace('&', '&amp;', $row->bemerkungen);
        ?>
</textarea>
	</td>
	</tr>
	</table>

	<table class="adminlist">
	<tr><legend><?php 
        echo JText::_('REMARKS_INTERNAL');
        ?>
</legend>
	<br>
	<td width="100%" valign="top">
	<textarea class="inputbox" name="bem_int" id="bem_int" cols="40" rows="5" style="width:90%"><?php 
        echo str_replace('&', '&amp;', $row->bem_int);
        ?>
</textarea>
	</td>
	</tr>
	</table>
  </fieldset>
  </div>


		<div class="clr"></div>

		<input type="hidden" name="section" value="runden" />
		<input type="hidden" name="option" value="com_clm" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
<!---		<input type="hidden" name="cid" value="<?php 
        //echo $row->cid;
        ?>
" />
		<input type="hidden" name="client_id" value="<?php 
        //echo $row->cid;
        ?>
" />
--->		<input type="hidden" name="task" value="" />
		<input type="hidden" name="slok_old" value="<?php 
        echo $row->sl_ok;
        //klkl
        ?>
" /> 
		<?php 
        echo JHtml::_('form.token');
        ?>
		</form>
		<?php 
    }
Exemple #2
0
 function edit()
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $task = JRequest::getVar('task');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     $section = JRequest::getVar('section');
     $row = JTable::getInstance('runden', 'TableCLM');
     JArrayHelper::toInteger($cid, array(0));
     // load the row from the db table
     $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;
     if ($clmAccess->access('BE_' . $mppoint . '_edit_round') === false) {
         $section = $csection;
         $msg = JText::_('Kein Zugriff: ') . JText::_('RUNDE_STAFFEL_TOTAL1');
         $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
     }
     if ($task == 'edit') {
         // illegaler Einbruchversuch über URL !
         // evtl. mitschneiden !?!
         $saison = JTable::getInstance('saisons', 'TableCLM');
         $saison->load($row->sid);
         if ($saison->archiv == "1" and $clmAccess->access('BE_' . $mppoint . '_create') !== true) {
             JError::raiseWarning(100, JText::_('RUNDE_ARCHIV'));
             $mainframe->redirect('index.php?option=' . $option . '&section=' . $section, $msg, "message");
         }
         // Prüfen ob User Berechtigung zum editieren hat
         if ($liga->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_round') !== true) {
             JError::raiseWarning(500, JText::_('RUNDE_STAFFEL'));
             $link = 'index.php?option=' . $option . '&section=' . $section;
             $mainframe->redirect($link);
         }
         // do stuff for existing records
         $row->checkout($user->get('id'));
     } else {
         // do stuff for new records
         // Prüfen ob User Berechtigung zum Bearbeiten hat
         if ($liga->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_round') !== true) {
             JError::raiseWarning(500, JText::_('RUNDE_STAFFEL'));
             $section = $csection;
             $link = 'index.php?option=' . $option . '&section=' . $section;
             $mainframe->redirect($link);
         }
         $row->published = 0;
     }
     // Ligaliste
     $sql = " SELECT a.id as liga, a.name FROM #__clm_liga as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE  s.archiv = 0 AND a.sl = " . clm_core::$access->getJid();
     // wenn User Admin
     //if ( clm_core::$access->getType() === 'admin') {
     if ($clmAccess->access('BE_' . $mppoint . '_edit_result') === true) {
         $sql = "SELECT a.id as liga, a.name FROM #__clm_liga as a" . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE  s.archiv = 0 ";
     }
     $db->setQuery($sql);
     if (!$db->query()) {
         $this->setRedirect('index.php?option=' . $option . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $ligalist[] = JHtml::_('select.option', '0', JText::_('RUNDE_LIGA_WAE'), 'liga', 'name');
     $ligalist = array_merge($ligalist, $db->loadObjectList());
     $lists['liga'] = JHtml::_('select.genericlist', $ligalist, 'liga', 'class="inputbox" size="1"', 'liga', 'name', $row->liga);
     $lists['published'] = JHtml::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     // Saisonliste
     $sql = 'SELECT id as sid, name FROM #__clm_saison WHERE archiv = 0';
     $db->setQuery($sql);
     if (!$db->query()) {
         $this->setRedirect('index.php?option=' . $option . '&section=' . $section);
         return JError::raiseWarning(500, $db->getErrorMsg());
     }
     $saisonlist[] = JHtml::_('select.option', '0', JText::_('RUNDE_SAISON_WAE'), 'sid', 'name');
     $saisonlist = array_merge($saisonlist, $db->loadObjectList());
     $lists['saison'] = JHtml::_('select.genericlist', $saisonlist, 'sid', 'class="inputbox" size="1"', 'sid', 'name', $row->sid);
     // Liste Meldung
     $lists['complete'] = JHtml::_('select.booleanlist', 'meldung', 'class="inputbox"', $row->meldung);
     // Liste SL OK
     $lists['slok'] = JHtml::_('select.booleanlist', 'sl_ok', 'class="inputbox"', $row->sl_ok);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'runden.php';
     CLMViewRunden::runde($row, $lists, $option);
 }
 function dwz_start()
 {
     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);
     $row =& JTable::getInstance('runden', 'TableCLM');
     $row->load($cid[0]);
     $liga =& JTable::getInstance('ligen', 'TableCLM');
     $liga->load($row->liga);
     // keine Runde/Liga gewählt
     if ($cid[0] < 1) {
         JError::raiseWarning(500, JText::_('RUNDE_NO_AUSWERTEN'));
         $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]);
     $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);
     }
     // Anzeige in Runden ob DWZ ausgewertet wurde
     $query = "SELECT a.lid,a.runde, a.dg, COUNT(a.runde) as cnt_rnd " . " FROM #__clm_rnd_man as a " . " WHERE a.sid = " . $sid . " AND a.lid = " . $lid . " AND a.gemeldet > 1 " . " GROUP BY a.lid, a.dg, a.runde ";
     $db->setQuery($query);
     $cnt_liga = $db->loadObjectList();
     foreach ($cnt_liga as $liga_dwz) {
         $query = " UPDATE #__clm_runden_termine ";
         $liga->load($liga_dwz->lid);
         if ($liga->runden_modus == 4) {
             $pairings = pow(2, $liga->runden - 0 - $liga_dwz->runde);
         } elseif ($liga->runden_modus == 5) {
             $pairings = pow(2, $liga->runden - 1 - $liga_dwz->runde);
             if ($pairings < 1) {
                 $pairings = 1;
             }
         } else {
             $pairings = $liga->teil / 2;
         }
         if ($liga_dwz->cnt_rnd < $pairings * 2) {
             $query = $query . " SET dwz = 2 ";
         } else {
             $query = $query . " SET dwz = 1 ";
         }
         $query = $query . " WHERE  sid = " . $sid . " AND liga = " . $liga_dwz->lid . " AND nr = " . ($liga_dwz->runde + ($liga_dwz->dg - 1) * $liga->runden);
         $db->setQuery($query);
         $db->query();
     }
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'runden.php';
     CLMViewRunden::dwz($option, 0, $sid, $lid);
 }
 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();
     $id_id = JRequest::getVar('id');
     $date =& JFactory::getDate();
     $meldung = $user->get('id');
     $sid = JRequest::getVar('sid');
     $lid = JRequest::getVar('lid');
     $rnd = JRequest::getVar('rnd');
     $paarung = JRequest::getVar('paarung');
     $dg = JRequest::getVar('dg');
     $gemeldet = JRequest::getVar('gemeldet');
     $hzps = JRequest::getVar('hzps');
     $gzps = JRequest::getVar('gzps');
     $ko_decision = JRequest::getVar('ko_decision');
     $comment = JRequest::getVar('comment');
     // Überprüfen ob Runde schon gemeldet ist
     $query = "SELECT gemeldet, tln_nr, gegner " . " FROM #__clm_rnd_man " . " WHERE id = {$id_id} ";
     $db->setQuery($query);
     $id = $db->loadObjectList();
     $id_tln = $id[0]->tln_nr;
     $id_geg = $id[0]->gegner;
     // Punktemodus aus #__clm_liga holen
     $query = " SELECT a.stamm, a.sieg, a.remis, a.nieder, a.antritt, a.runden_modus, a.runden, " . " a.man_sieg, a.man_remis, a.man_nieder, a.man_antritt, a.sieg_bed " . " FROM #__clm_liga as a" . " WHERE a.id = " . $lid;
     $db->setQuery($query);
     $liga = $db->loadObjectList();
     $stamm = $liga[0]->stamm;
     $sieg_bed = $liga[0]->sieg_bed;
     $sieg = $liga[0]->sieg;
     $remis = $liga[0]->remis;
     $nieder = $liga[0]->nieder;
     $antritt = $liga[0]->antritt;
     $man_sieg = $liga[0]->man_sieg;
     $man_remis = $liga[0]->man_remis;
     $man_nieder = $liga[0]->man_nieder;
     $man_antritt = $liga[0]->man_antritt;
     $runden_modus = $liga[0]->runden_modus;
     $runden = $liga[0]->runden;
     // Runde noch NICHT gemeldet
     if (!$id[0]->gemeldet) {
         // Datensätze in Spielertabelle schreiben
         for ($y = 1; $y < 1 + $stamm; $y++) {
             $heim = JRequest::getVar('heim' . $y);
             $gast = JRequest::getVar('gast' . $y);
             $ergebnis = JRequest::getVar('ergebnis' . $y);
             $theim = explode("-", $heim);
             $thmgl = $theim[0];
             $thzps = $theim[1];
             $tgast = explode("-", $gast);
             $tgmgl = $tgast[0];
             $tgzps = $tgast[1];
             if ($ergebnis > 3) {
                 $kampflos = 1;
             } else {
                 $kampflos = 0;
             }
             if ($ergebnis == 1) {
                 $erg_h = $nieder + $antritt;
                 $erg_g = $sieg + $antritt;
             }
             if ($ergebnis == 2) {
                 $erg_h = $sieg + $antritt;
                 $erg_g = $nieder + $antritt;
             }
             if ($ergebnis == 3) {
                 $erg_h = $remis + $antritt;
                 $erg_g = $remis + $antritt;
             }
             if ($ergebnis == 4) {
                 $erg_h = $antritt;
                 $erg_g = $antritt;
             }
             if ($ergebnis == 5) {
                 $erg_h = 0;
                 $erg_g = $sieg + $antritt;
             }
             if ($ergebnis == 6) {
                 $erg_h = $sieg + $antritt;
                 $erg_g = 0;
             }
             if ($ergebnis == 7) {
                 $erg_h = 0;
                 $erg_g = 0;
             }
             if ($ergebnis == 8) {
                 $erg_h = 0;
                 $erg_g = 0;
             }
             if ($ergebnis == 9) {
                 $erg_h = 0;
                 $erg_g = 0;
             }
             // WICHTIG wegen NULL / SELECTED Problem
             $ergebnis--;
             // ungerade Zahl für Weiss/Schwarz
             if ($y % 2 != 0) {
                 $weiss = 0;
                 $schwarz = 1;
             } else {
                 $weiss = 1;
                 $schwarz = 0;
             }
             $query = "INSERT INTO #__clm_rnd_spl " . " ( `sid`, `lid`, `runde`, `paar`, `dg`, `tln_nr`, `brett`, `heim`, `weiss`, `spieler` " . " , `zps`, `gegner`, `gzps`, `ergebnis` , `kampflos`, `punkte`, `gemeldet`) " . " VALUES ('{$sid}','{$lid}','{$rnd}','{$paarung}','{$dg}','{$id_tln}','{$y}',1,'{$weiss}','{$thmgl}','{$thzps}'," . " '{$tgmgl}','{$tgzps}','{$ergebnis}', '{$kampflos}','{$erg_h}','{$meldung}') " . " , ('{$sid}','{$lid}','{$rnd}','{$paarung}','{$dg}','{$id_geg}','{$y}','0','{$schwarz}','{$tgmgl}','{$tgzps}'," . " '{$thmgl}','{$thzps}','{$ergebnis}', '{$kampflos}','{$erg_g}','{$meldung}') ";
             $db->setQuery($query);
             $db->query();
         }
         // in Runden Mannschaftstabelle als gemeldet schreiben
         // Brettpunkte Heim summieren
         $query = "SELECT SUM(punkte) as punkte " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
         $db->setQuery($query);
         $man = $db->loadObjectList();
         $hmpunkte = $man[0]->punkte;
         // Wertpunkte Heim berechnen
         $query = "SELECT punkte, brett " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
         $db->setQuery($query);
         $man_wp = $db->loadObjectList();
         $hwpunkte = 0;
         foreach ($man_wp as $man_wp) {
             $hwpunkte = $hwpunkte + ($stamm + 1 - $man_wp->brett) * $man_wp->punkte;
         }
         $query = "SELECT COUNT(kampflos) as kl " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 " . " AND kampflos > 0 ";
         $db->setQuery($query);
         $man_kl = $db->loadObjectList();
         $man_kl_punkte = $man_kl[0]->kl;
         // Brettpunkte Gast summieren
         $query = "SELECT SUM(punkte) as punkte " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
         $db->setQuery($query);
         $gman = $db->loadObjectList();
         $gmpunkte = $gman[0]->punkte;
         // Wertpunkte Gast berechnen
         $query = "SELECT punkte, brett " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
         $db->setQuery($query);
         $man_wp = $db->loadObjectList();
         $gwpunkte = 0;
         foreach ($man_wp as $man_wp) {
             $gwpunkte = $gwpunkte + ($stamm + 1 - $man_wp->brett) * $man_wp->punkte;
         }
         $query = "SELECT COUNT(kampflos) as kl " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 " . " AND kampflos > 0 ";
         $db->setQuery($query);
         $gman_kl = $db->loadObjectList();
         $gman_kl_punkte = $gman_kl[0]->kl;
         // Teilnehmer ID bestimmen
         $query = " SELECT a.tln_nr,a.gegner " . " FROM #__clm_rnd_man as a" . " WHERE a.id = " . $id_id;
         $db->setQuery($query);
         $tlnr = $db->loadObjectList();
         $tln_nr = $tlnr[0]->tln_nr;
         $gegner = $tlnr[0]->gegner;
         // Mannschaftspunkte Heim / Gast verteilen
         // Standard : Mehrheit der BP gewinnt, BP gleich -> Punkteteilung
         if ($sieg_bed == 1) {
             if ($hmpunkte > $gmpunkte) {
                 $hman_punkte = $man_sieg;
                 $gman_punkte = $man_nieder;
             }
             if ($hmpunkte == $gmpunkte) {
                 $hman_punkte = $man_remis;
                 $gman_punkte = $man_remis;
             }
             if ($hmpunkte < $gmpunkte) {
                 $hman_punkte = $man_nieder;
                 $gman_punkte = $man_sieg;
             }
         }
         // erweiterter Standard : mehr als die H�lfte der BP -> Sieg, H�lfte der BP -> halbe MP Zahl
         if ($sieg_bed == 2) {
             if ($hmpunkte > $stamm * ($sieg + $antritt) / 2) {
                 $hman_punkte = $man_sieg;
             }
             if ($hmpunkte == $stamm * ($sieg + $antritt) / 2) {
                 $hman_punkte = $man_remis;
             }
             if ($hmpunkte < $stamm * ($sieg + $antritt) / 2) {
                 $hman_punkte = $man_nieder;
             }
             if ($gmpunkte > $stamm * ($sieg + $antritt) / 2) {
                 $gman_punkte = $man_sieg;
             }
             if ($gmpunkte == $stamm * ($sieg + $antritt) / 2) {
                 $gman_punkte = $man_remis;
             }
             if ($gmpunkte < $stamm * ($sieg + $antritt) / 2) {
                 $gman_punkte = $man_nieder;
             }
         }
         // Antrittspunkte addieren falls angetreten
         if ($stamm > $man_kl_punkte) {
             $hman_punkte = $hman_punkte + $man_antritt;
         }
         if ($stamm > $gman_kl_punkte) {
             $gman_punkte = $gman_punkte + $man_antritt;
         }
         // Datum und Uhrzeit für Meldung
         $now = $date->toMySQL();
         // Für Heimmannschaft updaten
         $query = "UPDATE #__clm_rnd_man" . " SET gemeldet = " . $meldung . " , zeit = '{$now}'" . " , brettpunkte = " . $hmpunkte . " , manpunkte = " . $hman_punkte . " , wertpunkte = " . $hwpunkte . " , comment = '" . $comment . "'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
         $db->setQuery($query);
         $db->query();
         // Für Gastmannschaft updaten
         $query = "UPDATE #__clm_rnd_man" . " SET gemeldet = " . $meldung . " , zeit = '{$now}'" . " , brettpunkte = " . $gmpunkte . " , manpunkte = " . $gman_punkte . " , wertpunkte = " . $gwpunkte . " , comment = '" . $comment . "'" . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
         $db->setQuery($query);
         $db->query();
     } else {
         // Datensätze in Spielertabelle schreiben
         for ($y = 1; $y < 1 + $stamm; $y++) {
             $heim = JRequest::getVar('heim' . $y);
             $gast = JRequest::getVar('gast' . $y);
             $ergebnis = JRequest::getVar('ergebnis' . $y);
             $kampflos = 0;
             if ($ergebnis > 3) {
                 $kampflos = 1;
             } else {
                 $kampflos = 0;
             }
             if ($ergebnis == 1) {
                 $erg_h = $nieder + $antritt;
                 $erg_g = $sieg + $antritt;
             }
             if ($ergebnis == 2) {
                 $erg_h = $sieg + $antritt;
                 $erg_g = $nieder + $antritt;
             }
             if ($ergebnis == 3) {
                 $erg_h = $remis + $antritt;
                 $erg_g = $remis + $antritt;
             }
             if ($ergebnis == 4) {
                 $erg_h = $antritt;
                 $erg_g = $antritt;
             }
             if ($ergebnis == 5) {
                 $erg_h = 0;
                 $erg_g = $sieg + $antritt;
             }
             if ($ergebnis == 6) {
                 $erg_h = $sieg + $antritt;
                 $erg_g = 0;
             }
             if ($ergebnis == 7) {
                 $erg_h = 0;
                 $erg_g = 0;
             }
             if ($ergebnis == 8) {
                 $erg_h = 0;
                 $erg_g = 0;
             }
             if ($ergebnis == 9) {
                 $erg_h = 0;
                 $erg_g = 0;
             }
             // WICHTIG wegen NULL / SELECTED Problem
             $ergebnis--;
             $theim = explode("-", $heim);
             $thmgl = $theim[0];
             $thzps = $theim[1];
             $tgast = explode("-", $gast);
             $tgmgl = $tgast[0];
             $tgzps = $tgast[1];
             // Heim updaten
             $query = "UPDATE #__clm_rnd_spl " . " SET spieler = " . $thmgl . " , zps = '{$thzps}'" . " , gegner = " . $tgmgl . " , gzps = '{$tgzps}'" . " , ergebnis = " . $ergebnis . " , kampflos = " . $kampflos . " , punkte = " . $erg_h . " , tln_nr = " . $id_tln . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND brett = " . $y . " AND heim = 1 ";
             $db->setQuery($query);
             $db->query();
             // Gast updaten
             $query = "UPDATE #__clm_rnd_spl " . " SET spieler = " . $tgmgl . " , zps = '{$tgzps}'" . " , gegner = " . $thmgl . " , gzps = '{$thzps}'" . " , ergebnis = " . $ergebnis . " , kampflos = " . $kampflos . " , punkte = " . $erg_g . " , tln_nr = " . $id_geg . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND brett = " . $y . " AND heim = 0 ";
             $db->setQuery($query);
             $db->query();
         }
         // Prüfen ob Turnierergebnis geändert wurde. Wenn ja dann keine MP oder BP updaten !
         $query = " SELECT COUNT(dwz_edit) as edit FROM #__clm_rnd_spl " . " WHERE dwz_edit IS NOT NULL " . " AND sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg;
         $db->setQuery($query);
         $counter = $db->loadResult();
         if ($counter == "0") {
             // Brettpunkte Heim summieren
             $query = "SELECT SUM(punkte) as punkte " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
             $db->setQuery($query);
             $man = $db->loadObjectList();
             $hmpunkte = $man[0]->punkte;
             // Wertpunkte Heim berechnen
             $query = "SELECT punkte, brett " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
             $db->setQuery($query);
             $man_wp = $db->loadObjectList();
             $hwpunkte = 0;
             foreach ($man_wp as $man_wp) {
                 $hwpunkte = $hwpunkte + ($stamm + 1 - $man_wp->brett) * $man_wp->punkte;
             }
             // Anzahl kampflose Partien (Heim) zählen
             $query = "SELECT COUNT(kampflos) as kl " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 " . " AND kampflos > 0 ";
             $db->setQuery($query);
             $man_kl = $db->loadObjectList();
             $man_kl_punkte = $man_kl[0]->kl;
             // Brettpunkte Gast summieren
             $query = "SELECT SUM(punkte) as punkte " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
             $db->setQuery($query);
             $gman = $db->loadObjectList();
             $gmpunkte = $gman[0]->punkte;
             // Wertpunkte Gast berechnen
             $query = "SELECT punkte, brett " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
             $db->setQuery($query);
             $man_wp = $db->loadObjectList();
             $gwpunkte = 0;
             foreach ($man_wp as $man_wp) {
                 $gwpunkte = $gwpunkte + ($stamm + 1 - $man_wp->brett) * $man_wp->punkte;
             }
             // Anzahl kampflose Partien (Gast) zählen
             $query = "SELECT COUNT(kampflos) as kl " . " FROM #__clm_rnd_spl " . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 " . " AND kampflos > 0 ";
             $db->setQuery($query);
             $gman_kl = $db->loadObjectList();
             $gman_kl_punkte = $gman_kl[0]->kl;
         } else {
             JError::raiseNotice(6000, JText::_('ERGEBNISSE_ME_WERTUNG'));
         }
         // Teilnehmer ID bestimmen
         $query = " SELECT a.tln_nr,a.gegner " . " FROM #__clm_rnd_man as a" . " WHERE a.id = " . $id_id;
         $db->setQuery($query);
         $tlnr = $db->loadObjectList();
         $tln_nr = $tlnr[0]->tln_nr;
         $gegner = $tlnr[0]->gegner;
         // Mannschaftspunkte Heim / Gast
         $hman_punkte = 0;
         $gman_punkte = 0;
         if ($hmpunkte > 0 or $gmpunkte > 0) {
             // Mannschaftspunkte Heim / Gast
             // Standard : Mehrheit der BP gewinnt, BP gleich -> Punkteteilung
             if ($sieg_bed == 1) {
                 if ($hmpunkte > $gmpunkte) {
                     $hman_punkte = $man_sieg;
                     $gman_punkte = $man_nieder;
                 }
                 if ($hmpunkte == $gmpunkte) {
                     $hman_punkte = $man_remis;
                     $gman_punkte = $man_remis;
                 }
                 if ($hmpunkte < $gmpunkte) {
                     $hman_punkte = $man_nieder;
                     $gman_punkte = $man_sieg;
                 }
             }
             // erweiterter Standard : mehr als die Hälfte der BP -> Sieg, Hälfte der BP -> halbe MP Zahl
             if ($sieg_bed == 2) {
                 if ($hmpunkte > $stamm * ($sieg + $antritt) / 2) {
                     $hman_punkte = $man_sieg;
                 }
                 if ($hmpunkte == $stamm * ($sieg + $antritt) / 2) {
                     $hman_punkte = $man_remis;
                 }
                 if ($hmpunkte < $stamm * ($sieg + $antritt) / 2) {
                     $hman_punkte = $man_nieder;
                 }
                 if ($gmpunkte > $stamm * ($sieg + $antritt) / 2) {
                     $gman_punkte = $man_sieg;
                 }
                 if ($gmpunkte == $stamm * ($sieg + $antritt) / 2) {
                     $gman_punkte = $man_remis;
                 }
                 if ($gmpunkte < $stamm * ($sieg + $antritt) / 2) {
                     $gman_punkte = $man_nieder;
                 }
             }
             // Antrittspunkte addieren falls angetreten
             if ($stamm > $man_kl_punkte) {
                 $hman_punkte = $hman_punkte + $man_antritt;
             }
             if ($stamm > $gman_kl_punkte) {
                 $gman_punkte = $gman_punkte + $man_antritt;
             }
         }
         // Datum und Uhrzeit für Editorzeit
         $now = $date->toMySQL();
         // Für Heimmannschaft updaten
         $query = "UPDATE #__clm_rnd_man" . " SET editor = " . $meldung . " , edit_zeit = '{$now}'";
         if ($counter == "0") {
             $query = $query . " , brettpunkte = " . $hmpunkte . " , manpunkte = " . $hman_punkte . " , wertpunkte = " . $hwpunkte;
         }
         $query = $query . " , comment = '" . $comment . "'" . " , tln_nr = " . $tln_nr . " , gegner = " . $gegner . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
         $db->setQuery($query);
         $db->query();
         // Für Gastmannschaft updaten
         $query = "UPDATE #__clm_rnd_man" . " SET editor = " . $meldung . " , edit_zeit = '{$now}'";
         if ($counter == "0") {
             $query = $query . " , brettpunkte = " . $gmpunkte . " , manpunkte = " . $gman_punkte . " , wertpunkte = " . $gwpunkte;
         }
         $query = $query . " , comment = '" . $comment . "'" . " , tln_nr = " . $gegner . " , gegner = " . $tln_nr . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
         $db->setQuery($query);
         $db->query();
     }
     if ($runden_modus == 4 or $runden_modus == 5) {
         // KO Turnier
         //echo "<br>99runden_modus: ".$runden_modus;
         // Für Heimmannschaft updaten
         $query = "UPDATE #__clm_rnd_man" . " SET ko_decision = " . $ko_decision . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 1 ";
         $db->setQuery($query);
         $db->query();
         // Für Gastmannschaft updaten
         $query = "UPDATE #__clm_rnd_man" . " SET ko_decision = " . $ko_decision . " WHERE sid = " . $sid . " AND lid = " . $lid . " AND runde = " . $rnd . " AND paar = " . $paarung . " AND dg = " . $dg . " AND heim = 0 ";
         $db->setQuery($query);
         $db->query();
         if ($runden_modus == 4 or $runden_modus == 5 and $rnd < $runden) {
             // KO Turnierif ($ko_decision == 1) {
             if ($hmpunkte > $gmpunkte) {
                 $ko_par = 2;
             } elseif ($hmpunkte < $gmpunkte) {
                 $ko_par = 3;
             } elseif ($hwpunkte > $gwpunkte) {
                 $ko_par = 2;
             } else {
                 $ko_par = 3;
             }
             // Sieger Gast nach Wertpunkte
         } elseif ($ko_decision == 2) {
             $ko_par = 2;
         } elseif ($ko_decision == 4) {
             $ko_par = 2;
         } else {
             $ko_par = 3;
         }
         // Sieger Gast nach Blitz-,Los-Entscheid
         if ($ko_par == 2) {
             $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 = " . $tln_nr;
         $db->setQuery($query);
         $db->query();
         $query = "UPDATE #__clm_mannschaften" . " SET rankingpos = " . $ko_gast . " WHERE sid = " . $sid . " AND liga = " . $lid . " AND tln_nr = " . $gegner;
         $db->setQuery($query);
         $db->query();
     }
     CLMControllerErgebnisse::calculateRanking($sid, $lid);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'runden.php';
     CLMViewRunden::dwz($option, 0, $sid, $lid);
     switch ($task) {
         case 'apply':
             $msg = JText::_('ERGEBNISSE_AENDERUNG');
             $link = 'index.php?option=' . $option . '&section=' . $section . '&task=edit&cid[]=' . $id_id;
             break;
         case 'save':
         default:
             $row =& JTable::getInstance('ergebnisse', 'TableCLM');
             $row->checkin($id_id);
             $msg = JText::_('ERGEBNISSE_GESPEICHERT');
             $link = 'index.php?option=' . $option . '&section=' . $section;
             break;
     }
     // Log schreiben
     $clmLog = new CLMLog();
     if (!$id[0]->gemeldet) {
         $clmLog->aktion = JText::_('ERGEBNISSE_AKTION_GEMELDET');
     } else {
         $clmLog->aktion = JText::_('ERGEBNISSE_AKTION_EDIT');
     }
     $clmLog->params = array('sid' => $sid, 'lid' => $lid, 'rnd' => $rnd, 'paar' => $paarung, 'dg' => $dg);
     $clmLog->write();
     $mainframe->redirect($link, $msg);
 }
    function dwz($option, $dwz, $sid, $lid)
    {
        if ($dwz == 0) {
            CLMViewRunden::setDWZToolbar();
        }
        if ($dwz == 1) {
            CLMViewRunden::setDWZSToolbar();
        }
        $db =& JFactory::getDBO();
        if ($dwz == 0) {
            // Angaben für Liga und Saison wenn Ligaauswertung
            $query = "SELECT a.sid, a.name as liga, s.name as saison " . " FROM #__clm_liga as a " . " LEFT JOIN #__clm_saison as s ON s.id = a.sid " . " WHERE a.id =" . $lid;
        }
        if ($dwz == 1) {
            // Angaben für Saison wenn Saisonauswertung
            $query = "SELECT id as sid, name as saison " . " FROM #__clm_saison " . " WHERE id =" . $sid;
        }
        $db->setQuery($query);
        $row = $db->loadObjectList();
        ?>
		<form action="index.php" method="post" name="adminForm">

		<div class="col width-65">
		<fieldset class="adminform">
		<legend><?php 
        echo JText::_('RUNDE_AUSWERTUNG');
        ?>
</legend>
		<br>
		<?php 
        require_once JPATH_COMPONENT . DS . 'controllers' . DS . 'runden.php';
        CLMControllerRunden::dwz($dwz, $sid, $lid);
        ?>
		</fieldset>
		</div>
		<?php 
        if ($dwz == "0") {
            ?>
		<div class="col width-35">
		<fieldset class="adminform">
		<legend><?php 
            echo JText::_('RUNDE_DETAILS');
            ?>
</legend>

		<table class="admintable">
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
            echo JText::_('RUNDE_LIGA') . ' : ';
            ?>
</label>
			</td>
			<td>
			<?php 
            echo $row[0]->liga;
            ?>
			</td>
		</tr>
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
            echo JText::_('RUNDE_SAISON') . ' : ';
            ?>
</label>
			</td>
			<td>
			<?php 
            echo $row[0]->saison;
            ?>
			</td>
		</tr>
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
            echo JText::_('RUNDE_TURNIER') . ' : ';
            ?>
</label>
			</td>
			<td>
			<?php 
            echo $row[0]->sid;
            ?>
			</td>
		</tr>
		</table>
		</fieldset>
		</div>
		<?php 
        }
        ?>
		<?php 
        if ($dwz == "1") {
            ?>
		<div class="col width-35">
		<fieldset class="adminform">
		<legend><?php 
            echo JText::_('RUNDE_DETAILS');
            ?>
</legend>

		<table class="admintable">
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
            echo JText::_('RUNDE_SAISON') . ' : ';
            ?>
</label>
			</td>
			<td>
			<?php 
            echo $row[0]->saison;
            ?>
			</td>
		</tr>
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
            echo JText::_('RUNDE_TURNIER') . ' : ';
            ?>
</label>
			</td>
			<td>
			<?php 
            echo $row[0]->sid;
            ?>
			</td>
		</tr>
		</table>
		</fieldset>
		</div>
		<?php 
        }
        ?>
	
		<input type="hidden" name="section" value="runden" />
		<input type="hidden" name="option" value="com_clm" />
		<input type="hidden" name="task" value="" />
		<?php 
        echo JHTML::_('form.token');
        ?>
		</form>
		<?php 
    }
 function dwz_start()
 {
     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 Saison gewählt
     if ($cid[0] < 1) {
         JError::raiseWarning(500, JText::_('SAISON_NO_AUSWERTEN'));
         $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;
     // Zeiger setzen auf saisonweite DWZ-Auswertung
     $dwz = 1;
     // Prüfen ob User Berechtigung zum auswerten hat
     if (CLM_usertype !== 'admin') {
         JError::raiseWarning(500, JText::_('SAISON_ST_AUSWER'));
         $link = 'index.php?option=' . $option . '&section=' . $section;
         $mainframe->redirect($link);
     }
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'runden.php';
     CLMViewRunden::dwz($option, 1, $sid, 0);
 }
Exemple #7
0
    public static function runde(&$row, $lists, $option)
    {
        CLMViewRunden::setRundeToolbar();
        JRequest::setVar('hidemainmenu', 1);
        JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'extrainfo');
        ?>
	<script language="javascript" type="text/javascript">

		 Joomla.submitbutton = function (pressbutton) { 		
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}
			// do field validation
			if (form.name.value == "") {
				alert( "<?php 
        echo JText::_('RUNDE_NAME_ANGEBEN', true);
        ?>
" );
			} else if (form.nr.value == "") {
				alert( "<?php 
        echo JText::_('RUNDE_NUMMER_ANGEBEN', true);
        ?>
" );
			} else if (form.datum.value == "") {
				alert( "<?php 
        echo JText::_('RUNDE_DATE_ANGEBEN', true);
        ?>
" );
			} else if ( getSelectedValue('adminForm','sid') == 0 ) {
				alert( "<?php 
        echo JText::_('RUNDE_SAISON_AUSWAEHLEN', true);
        ?>
" );
			} else if ( getSelectedValue('adminForm','liga') == 0 ) {
				alert( "<?php 
        echo JText::_('RUNDE_LIGA_AUSWAEHLEN', true);
        ?>
" );
			} else {
				submitform( pressbutton );
			}
		}
		</script>

		<form action="index.php" method="post" name="adminForm" id="adminForm">

		<div class="width-50 fltlft">
		<fieldset class="adminform">
		<legend><?php 
        echo JText::_('RUNDE_DETAILS');
        ?>
</legend>

		<table class="admintable">
		<tr>
			<td class="key" width="20%" nowrap="nowrap">
			<label for="name"><?php 
        echo JText::_('RUNDE') . ' : ';
        ?>
</label>
			</td>
			<td>
			<input class="inputbox" type="text" name="name" id="name" size="50" maxlength="60" value="<?php 
        echo $row->name;
        ?>
" />
			</td>
		</tr>

		<tr>
			<td class="key" nowrap="nowrap">
			<label for="nr"><?php 
        echo JText::_('RUNDE_NR') . ' : ';
        ?>
</label>
			</td>
			<td>
			<input class="inputbox" type="text" name="nr" id="nr" size="50" maxlength="60" value="<?php 
        echo $row->nr;
        ?>
" />
			</td>
		</tr>

		   <tr>
            		<td width="100" class="key">
                	<label for="datum">
                    	<?php 
        echo JText::_('RUNDE_SPIELTAG') . ' : ';
        ?>
                	</label>
            		</td>
            		<td>
                	<?php 
        echo JHtml::_('calendar', $row->datum, 'datum', 'datum', '%Y-%m-%d', array('class' => 'text_area', 'size' => '32', 'maxlength' => '19'));
        ?>
            		</td>
        	</tr>
		<tr>
			<td class="key" nowrap="nowrap">
				<label for="startzeit" >
					<span class="editlinktip hasTip" title="<?php 
        echo JText::_('RUNDE_STARTTIME_HINT');
        ?>
">
					<?php 
        echo JText::_('RUNDE_STARTTIME') . ' : ';
        ?>
</span>
				</label>
			</td>
			<td>
			<input class="inputbox" type="time" name="startzeit" id="startzeit" size="8" maxlength="10" value="<?php 
        echo substr($row->startzeit, 0, 5);
        ?>
"  />
			</td>
        </tr>
		   <tr>
            	<td width="100" class="key">
                	<label for="deadlineday">
						<span class="editlinktip hasTip" title="<?php 
        echo JText::_('RUNDE_DEADLINEDAY_HINT');
        ?>
">
                    	<?php 
        echo JText::_('RUNDE_DEADLINEDAY') . ' : ';
        ?>
                	</label>
            	</td>
            	<td>
                	<?php 
        echo JHtml::_('calendar', $row->deadlineday, 'deadlineday', 'deadlineday', '%Y-%m-%d', array('class' => 'text_area', 'size' => '32', 'maxlength' => '19'));
        ?>
					<input class="inputbox" type="time" name="deadlinetime" id="deadlinetime" size="8" maxlength="10" value="<?php 
        echo substr($row->deadlinetime, 0, 5);
        ?>
"  />
			</td>
        		</tr>
				
		<tr>
			<td class="key" nowrap="nowrap"><label for="sid"><?php 
        echo JText::_('RUNDE_SAISON') . ' : ';
        ?>
</label>
			</td>
			<td>
			<?php 
        echo $lists['saison'];
        ?>
			</td>
		</tr>

		<tr>
			<td class="key" ><label for="liga"><?php 
        echo JText::_('RUNDE_LIGA') . ' : ';
        ?>
</label>
			</td>
			<td>
			<?php 
        echo $lists['liga'];
        ?>
			</td>
		</tr>

		<tr>
			<td class="key" nowrap="nowrap"><label for="verein"><?php 
        echo JText::_('RUNDE_MELDUNG_MOEGLICH') . ' : ';
        ?>
</label>
			</td>
			<td><fieldset class="radio">
			<?php 
        echo $lists['complete'];
        ?>
			</fieldset></td>
		</tr>

		<tr>
			<td class="key" nowrap="nowrap"><label for="mf"><?php 
        echo JText::_('RUNDE_SL_FREIGABE') . ' : ';
        ?>
</label>
			</td>
			<td><fieldset class="radio">
			<?php 
        echo $lists['slok'];
        ?>
			</fieldset></td>
		</tr>
		
		<tr>
			<td class="key" nowrap="nowrap"><label for="published"><?php 
        echo JText::_('JPUBLISHED') . ' : ';
        ?>
</label>
			</td>
			<td><fieldset class="radio">
			<?php 
        echo $lists['published'];
        ?>
			</fieldset></td>
		</tr>


		</table>
		</fieldset>
		</div>

 <div class="width-50 fltrt">
  <fieldset class="adminform">
   <legend><?php 
        echo JText::_('REMARKS');
        ?>
</legend>
	<table class="adminlist">
	<legend><?php 
        echo JText::_('REMARKS_PUBLIC');
        ?>
</legend>
	<br>
	<tr>
	<td width="100%" valign="top">
	<textarea class="inputbox" name="bemerkungen" id="bemerkungen" cols="40" rows="5" style="width:90%"><?php 
        echo str_replace('&', '&amp;', $row->bemerkungen);
        ?>
</textarea>
	</td>
	</tr>
	</table>

	<table class="adminlist">
	<tr><legend><?php 
        echo JText::_('REMARKS_INTERNAL');
        ?>
</legend>
	<br>
	<td width="100%" valign="top">
	<textarea class="inputbox" name="bem_int" id="bem_int" cols="40" rows="5" style="width:90%"><?php 
        echo str_replace('&', '&amp;', $row->bem_int);
        ?>
</textarea>
	</td>
	</tr>
	</table>
  </fieldset>
  </div>


		<div class="clr"></div>

		<input type="hidden" name="section" value="runden" />
		<input type="hidden" name="option" value="com_clm" />
		<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
		<input type="hidden" name="cid" value="<?php 
        echo $row->cid;
        ?>
" />
		<input type="hidden" name="client_id" value="<?php 
        echo $row->cid;
        ?>
" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="slok_old" value="<?php 
        echo $row->sl_ok;
        //klkl
        ?>
" /> 
		<?php 
        echo JHtml::_('form.token');
        ?>
		</form>
		<?php 
    }