Add analytics
[bus.git] / busui / owa / modules / base / templates / report_dimensionDetailNoTabs.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
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
<?php if (isset($dimension_properties) && $dimension_properties): ?>
<div class="owa_reportSectionContent">
        <?php echo $this->renderDimension($dimension_template, $dimension_properties);?>
</div>
<?php endif;?>
 
<div class="owa_reportSectionContent">
        
        <div id="trend-chart"></div>
        <div id="trend-title" class="owa_reportHeadline"></div> 
        <div id="trend-metrics" style="height:auto;width:auto;<?php if($pie) {echo 'float:right';}?>"></div>
        
        <?php if(isset($pie) && $pie): ?>       
        <div id="pie" style="min-width:300px;"></div>
        <script>
        var hpurl = '<?php echo $this->makeApiLink(array(
                                                'do'                    => 'getResultSet', 
                                                'metrics'               => 'pageViews,visits,bounceRate', 
                                                'dimensions'    => 'hostName', 
                                                'sort'                  => 'visits-',
                                                'format'                => 'json',
                                                'constraints' => urlencode($this->substituteValue('siteId==%s,','siteId'))),true);?>';
                                                                                                                  
        hp = new OWA.resultSetExplorer('pie');
        hp.options.pieChart.dimension = '<?php echo $dimensions;?>';
        hp.options.pieChart.metric = 'visits';
        hp.setView('pie');
        hp.load(hpurl);
                                
        </script>
        <?php endif; ?> 
                
        <div style="clear:both;"></div>
        <script>
                
                var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
                                                                                                                                        'metrics' => $metrics, 
                                                                                                                                        'dimensions' => 'date', 
                                                                                                                                        'sort' => 'date',
                                                                                                                                        'format' => 'json',
                                                                                                                                        'constraints' => $constraints
                                                                                                                                        ),true);?>';
                                                                                                                                          
                var trend = new OWA.resultSetExplorer('trend-chart');
                trend.options.sparkline.metric = 'visits';
                
                
                <?php if ($trendTitle):?>
                trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);
                <?php endif;?>
                <?php if (isset($trendChartMetric)): ?>
                trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);
                <?php endif; ?>
                trend.options.metricBoxes.width = '150px';
                trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);
                
                trend.load(trendurl);
                
        </script>
 
</div>
 
<?php if ( $this->get( 'dimensions' ) ):?>
<div class="owa_reportSectionContent">
        
        <div id="dimension-grid"></div>
        
        <script>
                var dimurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
                                                                                                                                        'metrics' => $metrics, 
                                                                                                                                        'dimensions' => $dimensions, 
                                                                                                                                        'sort' => $sort,
                                                                                                                                        'resultsPerPage' => $resultsPerPage,
                                                                                                                                        'format' => 'json',
                                                                                                                                        'constraints' => $constraints
                                                                                                                                        ),true);?>';
                                                                                                                                          
                var dim = new OWA.resultSetExplorer('dimension-grid');
                
                <?php if (!empty($dimensionLink)):?>
                var link = '<?php echo $this->makeLink($dimensionLink['template'], true);?>';
                var values = <?php if (is_array($dimensionLink['valueColumns'])) { 
                                                $values = "[";
                                                $i = 0;
                                                $count = count($dimensionLink['valueColumns']);
                                                foreach ($dimensionLink['valueColumns'] as $v) {
                                                        $values .= "'$v'";
                                                        if ($i < $count) {
                                                                $values .= ', ';
                                                        }
                                                        $i++;
                                                }
                                                $values .= "]";
                                                echo $values; 
                                        } else {
                                                echo "['".$dimensionLink['valueColumns']."']";
                                        }
                                        ?>;
                dim.addLinkToColumn('<?php echo $dimensionLink['linkColumn'];?>', link, values);
                <?php endif; ?>
                <?php if (!empty($excludeColumns)):?>
                dim.options.grid.excludeColumns = [<?php echo $excludeColumns;?>];
                <?php endif; ?>
                dim.asyncQueue.push(['refreshGrid']);
                dim.load(dimurl);
        </script>
 
</div>
<?php endif;?>
 
<?php require_once('js_report_templates.php');?>