-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathabraflexi-weekdigest.php
47 lines (38 loc) · 1.54 KB
/
abraflexi-weekdigest.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
/**
* This file is part of the AbraFlexi-Digest package
*
* https://github.com/VitexSoftware/AbraFlexi-Digest/
*
* (c) Vítězslav Dvořák <http://vitexsoftware.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AbraFlexi\Digest;
\define('EASE_APPNAME', 'AbraFlexi 📆 WeekDigest');
require_once __DIR__.'/init.php';
$start = new \DateTime();
$start->modify('-1 week');
$end = new \DateTime();
$period = new \DatePeriod($start, new \DateInterval('P1D'), $end);
$fmt = datefmt_create(
'cs_CZ',
\IntlDateFormatter::SHORT,
\IntlDateFormatter::NONE,
'Europe/Prague',
\IntlDateFormatter::GREGORIAN,
);
$formatter = new \IntlDateFormatter(\Ease\Locale::$localeUsed, \IntlDateFormatter::LONG, \IntlDateFormatter::NONE);
$period = new \DatePeriod($start, new \DateInterval('P1D'), $end);
$myCompany = new \AbraFlexi\Company(\Ease\Shared::cfg('ABRAFLEXI_COMPANY'));
$myCompanyName = $myCompany->getDataValue('nazev');
$subject = sprintf(_('AbraFlexi %s 📆 Weekly digest'), $myCompanyName);
$digestor = new Digestor($subject);
$digestor->addItem(new \Ease\Html\DivTag(sprintf(
_('from %s to %s'),
$formatter->format($period->getStartDate()->getTimestamp()),
$formatter->format($period->getEndDate()->getTimestamp()),
)));
$digestor->dig($period, array_merge(\Ease\Functions::loadClassesInNamespace('AbraFlexi\Digest\Modules'), \Ease\Functions::loadClassesInNamespace('AbraFlexi\Digest\Modules\Weekly')));