aboutsummaryrefslogtreecommitdiff
path: root/src/bdrem/UserInterface.php
blob: ffaa27971a02156c5fef95c3235d35766bbd03ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace bdrem;

abstract class UserInterface
{
    public function run()
    {
        $cfg = new Config();
        $cfg->load();
        setlocale(LC_TIME, $cfg->locale);
        $source = $cfg->loadSource();

        $this->loadParameters($cfg);
        $arEvents = $source->getEvents(
            date('Y-m-d'), $cfg->daysBefore, $cfg->daysAfter
        );
        usort($arEvents, '\\bdrem\\Event::compare');
        $this->render($arEvents);
    }

    protected function loadParameters($cfg)
    {
    }

    abstract protected function render($arEvents);
}
?>