function test() { IMBAuth::checkOAuth(); $id = addslashes($_GET['id']); // echo $id; if ($id == "" || $id < 1) { die("No ID"); } $ps = new PushNotCamp(); $ps->getByID($id); $llacc = new LL_Account(); $arrAcc = $llacc->getOrderBy("macc_first_name ASC"); ?> <html> <head> <link href="<?php echo _SPPATH; ?> themes/adminlte/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" href="<?php echo _SPPATH; ?> themes/adminlte/css/jqueryui.css"> <script src="<?php echo _SPPATH; ?> themes/adminlte/js/jquery-1.11.1.min.js"></script> <script src="<?php echo _SPPATH; ?> js/jqueryui.js"></script> <script src="<?php echo _SPPATH; ?> themes/adminlte/js/bootstrap.min.js" type="text/javascript"></script> </head> <body> <div id="wait" style="display: none; position: absolute; width: 100%; line-height: 30px; text-align: center; font-weight: bold;"> <span style="background-color: red; color:white; padding: 10px; margin-top: 20px;">Loading....</span></div> <div class="container"> <h4>Test Push Notification for</h4> <h1><?php echo $ps->camp_name; ?> </h1> Input Customer ID's <input class="form-control" type="text" id="ids" value="1576199,512260"> <br><i>separated by commas</i><br><br> <button id="push" class="btn btn-danger">Push</button> <div id="testresults" style="background-color: #dedede; margin-top: 40px; padding: 20px;display: none;"></div> </div> <script> $("#push").click(function(){ var ids = $("#ids").val(); $.post("<?php echo _SPPATH; ?> PushNotResults/pusher?token=<?php echo $_GET['token']; ?> ",{ camp_id : <?php echo $id; ?> , ids : ids } ,function (data) { // alert(data); $("#testresults").show(); $("#testresults").html(data); }); }); </script> <?php // pr($arrs); ?> <script> $(document).ajaxStart(function(){ $("#wait").css("display", "block"); }); $(document).ajaxComplete(function(){ $("#wait").css("display", "none"); }); </script> <style> .hasil{ border: 1px dashed #cccccc; margin: 5px; padding: 5px; } .red{ color:red; } .green{ color :darkgreen; } </style> </body> </html> <?php }
public function createDummyData() { // die("tidak active"); ?> <h1>Create Device Logger</h1> <?php $dev = new DeviceLogger(); // $dev->getByID(1); // $type = array("android","ios"); for ($x = 0; $x < 100; $x++) { //random if ada account atau tidak $adaAcc = rand(0, 9); if ($adaAcc > 6) { $accID = 0; } else { $acc = new LL_Account(); $r = rand(0, 113); $arrAcc = $acc->getOrderBy("macc_id ASC LIMIT {$r},1"); $accku = $arrAcc[0]; $accID = $accku->macc_id; } //random type $type = "ios"; $rtype = rand(0, 9); if ($rtype > 2) { $type = "android"; } $minusan = 12620550 - $x * 100; // $minusan = 75000; //random date $int = mt_rand(time() - $minusan, time()); $log = new DeviceLogger(); $log->log_acc_id = $accID; $log->log_dev_id = "dev_" . $accID; $log->log_dev_type = $type; $log->log_date = date("Y-m-d H:i:s", $int); echo $log->save(); if ($accID) { $accl = new LL_AccountLogger(); $accl->log_acc_id = $accID; $accl->log_date = date("Y-m-d H:i:s", $int); echo $accl->save(); } } }
function demographic() { $bulan = addslashes($_GET['m']); if ($bulan == "") { $bulan = date("F Y"); $days_ago = date('Y-m-01'); // hard-coded '01' for first day $days_now = date('Y-m-t'); } else { $bulan = urldecode($bulan); $days_ago = date('Y-m-01', strtotime($bulan)); // hard-coded '01' for first day $days_now = date('Y-m-t', strtotime($bulan)); } $numberDays = cal_days_in_month(CAL_GREGORIAN, date('n', strtotime($bulan)), date('Y', strtotime($bulan))); $days_ago = date('Y-m-01', strtotime($bulan)); // hard-coded '01' for first day $days_now = date('Y-m-01', strtotime('+1 month', strtotime($bulan))); $t = time(); //male female $ll = new LL_Account(); global $db; $query3 = "Select (Select count(*) from {$ll->table_name} where macc_gender='Male' AND (macc_acquire_date BETWEEN '{$days_ago}' AND '{$days_now}')) AS Male,\n(Select count(*) from {$ll->table_name} where macc_gender='Female' AND (macc_acquire_date BETWEEN '{$days_ago}' AND '{$days_now}')) AS Female "; $gender = $db->query($query3, 1); // pr($gender); // macc_lyb_status $query4 = "Select (Select count(*) from {$ll->table_name} where macc_lyb_status='LYB Club' AND (macc_acquire_date BETWEEN '{$days_ago}' AND '{$days_now}')) AS Club,\n(Select count(*) from {$ll->table_name} where macc_lyb_status='The Body Shop Friend' AND (macc_acquire_date BETWEEN '{$days_ago}' AND '{$days_now}')) AS Stampcard,\n(Select count(*) from {$ll->table_name} where macc_lyb_status='LYB Fan' AND (macc_acquire_date BETWEEN '{$days_ago}' AND '{$days_now}')) AS Fan "; $lyb = $db->query($query4, 1); // pr($lyb); //macc_address_city // $query5="SELECT DISTINCT macc_address_city FROM {$ll->table_name} "; // // $cities = $db->query($query5,2); //// pr($cities); // // foreach($cities as $number=>$city){ // if($city->macc_address_city!="") { // $city->macc_address_city = str_replace(".","",$city->macc_address_city); // $city->macc_address_city = str_replace(",","",$city->macc_address_city); // $text[] = "(Select count(*) as count from {$ll->table_name} where macc_address_city='{$city->macc_address_city}' AND (macc_acquire_date BETWEEN '$days_ago' AND '$days_now')) AS " . str_replace("/", "", str_replace(" ", "", str_replace("-", "", $city->macc_address_city))); // } //// if($number>10)break; // } //// pr($text); // $imp = "Select ". implode(",",$text)." ORDER BY count DESC"; global $db; $q = "SELECT macc_address_city,COUNT(*) as count FROM {$ll->table_name} GROUP BY macc_address_city ORDER BY count DESC LIMIT 0,20"; $arrSl = $db->query($q, 2); // pr($arrSl); // echo $imp; // $nrcities = $db->query($imp,2); // pr($nrcities); ?> <div class="row"> <div class="col-md-12"> <h1> Demographic Dashboard <small><?php echo $bulan; ?> </small> </h1> <ol class="breadcrumb"> <li> <?php echo Lang::t('Select Timeframe'); ?> </li> <li class="active"> <?php $start = new DateTime('11 months ago'); // So you don't skip February if today is day the 29th, 30th, or 31st $start->modify('first day of this month'); $end = new DateTime(); $interval = new DateInterval('P1M'); $period = new DatePeriod($start, $interval, $end); ?> <select id="apptimeselector_<?php echo $t; ?> "> <?php foreach ($period as $dt) { ?> <option value="<?php echo urlencode($dt->format('F Y')); ?> " <?php if ($dt->format('F Y') == $bulan) { echo "selected"; } ?> > <?php echo $dt->format('F Y') . "<br>"; ?> </option> <?php } ?> </select> <script> $("#apptimeselector_<?php echo $t; ?> ").change(function(){ var slc = $("#apptimeselector_<?php echo $t; ?> ").val(); openLw("Demographic","<?php echo _SPPATH; ?> BIWebDemographic/demographic?m="+slc,"fade"); }); </script> </li> </ol> </div> </div> <?php $arrUserswPic = $ll->getWhere("macc_foto != '' AND (macc_acquire_date BETWEEN '{$days_ago}' AND '{$days_now}') ORDER BY macc_acquire_date DESC LIMIT 0,8"); $arrUsers = $ll->getOrderBy(" macc_acquire_date DESC LIMIT 0,8"); ?> <div class="row"> <!--<div class="col-md-6"> <div class="box box-danger"> <div class="box-header with-border"> <h3 class="box-title">Latest Members</h3> <div class="box-tools pull-right"> <span class="label label-danger">8 New Members</span> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i> </button> </div> </div> <div class="box-body no-padding"> <ul class="users-list clearfix"> <?php foreach ($arrUsers as $user) { if ($user->macc_foto == "") { $url = _SPPATH . "images/noimage.jpg"; } else { $url = "http://43.231.128.129/" . $user->macc_foto; } ?> <li> <img src="<?php echo $url; ?> " alt="<?php echo $user->macc_first_name . " " . $user->macc_last_name; ?> "> <a class="users-list-name" href="#"><?php echo $user->macc_first_name . " " . $user->macc_last_name; ?> </a> <span class="users-list-date"><?php echo ago(strtotime($user->macc_acquire_date)); ?> </span> </li> <?php } ?> </ul> </div> <div class="box-footer text-center"> <a href="javascript::" class="uppercase">View All Users</a> </div> </div> </div> --> <div class="col-md-6"> <!-- USERS LIST --> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Latest Customers</h3> <!--<div class="box-tools pull-right"> <span class="label label-danger">8 New Members</span> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i> </button> </div>--> </div> <!-- /.box-header --> <div class="box-body no-padding"> <ul class="users-list clearfix"> <?php foreach ($arrUserswPic as $user) { ?> <li style="height: 160px;"> <img src="<?php echo _LOKASI; echo $user->macc_foto; ?> " alt="User Image"> <span class="users-list-name" ><?php echo $user->macc_first_name . " " . $user->macc_last_name; ?> </span> <span class="users-list-date"><?php echo ago(strtotime($user->macc_acquire_date)); ?> </span> </li> <?php } ?> </ul> <!-- /.users-list --> </div> <!-- /.box-body --> <div class="box-footer text-center"> <a href="javascript:openLw('LL_Account', '<?php echo _SPPATH; ?> LLAccWeb/LL_Account', 'fade'); activkanMenuKiri('LL_Account');" class="uppercase">View All Customers</a> </div> <!-- /.box-footer --> </div> <!--/.box --> </div> <?php $arrColor = array("#00a65a", "#00c0ef"); $c = new Charting(); $c->color = array_pop($arrColor); $c->label = "Male"; $c->value = $gender->Male; $arrData[] = $c; $c = new Charting(); $c->color = array_pop($arrColor); $c->label = "Female"; $c->value = $gender->Female; $arrData[] = $c; ?> <div class="col-md-3"><?php Charting::morrisDonut("287px", $arrData, 1, "Gender", "default"); ?> </div> <?php $arrColor = array("#4da65a", "#7bcd03", "#53ddde"); $arrData = array(); $c = new Charting(); // $c->color = array_pop($arrColor); $c->color = "#e90057"; $c->label = "Fan"; $c->value = $lyb->Fan; $arrData[] = $c; $c = new Charting(); // $c->color = array_pop($arrColor); $c->color = "#cd6949"; $c->label = "Club"; $c->value = $lyb->Club; $arrData[] = $c; $c = new Charting(); // $c->color = array_pop($arrColor); $c->color = "#f4bb1b"; $c->label = "Stampcard"; $c->value = $lyb->Stampcard; $arrData[] = $c; ?> <div class="col-md-3"><?php Charting::morrisDonut("287px", $arrData, 1, "Member Type", "default"); ?> </div> <?php $arrData = array(); $arrlegend = array(); foreach ($arrSl as $attr => $value) { if ($value->macc_address_city == "") { $value->macc_address_city = "Unknown"; } $c = new Charting(); $c->color = "#" . $this->random_color(); $c->label = str_replace(" ", "_", $value->macc_address_city); $c->value = $value->count; $arrData[] = $c; // $arrlegend[$attr] = $value; } // asort($arrlegend); //pr($arrlegend); // $arrlegend = array_reverse($arrlegend,1); // $arrData = array(); // foreach($arrSl as $attr=>$value){ // $c = new Charting(); // $c->color = "#".$this->random_color(); // // $c->label = str_replace(" ","_",$value->macc_address_city); // $c->value = $value->count; // //// $c->label = ucwords(strtolower(str_replace("_"," ",$attr))); //// $c->value = $value; // $arrData[] = $c; // $arrColors[$attr] = $c->color; //// $arrlegend[$attr] = $value; // } ?> </div> <div class="row"> <div class="col-md-12"> <div class="box box-default"> <div class="box-header with-border"> <h3 class="box-title">Locations</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body chart-responsive"> <div class="col-md-6"> <?php Charting::morrisDonut("300px", $arrData, 0, "Locations", "default", 0); ?> </div> <div class="col-md-6"> <?php ?> <ul class="nav nav-pills nav-stacked"> <?php foreach ($arrSl as $attr => $value) { if ($value->macc_address_city == "") { $value->macc_address_city = "Unknown"; } ?> <li style="line-height: 30px;"> <div style="margin-top:5px; float: left; width: 20px; height: 20px; background-color: <?php echo $arrColors[$attr]; ?> ;"></div> <?php echo ucwords(str_replace("_", " ", strtolower($value->macc_address_city))); ?> <span class="pull-right "> <?php echo $value->count; ?> </span></li> <?php } ?> </ul> </div> </div> <!-- /.box-body --> </div> </div> </div> <style> ul.legend li{ list-style: none; line-height: 30px; } ul.legend li div{ float: left; margin-top: 10px; margin-right: 15px; } .legend-item{ float: left; margin: 10px; line-height: 30px; margin-right: 5px; } .legend-item div{ float: left; margin-top: 10px; margin-right: 5px; } .breadcrumb { padding: 8px 15px; margin-bottom: 20px; list-style: none; background-color: #f5f5f5; border-radius: 4px; } .breadcrumb { float: right; background: transparent; margin-top: 0; margin-bottom: 0; font-size: 12px; padding: 7px 5px; position: absolute; top: 15px; right: 10px; border-radius: 2px; } .users-list-name{ white-space: nowrap; } </style> <?php }