I was looking at the calendar code of the events and noticed the following awfull function
function getEntriesByMonth ($iYear, $iMonth, $iNextYear, $iNextMonth)
{
$aEvents = array ();
$iDays = cal_days_in_month(CAL_GREGORIAN, $iMonth, $iYear);
for ($iDay=1 ; $iDay <= $iDays ; ++$iDay) {
$a = $this->getAll ("SELECT *, $iDay AS `Day`
FROM `" . $this->_sPrefix . "main`
WHERE ((`EventEnd` >= UNIX_TIMESTAMP('$iYear-$iMonth-$iDay 00:00:00')) AND (`EventStart` <= UNIX_TIMESTAMP('$iYear-$iMonth-$iDay 23:59:59')))
AND `Status` = 'approved'");
if ($a)
$aEvents = array_merge($aEvents, $a);
}
return $aEvents;
}
Is there any reason why the DB has to be queried more or less 30 times to display a calendar? For what I've seen this is only used in the Events module and nowhere else.