Subversion Repositories SmartDukaan

Rev

Rev 16855 | Rev 16952 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
15077 anikendra 1
<h1>Admin Dashboard</h1>
15670 manas 2
<?php   $y=0;
3
for ($x = 0; $x < sizeof($userbase); $x++){
4
  if($userbase[$x][0]['date']==$dailyVerifications[$y][0]['date']){
5
      $userbase[$x][0]['verifyCount']=$dailyVerifications[$y][0]['count'];
6
      $y++;
7
  }else{
8
          $userbase[$x][0]['verifyCount']='0';
9
  }
10
}?>
15077 anikendra 11
<div id="registrations_chart_div" style="width:1200; height:300"></div>
15654 anikendra 12
<div id="activeusers_chart_div" style="width:1200; height:300"></div>
13
<div id="activebuyers_chart_div" style="width:1200; height:300"></div>
15077 anikendra 14
<div id="clicks_chart_div" style="width:1200px; height:300px"></div>
15
<div id="orders_chart_div" style="width:1200px; height:300px"></div>
15093 anikendra 16
<div id="brand_preferences_chart_div" style="width:1200px; height:300px"></div>
15128 anikendra 17
<div class="row">
18
  <div id="devices_chart_div" class="col-xs-6" style="width:400px; height:300px"></div>
19
  <div id="preferences_chart_div" class="col-xs-6" style="width:400px; height:300px"></div>
20
</div>
16855 manas 21
<div id="app_transactions_chart_div" style="width:1200px; height:300px"></div>
22
<div id="app_transactions_conversions_div" style="width:1200px; height:300px"></div>
16945 anikendra 23
<!-- <div id="top_five_apps" style="width:1200px; height:300px"></div> -->
16855 manas 24
 
15077 anikendra 25
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
26
<script type="text/javascript">
27
	var dailysignups = [];
16855 manas 28
  var apptransactions=[];
29
  var appconversions=[];
16945 anikendra 30
  var appinstalls=[];
31
 
32
  <?php foreach ($appinstalls as $key => $value):?>
33
    var temp = [];
34
    temp.push(new Date('<?php echo $key;?>'));
35
    <?php foreach ($apps as $appid => $app) :?>
36
      <?php if(array_key_exists($appid, $value)):?>
37
      temp.push(<?php echo $value[$appid];?>);
38
      <?php else:?>
39
      temp.push(0);
40
      <?php endif;?>
41
    <?php endforeach;?>    
42
    appinstalls.push(temp);
43
  <?php endforeach;?>
44
console.log(appinstalls);
15077 anikendra 45
	<?php foreach ($userbase as $key => $value):?>
15670 manas 46
		var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>,<?php echo $value[0]['verifyCount'];?>];
15077 anikendra 47
		dailysignups.push(temp);
48
	<?php endforeach;?>
16855 manas 49
 
50
  <?php foreach ($app_transactions_clicks_approved as $key => $value):?>
51
    var temp1 = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>,<?php echo $value[0]['approved'];?>];
52
    apptransactions.push(temp1);
53
  <?php endforeach;?>
54
 
55
  <?php foreach ($app_transactions_percentage as $key => $value):?>
56
    var temp = [new Date('<?php echo $value['x']['date'];?>'),<?php echo $value[0]['conversion'];?>];
57
    appconversions.push(temp);
58
  <?php endforeach;?>  
59
 
15654 anikendra 60
  var dailyactiveusers = [];
61
  <?php foreach ($activeUsers as $key => $value):?>
62
    var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
63
    dailyactiveusers.push(temp);
64
  <?php endforeach;?>
65
   var dailyactivebuyers = [];
66
  <?php foreach ($activeBuyers as $key => $value):?>
67
    var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
68
    dailyactivebuyers.push(temp);
69
  <?php endforeach;?>
15077 anikendra 70
	var dailyclicks = [];
71
	<?php foreach ($clicks as $key => $value):?>
72
		var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
73
		dailyclicks.push(temp);
74
	<?php endforeach;?>
75
	var dailyorders = [];
76
	<?php foreach ($orders as $key => $value):?>
77
		var temp = [new Date('<?php echo $value[0]['date'];?>') , <?php echo $value[0]['count'];?>];
78
		dailyorders.push(temp);
79
	<?php endforeach;?>
80
	var devices = [];
81
	devices.push(['Version Code','Number of Devices']);	
15607 anikendra 82
	<?php 
83
  foreach ($devices as $key => $value):?>
84
		var temp = ["<?php echo $value['a']['versioncode'];?>" , <?php echo $value[0]['count'];?>];
15077 anikendra 85
		devices.push(temp);
15128 anikendra 86
	<?php endforeach;?>  
15093 anikendra 87
  var brandpreferences = [];
88
  <?php foreach ($preferences_set as $key => $value):?>
15128 anikendra 89
    var temp = [new Date("<?php echo $value[0]['date'];?>") , <?php echo $value[0]['count'];?>];
15093 anikendra 90
    brandpreferences.push(temp);
91
  <?php endforeach;?>
15128 anikendra 92
  var preferences = [];
15193 anikendra 93
  preferences.push(['Preferences','Yes','No']); 
94
  preferences.push(['Brands',<?php echo $usersWithBrandPreferencesSet[0][0]['count'];?>,<?php echo ($totalUsers[0][0]['count'] - $usersWithBrandPreferencesSet[0][0]['count']);?>]);
15128 anikendra 95
 
96
  google.load('visualization', '1', {packages: ['corechart', 'line']});
15077 anikendra 97
	google.setOnLoadCallback(drawBasic);
98
 
99
	function drawBasic() {
100
      var data = new google.visualization.DataTable();
101
      data.addColumn('date', 'Date');
102
      data.addColumn('number', 'Signups');
15670 manas 103
      data.addColumn('number', 'Verifications');
15077 anikendra 104
      data.addRows(dailysignups);
105
      var options1 = {
106
        hAxis: {
107
          title: 'Date',
108
        },
109
        vAxis: {
15128 anikendra 110
          title: 'Daily User activations'
15077 anikendra 111
        }
112
      };
113
 
114
      var chart1 = new google.visualization.LineChart(document.getElementById('registrations_chart_div'));
115
      chart1.draw(data, options1);
116
 
117
      var clicksdata = new google.visualization.DataTable();      
118
      clicksdata.addColumn('date', 'Date');
119
      clicksdata.addColumn('number', 'Clicks');      
120
      clicksdata.addRows(dailyclicks);
121
      var options2 = {
122
        hAxis: {
123
          title: 'Date',
124
        },
125
        vAxis: {
15128 anikendra 126
          title: 'Daily clicks'
15077 anikendra 127
        }
128
      };
129
 
15654 anikendra 130
      var data = new google.visualization.DataTable();
131
      data.addColumn('date', 'Date');
132
      data.addColumn('number', 'Active Users');
133
      data.addRows(dailyactiveusers);
134
      var options_dau = {
135
        hAxis: {
136
          title: 'Date',
137
        },
138
        vAxis: {
139
          title: 'Daily Active Users'
140
        }
141
      };
142
      var chart_dau = new google.visualization.LineChart(document.getElementById('activeusers_chart_div'));
143
      chart_dau.draw(data, options_dau);
144
 
145
      var data = new google.visualization.DataTable();
146
      data.addColumn('date', 'Date');
147
      data.addColumn('number', 'Active Buyers');
148
      data.addRows(dailyactivebuyers);
149
      var options_dab = {
150
        hAxis: {
151
          title: 'Date',
152
        },
153
        vAxis: {
154
          title: 'Daily Active Buyers'
155
        }
156
      };
157
      var chart_dau = new google.visualization.LineChart(document.getElementById('activebuyers_chart_div'));
158
      chart_dau.draw(data, options_dab);
159
 
16855 manas 160
            var appData = new google.visualization.DataTable();
161
      appData.addColumn('date', 'Date');
162
      appData.addColumn('number', 'Clicks');
163
      appData.addColumn('number', 'Approved');
164
      appData.addRows(apptransactions);
165
      var options7 = {
166
        hAxis: {
167
          title: 'Date',
168
        },
169
        vAxis: {
170
          title: 'Daily User Clicks and Conversion'
171
        }
172
      };
173
 
174
    var chart7 = new google.visualization.LineChart(document.getElementById('app_transactions_chart_div'));
175
      chart7.draw(appData, options7);
176
 
177
    var appConversionData = new google.visualization.DataTable();
178
    appConversionData.addColumn('date', 'Date');
179
    appConversionData.addColumn('number', 'Conversion');
180
    appConversionData.addRows(appconversions);
181
    var options8 = {
182
      hAxis: {
183
        title: 'Date',
184
      },
185
      vAxis: {
186
        title: 'Daily Conversion (In %s)'
187
      }
188
    };
189
 
190
  var chart8 = new google.visualization.LineChart(document.getElementById('app_transactions_conversions_div'));
191
    chart8.draw(appConversionData, options8);
192
 
193
 
15654 anikendra 194
      var clicksdata = new google.visualization.DataTable();      
195
      clicksdata.addColumn('date', 'Date');
196
      clicksdata.addColumn('number', 'Clicks');      
197
      clicksdata.addRows(dailyclicks);
198
      var options2 = {
199
        hAxis: {
200
          title: 'Date',
201
        },
202
        vAxis: {
203
          title: 'Daily clicks'
204
        }
205
      };
206
 
15077 anikendra 207
      var chart2 = new google.visualization.LineChart(document.getElementById('clicks_chart_div'));
208
      chart2.draw(clicksdata, options2);
209
 
210
      var ordersdata = new google.visualization.DataTable();      
211
      ordersdata.addColumn('date', 'Date');
212
      ordersdata.addColumn('number', 'Orders');      
213
      ordersdata.addRows(dailyorders);
214
      var options3 = {
215
        hAxis: {
216
          title: 'Date',
217
        },
218
        vAxis: {
15128 anikendra 219
          title: 'Daily orders'
15077 anikendra 220
        }
221
      };
222
 
223
      var chart3 = new google.visualization.LineChart(document.getElementById('orders_chart_div'));
224
      chart3.draw(ordersdata, options3);
225
 
15093 anikendra 226
 
227
      var brandpreferencesdata = new google.visualization.DataTable();      
228
      brandpreferencesdata.addColumn('date', 'Date');
229
      brandpreferencesdata.addColumn('number', 'Brand Preferences Set');      
15128 anikendra 230
      brandpreferencesdata.addRows(brandpreferences);
15093 anikendra 231
      var options5 = {
232
        hAxis: {
233
          title: 'Date',
234
        },
235
        vAxis: {
15128 anikendra 236
          title: 'Daily brand preferences'
15093 anikendra 237
        }
238
      };
239
 
240
      var chart5 = new google.visualization.LineChart(document.getElementById('brand_preferences_chart_div'));
241
      chart5.draw(brandpreferencesdata, options5);
242
 
243
 
15128 anikendra 244
  		var devicesdata = google.visualization.arrayToDataTable(devices);
245
  		var options4 = {
246
  			title: 'Version Codes'
247
  		};
248
  		var chart4 = new google.visualization.PieChart(document.getElementById('devices_chart_div'));
249
  		chart4.draw(devicesdata, options4);
250
 
251
      var preferencesdata = google.visualization.arrayToDataTable(preferences);
15193 anikendra 252
      // var options6 = {
253
      //   title: 'Preferences Set'
254
      // };
15128 anikendra 255
      var options6 = {
15193 anikendra 256
        title: 'Preferences Set',
257
        chartArea: {width: '50%'},
258
        isStacked: true,
259
        hAxis: {
260
          title: 'Total Users',
261
          minValue: 0,
262
        },
263
        vAxis: {
264
          title: 'Type'
265
        }
15128 anikendra 266
      };
15193 anikendra 267
      var chart6 = new google.visualization.BarChart(document.getElementById('preferences_chart_div'));
15128 anikendra 268
      chart6.draw(preferencesdata, options6);
15077 anikendra 269
    }
16945 anikendra 270
    </script>