function display($cachable = false, $urlparams = array())
 {
     $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');
     JArrayHelper::toInteger($cid, array(0));
     $row = JTable::getInstance('ligen', 'TableCLM');
     // load the row from the db table
     $row->load($cid[0]);
     // Prüfen ob User Berechtigung zum editieren hat
     if ($row->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 ($row->sl !== clm_core::$access->getJid() and $clmAccess->access('BE_' . $mppoint . '_edit_fixture') !== true or $clmAccess->access('BE_' . $mppoint . '_edit_fixture') === false) {
         //if ( $row->sl !== clm_core::$access->getJid() AND clm_core::$access->getType() !== 'admin') {
         JError::raiseWarning(500, JText::_('PAARUNG_LIGEN'));
         $link = 'index.php?option=' . $option . '&section=' . $csection;
         $mainframe->redirect($link);
     }
     // Prüfen ob Runden erstellt sind
     if ($row->rnd < 1) {
         JError::raiseWarning(500, JText::_('PAARUNG_RUND'));
         $link = 'index.php?option=' . $option . '&section=' . $csection;
         $mainframe->redirect($link);
     }
     $row->checkout($user->get('id'));
     // Teilnehmer zusammenstellen
     $sql = "SELECT a.*, m.name as hname, m.tln_nr as htln, n.name as gname, n.tln_nr as gtln, rt.name as rname, rt.datum, rt.startzeit, rt.enddatum " . " FROM #__clm_rnd_man as a" . " LEFT JOIN #__clm_mannschaften as m ON m.tln_nr = a.tln_nr AND m.liga = a.lid AND m.sid = a.sid" . " LEFT JOIN #__clm_mannschaften as n ON n.tln_nr = a.gegner AND n.liga = a.lid AND n.sid = a.sid" . " LEFT JOIN #__clm_liga as l ON a.lid = l.id " . " LEFT JOIN #__clm_runden_termine as rt ON rt.liga = a.lid AND rt.nr = (a.runde + (a.dg-1) * l.runden) " . " WHERE a.sid = " . $row->sid . " AND a.lid = " . $row->id . " AND a.heim = 1" . " ORDER BY a.dg ASC, a.runde ASC, a.paar ASC";
     $db->setQuery($sql);
     $paarung = $db->loadObjectList();
     // Mannschaftsliste
     $sql = "SELECT tln_nr, name, rankingpos FROM #__clm_mannschaften " . " WHERE sid = " . $row->sid . " AND liga = " . $row->id . " ORDER BY tln_nr ASC ";
     $db->setQuery($sql);
     $man = $db->loadObjectList();
     // Mannschaftsliste
     $sql = "SELECT COUNT(tln_nr) as tln_nr FROM #__clm_mannschaften " . " WHERE sid = " . $row->sid . " AND liga = " . $row->id . " ";
     $db->setQuery($sql);
     $count_man = $db->loadObjectList();
     // "spielfrei(e)" Mannschaft suchen				//mtmt
     $query = " SELECT COUNT(id) as anzahl FROM #__clm_mannschaften as a " . " WHERE sid = " . $row->sid . " AND liga = " . $row->id . " " . " AND a.name = 'spielfrei'" . " ORDER BY a.tln_nr ";
     $db->setQuery($query);
     $spielfreiNumber = $db->loadObjectList();
     if ($spielfreiNumber[0]->anzahl > 1) {
         foreach ($man as $key => $value) {
             if ($value->name == 'spielfrei') {
                 $value->name .= " " . $value->tln_nr;
             }
         }
     }
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'pairingdates.php';
     CLMViewPairingDates::pairingdates($row, $paarung, $man, $count_man, $option, $cid, $lists);
 }
    public static function pairingdates(&$row, $paarung, $man, $count_man, $option, $cid, &$lists)
    {
        CLMViewPairingDates::setPairingDatesToolbar($row);
        JRequest::setVar('hidemainmenu', 1);
        JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'extrainfo');
        ?>
<!--- <br> --->

	<form action="index.php" method="post" name="adminForm" id="adminForm">
	<div class="width-50 fltlft">

	<fieldset class="adminform">
<!---	<legend><?php 
        echo JText::_('PAARUNG_AKTUELL');
        ?>
</legend> --->

	<table class="admintable">

<?php 
        $count = 0;
        if ($row->durchgang > 1) {
            $runden_counter = $row->durchgang * $row->runden;
        } else {
            $runden_counter = $row->runden;
        }
        for ($x = 0; $x < $runden_counter; $x++) {
            ?>
		<?php 
            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 < 1) {
                    $pairings = 1;
                }
            } else {
                $pairings = $row->teil / 2;
            }
            ?>
 
	<tr>
	<td class="key" nowrap="nowrap" colspan="7" height="24"><h3><?php 
            echo $paarung[$count]->rname;
            if (isset($paarung[$count]->datum) and $paarung[$count]->datum > '1900-01-01') {
                echo '  ' . JText::_('ON_DAY') . ' ' . JHTML::_('date', $paarung[$count]->datum, JText::_('DATE_FORMAT_CLM_F'));
                if (isset($paarung[$count]->enddatum) and $paarung[$count]->enddatum > '1970-01-01' and $paarung[$count]->enddatum != $paarung[$count]->datum) {
                    echo ' - ' . JHTML::_('date', $paarung[$count]->enddatum, JText::_('DATE_FORMAT_CLM_F'));
                }
            }
            ?>
	</h3></td>
	</tr>
	<tr>
		<td class="key" nowrap="nowrap" height="24"><?php 
            echo JText::_('PAARUNG_DG');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_RUNDE');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_PAAR');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_HEIM');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_GAST');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_HEIM');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_GAST');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_DATE');
            ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
            echo JText::_('PAARUNG_TIME');
            ?>
</td>
	</tr>

	<?php 
            for ($y = 0; $y < $pairings; $y++) {
                ?>
	<tr>
		<td class="key" nowrap="nowrap" height="24"><?php 
                echo $paarung[$count]->dg;
                ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
                echo $paarung[$count]->runde;
                ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
                echo $paarung[$count]->paar;
                ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
                echo $paarung[$count]->tln_nr;
                ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
                echo $paarung[$count]->gegner;
                ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
                echo $paarung[$count]->hname;
                ?>
</td>
		<td class="key" nowrap="nowrap"><?php 
                echo $paarung[$count]->gname;
                ?>
</td>
		
   		<?php 
                $ndate = 'D' . $paarung[$count]->dg . 'R' . $paarung[$count]->runde . 'P' . $paarung[$count]->paar . 'Date';
                $ntime = 'D' . $paarung[$count]->dg . 'R' . $paarung[$count]->runde . 'P' . $paarung[$count]->paar . 'Time';
                //echo "<br>ndate:".$ndate."  pdate:".$paarung[$count]->pdate."  datum:".$paarung[$count]->datum;
                if ($paarung[$count]->pdate < '1970-01-02' and $paarung[$count]->datum > '1970-01-01') {
                    $paarung[$count]->pdate = $paarung[$count]->datum;
                    $paarung[$count]->ptime = $paarung[$count]->startzeit;
                    //echo "<br>Jndate:".$ndate."  pdate:".$paarung[$count]->pdate."  datum:".$paarung[$count]->datum;
                }
                ?>
		<td>
            <?php 
                echo JHtml::_('calendar', $paarung[$count]->pdate, $ndate, $ndate, '%Y-%m-%d', array('class' => 'text_area', 'size' => '12', 'maxlength' => '12'));
                ?>
        </td>
		<td>
			<input class="inputbox" type="time" name="<?php 
                echo $ntime;
                ?>
" id="<?php 
                echo $ntime;
                ?>
" size="6" maxlength="6" value="<?php 
                echo substr($paarung[$count]->ptime, 0, 5);
                ?>
"  />
		</td>
	</tr>
<?php 
                $count++;
            }
        }
        ?>

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

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

	<input type="hidden" name="section" value="pairingdates" />
	<input type="hidden" name="option" value="com_clm" />
	<input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
	<input type="hidden" name="task" value="" />

	<?php 
        echo JHtml::_('form.token');
        ?>
	</form>
	<?php 
    }