summaryrefslogtreecommitdiff
path: root/views/mods/mod_statistics/chartturnover/day.phtml
blob: 2fdf53462226ea30778bca6f7a059b4f05ce7e5a (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
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php /** @version 4.6.1 */ ?>
<?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/simplefilter.phtml'); ?>

<?php 
	
	if (wpsg_isSizedArray($this->view['chart']['data'])) 
	{
		$cnt = count($this->view['chart']['data']);
		unset($this->view['chart']['data']['template']);
		$cnt = count($this->view['chart']['data']);
		
		for ($i = 0; $i < count($this->view['chart']['data']); $i++)
		{
			//if (!key_exists('label', $this->view['chart']['data'][$i])) continue;
			//$lbl = $this->view['chart']['data'][$i]['label'];
			//if ($lbl == null) continue;
			
			$chartJS['legend'][$i] = "{";
			
			if (isset($this->view['chart']['data'][$i]['label']))
			{
				$chartJS['legend'][$i] .= "label:'".$this->view['chart']['data'][$i]['label']."',";
			}
			
			$chartJS['legend'][$i] .= "	highlighter: {";
			
			$chartJS['legend'][$i] .= "		formatString: '<table><tr><td>%s Uhr, %s ".$this->get_option('wpsg_currency')."</td></tr></table>'";
			
			$chartJS['legend'][$i] .= "	}";
			
			$chartJS['legend'][$i] .= "}";
			
			$j = 0;

			if (wpsg_isSizedArray($this->view['chart']['data'][$i]))
			{
					
				foreach ((array)$this->view['chart']['data'][$i]['records'] as $index => $record)
				{
					
					//immer das Datum vom Rootelement nutzen
					$k = 0 ;
					
					foreach ($this->view['chart']['data'][0]['records'] as $rindex => $rrecord)
					{
						if ($j == $k)
						{							
							if (mktime($record['hour'], 0, 0, $record['month'], $record['day'], $record['year']) <= mktime(date_i18n('H'), 0, 0, date_i18n('m'), date_i18n('d'), date_i18n('Y')))
							{
								$chartJS['area']['area'.$i][] = "['".$rrecord['year'].'/'.$rrecord['month'].'/'.$rrecord['day']." ".$rrecord['hour'].":00:00', ".wpsg_hspc($record['total'])."]"; 
							} 
						}	
						$k++;
					}
				
					if ($j == count($this->view['chart']['data'][$i]['records']) - 1) { 
				  		$chartJS['area']['area'.$i] = '['.implode(',', (array)$chartJS['area']['area'.$i]).']'; 
				  	}
				  	
				  	$j++;
				}
			
			}
			
		}

	}
	$j++;
?>

<?php if ($chartJS['area'] != '') { ?>
<div id="chartannualturnover-line" style="height:<?php echo $this->get_option('wpsg_mod_statistics_line_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_line_chart_width'); ?>px;"></div>

<br />

<div id="table-data">
	<?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/chartturnover/data.phtml'); ?>	
</div>

<div class="wpsg_clearer"></div>

<script type="text/javascript">


jQuery(document).ready(function(){
	  <?php foreach ($chartJS['area'] as $index => $area) { ?>
		 var <?php echo $index; ?> = <?php echo $area; ?>;
	  <?php } ?>
		
	  var chartannualturnoverLine = jQuery.jqplot('chartannualturnover-line', [<?php echo implode(',', array_keys($chartJS['area'])); ?>], {
		  animate: true,
		  axesDefaults: {
	            labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer
		  },
		  series:[
          		<?php echo implode(', ', $chartJS['legend']); ?>
          ],
          legend: {
            show: true,
            placement: 'outside'
          },
	      axes:{
	        xaxis:{
	          	renderer:jQuery.jqplot.DateAxisRenderer,
	          	label:'<?php echo __('Uhrzeit', 'wpsg'); ?>',
	          	tickOptions:{formatString:"%#H:%M"},
	          	min:'<?php echo $this->view['chart']['data'][0]['year']; ?>/<?php echo $this->view['chart']['data'][0]['month']; ?>/<?php echo $this->view['chart']['data'][0]['day']; ?> 00:00',
	          	max:'<?php echo $this->view['chart']['data'][0]['year']; ?>/<?php echo $this->view['chart']['data'][0]['month']; ?>/<?php echo $this->view['chart']['data'][0]['day']; ?> 23:00',
	          	tickInterval: '1 hours'
	        },
	        yaxis:{
                label:'<?php echo wpsg_hspc(wpsg_getStr($this->view['chart']['info']['yaxis']['label'])); ?>',
                tickOptions: {
                	formatter: wpsg_statistics_number_format
            	},
        		min:0
            }
	      },
	      highlighter: {
	            show: true
	      }
	  });

	  wpsg_statistic_addExportButton();
	  
});
</script>
<?php } else { ?>
<?php echo __('Keine Daten zur Auswertung vorhanden.', 'wpsg'); ?>
<?php } ?>