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