-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModuleAlertStatisticReader.php
55 lines (42 loc) · 1.63 KB
/
ModuleAlertStatisticReader.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
48
49
50
51
52
53
54
55
<?php
require_once('generateCharts.php');
class ModuleAlertStatisticReader extends Module
{
/**
* Template
* @var string
*/
protected $strTemplate = 'fwm_alertStatisticReader';
/**
* Compile the current element
*/
protected function compile()
{
if (($this->fwm_template != $this->strTemplate) && ($this->fwm_template != ''))
{
$this->strTemplate = $this->fwm_template;
$this->Template = new FrontendTemplate($this->strTemplate);
}
$alertYearURL = $GLOBALS['TL_LANG']['fwm']['misc']['alertYearURL'];
$alertYear = $this->Input->get($alertYearURL);
if($alertYear == ''){
$alertYear = date('Y');
}
$objAlertYear = $this->Database->prepare("SELECT id FROM tl_alert_archive WHERE year=?")
->limit(1)
->execute($alertYear);
$alertYearId = $objAlertYear->next();
$chartOptions = array('showTitle'=>$this->fwm_chartShowTitle,
'width'=>deserialize($this->fwm_chartWidth),
'bgColor'=>$this->fwm_chartBg,
'showLegend'=>$this->fwm_chartShowLegend,
'posLegend'=>$this->fwm_chartPositionLegend,
'colors'=>explode(',',$this->fwm_chartColors));
if($chartOptions['width']['unit'] === 'px') $chartOptions['width']['unit'] = '';
if($chartOptions['colors'][0] === '') $chartOptions['colors'] = '';
$charts = new generateCharts();
$this->Template->chartOptions = $chartOptions;
$this->Template->totalAlertsMonth = $charts->totalAlertsMonth($alertYearId->id);
$this->Template->totalAlertTypes = $charts->totalAlertTypes($alertYearId->id);
}
}