public static function getRunde(&$params)
    {
        global $mainframe;
        $db = JFactory::getDBO();
        $par_liste = $params->def('liste', 0);
        $param['categoryid'] = $params->def('categoryid', 0);
        JRequest::setVar('categoryid', $param['categoryid']);
        if ($par_liste == 0) {
            $now = date("Y-m-d");
        } else {
            $now = date("Y-01-01");
        }
        // CategoryID vorgegeben?
        $addWhere_t = '';
        $addWhere_e = '';
        $addWhere_b = '';
        if ($param['categoryid'] != '' and $param['categoryid'] > 0) {
            list($parentArray, $parentKeys, $parentChilds) = modCLMTermineHelper::getTree();
            // für jede Kategorie Unterkategorien ermitteln
            $arrayAllCatid = array();
            if (isset($parentChilds[$param['categoryid']])) {
                $arrayAllCatid = $parentChilds[$param['categoryid']];
                $arrayAllCatid[] = $param['categoryid'];
            } else {
                $arrayAllCatid[] = $param['categoryid'];
            }
            $addWhere_t = ' AND ( ( t.catidAlltime = ' . implode(' OR t.catidAlltime = ', $arrayAllCatid) . ' )
					OR 
					( t.catidEdition = ' . implode(' OR t.catidEdition = ', $arrayAllCatid) . ' ) )';
            $addWhere_e = ' AND ( ( e.catidAlltime = ' . implode(' OR e.catidAlltime = ', $arrayAllCatid) . ' )
					OR 
					( e.catidEdition = ' . implode(' OR e.catidEdition = ', $arrayAllCatid) . ' ) )';
            $addWhere_b = ' AND ( ( b.catidAlltime = ' . implode(' OR b.catidAlltime = ', $arrayAllCatid) . ' )
					OR 
					( b.catidEdition = ' . implode(' OR b.catidEdition = ', $arrayAllCatid) . ' ) )';
        }
        $query = " (SELECT 'liga' AS source, li.datum AS datum, li.datum AS enddatum, li.sid, li.name, li.nr, li.liga AS typ_id, t.id, t.name AS typ, t.durchgang AS durchgang, t.published, t.runden AS ligarunde" . " , t.ordering, li.startzeit AS starttime " . " FROM #__clm_runden_termine AS li " . " LEFT JOIN #__clm_liga AS t ON t.id = li.liga " . " WHERE t.published != '0' AND  datum >= '" . $now . "' " . $addWhere_t . " )" . " UNION ALL" . " (SELECT 'termin', e.startdate AS datum,  e.enddate AS enddatum, '1', e.name, '1', '', e.id, e.address AS typ, '1', e.published, 'event' AS ligarunde " . " , e.ordering, starttime " . " FROM #__clm_termine AS e " . " WHERE e.published != '0' AND  e.startdate >= '" . $now . "' " . $addWhere_e . " )" . " UNION ALL" . " (SELECT 'turnier', tu.datum AS datum, tu.datum AS enddatum, tu.sid, tu.name, tu.nr, tu.turnier AS typ_id, b.id, b.name AS typ, tu.dg AS durchgang, b.published, '' " . " , b.ordering, tu.startzeit AS starttime " . " FROM #__clm_turniere_rnd_termine AS tu " . " LEFT JOIN #__clm_turniere AS b ON b.id = tu.turnier " . " WHERE b.published != '0' AND  datum >= '" . $now . "' " . $addWhere_b . " )" . " ORDER BY datum ASC, IF(starttime = '00:00:00','24:00:00',starttime) ASC, ABS(ordering) ASC, ABS(typ_id) ASC, ABS(nr) ASC ";
        $db->setQuery($query);
        $runden = $db->loadObjectList();
        return $runden;
    }
<?php

// no direct access
defined('_JEXEC') or die('Restricted access');
// angemeldet
require_once dirname(__FILE__) . DS . 'helper.php';
$par_liste = $params->def('liste', 0);
$par_anzahl = $params->def('anzahl', 5);
$par_datum = $params->def('datum', 1);
$par_datum_link = $params->def('datumlink', 1);
$par_name = $params->def('name', 1);
$par_typ = $params->def('typ', 1);
$par_termin_link = $params->def('terminlink', 1);
$runden = modCLMTermineHelper::getRunde($params);
require JModuleHelper::getLayoutPath('mod_clm_termine');
        <span><a title="<?php 
    echo 'Termine ' . $htext;
    ?>
" href="<?php 
    echo $linkname_tl . '&amp;start=' . date('Y-m', $date) . '-01';
    ?>
"><?php 
    echo $htext;
    ?>
</a></span>
        <a href="index.php?timestamp=<?php 
    echo modCLMTermineHelper::monthForward($date);
    ?>
" class="next">&rsaquo;</a>
        <a href="index.php?timestamp=<?php 
    echo modCLMTermineHelper::yearForward($date);
    ?>
" class="next">&raquo;</a>
        <div class="clear"></div>  
    </div>
    <?php 
    modCLMTermineHelper::getCalender($date, $headline, $event, $datum_stamp);
    ?>
    <div class="clear"></div>
</div>
</center>
<?php 
}
?>