All pastes #926820 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-03-03 21:17 UTC
rendered paste body
public function dailyEventCount($month)
    {
        $db          =& $this->calendar->getDatabaseConnection();
        $days        = $month->fetchAll();
        $start_bound = date('Y-m-d', $days[1]->getTimestamp());
        $end_bound   = date('Y-m-d', $days[count($days)]->getTimestamp());
        $sql         = "SELECT DATE_FORMAT(eventdatetime.starttime,'%m-%d') AS day,
                               count(*) AS events
		                FROM calendar_has_event,eventdatetime 
		                WHERE calendar_has_event.calendar_id={$this->calendar->id}
		                AND (calendar_has_event.status ='posted'
                             OR calendar_has_event.status ='archived')
		                AND calendar_has_event.event_id = eventdatetime.event_id 
		                AND eventdatetime.starttime >= '$start_bound 00:00:00'
						AND eventdatetime.starttime <= '$end_bound 23:59:59'
		                GROUP BY day;";
        $res         =& $db->queryCol($sql);
        return $res;
    }