default ansi to off
[bdrem.git] / src / bdrem / UserInterface.php
1 <?php
2 namespace bdrem;
3
4 abstract class UserInterface
5 {
6     public function run()
7     {
8         $cfg = new Config();
9         $cfg->load();
10         setlocale(LC_TIME, $cfg->locale);
11         $source = $cfg->loadSource();
12
13         $this->loadParameters($cfg);
14         $arEvents = $source->getEvents(
15             date('Y-m-d'), $cfg->daysBefore, $cfg->daysAfter
16         );
17         usort($arEvents, '\\bdrem\\Event::compare');
18         $this->render($arEvents);
19     }
20
21     protected function loadParameters($cfg)
22     {
23     }
24
25     abstract protected function render($arEvents);
26 }
27 ?>