modules events actions components class php class eventsComponents ext

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// modules/events/actions/components.class.php
class eventsComponents extends sfComponents {
public function executeSidebar() {
$c = new Criteria();
$c->add(EventsPeer::DATE, 'NOW()', Criteria::GREATER_EQUAL);
$c->addAscendingOrderByColumn(EventsPeer::DATE);
$this->events = EventsPeer::doSelect($c);
}
}
// modules/events/templates/_sidebar.php
<div class="block vcalendar">
<?php foreach($events as $event): ?>
<div class="vevent">
<h4 class="summary"><?php echo $event->getTitle() ?></h4>
</div>
<?php endforeach ?>
</div>
// layout.php
<?php include_component('events', 'sidebar') ?>