14 $monLibrary = dirname(__FILE__) .
"/../library";
15 $datadir = dirname(__FILE__) .
"/appreportdata/";
16 require_once(
"$monLibrary/cu_top.i");
17 require_once(
"$monLibrary/ck_hticket.i");
18 require_once(
"$monLibrary/cu_pass.i");
19 require_once(
"$monLibrary/monitorView.i");
21 if (!CheckPerm($link, $Hu,
"appReport", $_SERVER[
'REMOTE_ADDR'])) {
22 header(
"Location: /hcuadm/hcu_noperm.prg");
26 printMonitorPageTop(
"App Report (Google Play)", $homecuKendoVersion, $cloudfrontDomainName, $bootstrapVersion, $fontawesomeVersion,
true);
27 printMonitorPageMiddle(
"App Report (Google Play)",
null);
30 $sql =
"SELECT user_name FROM cuproducts WHERE home_cu_code='MBLADA'";
32 $product_rs = db_query($sql, $link);
33 $productList = array();
35 while ($product_row = db_fetch_array($product_rs, $row_cnt++)) {
36 array_push($productList, trim($product_row[
"user_name"]));
41 <meta name=
"viewport" content=
"width=device-width, initial-scale=1">
42 <link rel=
"stylesheet" type=
"text/css" href=
"/monitor/css/gp_main.css">
43 <link rel=
"shortcut icon" href=
"">
46 <div
id=
"reportContainer">
47 <h2>Google Play Data</h2>
50 <li
class=
"k-state-active">
61 <input
id=
"cuInstallsDrop" class=
"cuDrop" style=
"width: 200px;" />
62 <input
id=
"installsDate" class=
"date" value=
"0" style=
"width: 200px;" />
63 <button
class=
"btn" id=
"downloadInstallsbtn" onclick=
"downloadInstallData('1')" style=
"width:150px;">Download</button>
64 <textarea rows=
"15" cols=
"65" id=
"installsView" readonly></textarea>
68 <input
id=
"cuCrashesDrop" class=
"cuDrop" style=
"width: 200px;" />
69 <input
id=
"crashesDate" class=
"date" value=
"0" style=
"width: 200px;" />
70 <button
class=
"btn" id=
"downloadCrashesbtn" onclick=
"downloadCrashesData('2')" style=
"width:150px;">Download</button>
71 <textarea rows=
"15" cols=
"65" id=
"crashesView" readonly></textarea>
72 <div
id=
"crashes_loader" class=
"loader"></div>
75 <input
id=
"cuReviewsDrop" class=
"cuDrop" style=
"width: 200px;" />
76 <input
id=
"reviewsDate" class=
"date" value=
"0" style=
"width: 200px;" />
77 <button
class=
"btn" id=
"downloadRatingsbtn" onclick=
"downloadRatingsData('3')" style=
"width:150px;">Download</button>
78 <textarea rows=
"15" cols=
"65" id=
"ratingsView" readonly></textarea>
79 <div
id=
"reviews_loader" class=
"loader"></div>
83 <div
id=
"snackbar"></div>
86 <!-- start of script
using kendo elementss-->
87 <script type=text/javascript>
88 var gpappreportserverurl=
"appreport_gp_server.prg" 89 var crashesGrid; var reviewsGrid;
91 $(document).ready(
function() {
93 $(
"#tabstrip").kendoTabStrip({ animation: { open: { effects:
"fadeIn" } } });
96 var date_data=getDateDDL();
98 var cu_kendo_datasource=getCUDDL();
100 $(
".cuDrop").kendoAutoComplete({
101 dataSource: cu_kendo_datasource,
102 filter:
"startswith",
103 placeholder:
"Select CU...",
106 $(
".date").kendoDropDownList({
107 dataTextField:
"text" ,
108 dataValueField:
"value" ,
109 dataSource: date_data,
114 $(
".btn").kendoButton();
118 var cu_data=<?php echo json_encode($productList); ?>;
119 var cu_kendo_datasource=[];
120 for(var i=0; i < cu_data.length; i++){
121 cu_kendo_datasource.push(cu_data[i]);
123 return cu_kendo_datasource;
126 function getDateDDL(){
127 return [{ text:
"Current Month" , value:
"0" },
128 { text:
"Previous Month" , value:
"-1" },
129 { text:
"2 Months ago" , value:
"-2" },
130 { text:
"3 Months ago" , value:
"-3" }];
135 function downloadInstallData(option){
136 disableDownloadButtons();
137 submonth=$(
"#installsDate").val();
138 cucode=$(
"#cuInstallsDrop").val();
139 cucode=cucode.toLowerCase();
140 install_data={
"functionname" :
"downloadInstalls" ,
"cucode" : cucode,
"submonth" : submonth,
"option" : option };
142 snackybar(
"Please select Cucode");
143 populateText(
"installsView",
"" );
145 enableDownloadButtons();
150 url: gpappreportserverurl,
154 }).done(
function (response) {
155 if(Object.keys(response[
"error_message"]).length> 0){
156 snackybar(response[
"error_message"]);
157 populateText(
"installsView",
"");
158 enableDownloadButtons();
161 populateText(
"installsView", response[
"content"]);
163 }).fail(
function (response) {
164 populateText(
"installsView",
"");
165 console.log(response);
166 }).always(
function (response) {
167 enableDownloadButtons();
174 function downloadCrashesData(option){
175 disableDownloadButtons();
176 submonth=$(
"#crashesDate").val();
177 cucode=$(
"#cuCrashesDrop").val();
178 crash_data={
"functionname" :
"downloadCrashes" ,
"cucode" : cucode,
"submonth" : submonth,
"option" : option };
180 snackybar(
"Please select Cucode");
181 populateText(
"crashesView",
"" );
183 enableDownloadButtons();
188 url: gpappreportserverurl,
192 }).done(
function (response) {
193 if(Object.keys(response[
"error_message"]).length> 0){
194 snackybar(response[
"error_message"]);
195 populateText(
"crashesView",
"");
196 enableDownloadButtons();
199 populateText(
"crashesView", response[
"content"]);
201 }).fail(
function (response) {
202 populateText(
"crashesView",
"");
203 console.log(response);
204 }).always(
function (response) {
205 enableDownloadButtons();
212 function downloadRatingsData(option){
213 disableDownloadButtons();
214 submonth=$(
"#reviewsDate").val();
215 cucode=$(
"#cuReviewsDrop").val();
216 ratings_data={
"functionname" :
"downloadRatings" ,
"cucode" : cucode,
"submonth" : submonth,
"option" : option };
218 snackybar(
"Please select Cucode");
219 populateText(
"ratingsView",
"" );
221 enableDownloadButtons();
226 url: gpappreportserverurl,
230 }).done(
function (response) {
231 if( Object.keys(response[
"error_message"]).length> 0){
232 snackybar(response[
"error_message"]);
233 populateText(
"ratingsView",
"");
234 enableDownloadButtons();
237 populateText(
"ratingsView", response[
"content"]);
239 }).fail(
function (response) {
240 populateText(
"ratingsView",
"");
241 console.log(response);
242 }).always(
function (response) {
243 enableDownloadButtons();
251 document.getElementById(
"crashes_loader").style.display =
"none";
252 document.getElementById(
"reviews_loader").style.display =
"none";
262 function populateText(
id, data){
263 document.getElementById(
id).innerHTML=data;
271 function showloader(option){
272 if(parseInt(option)==2){
273 document.getElementById(
"crashes_loader").style.display =
"block";
274 }
else if(parseInt(option)==3){
275 document.getElementById(
"reviews_loader").style.display =
"block";
284 function showTab(option){
286 document.getElementById(
'installstab').click();
287 }
else if(option ==2){
288 document.getElementById(
'crashestab').click();
290 document.getElementById(
'reviewstab').click();
299 function snackybar(content){
301 var x = document.getElementById(
"snackbar");
304 x.className =
"show";
306 setTimeout(
function(){ x.className = x.className.replace(
"show",
""); }, 3000);
308 function disableDownloadButtons(){
309 $(
"#downloadInstallsbtn").data(
"kendoButton").enable(
false);
310 $(
"#downloadCrashesbtn").data(
"kendoButton").enable(
false);
311 $(
"#downloadRatingsbtn").data(
"kendoButton").enable(
false);
313 function enableDownloadButtons(){
314 $(
"#downloadInstallsbtn").data(
"kendoButton").enable(
true);
315 $(
"#downloadCrashesbtn").data(
"kendoButton").enable(
true);
316 $(
"#downloadRatingsbtn").data(
"kendoButton").enable(
true);