Commit f441d5d9 authored by Anggi Saputra's avatar Anggi Saputra

HAHA

parent c45d5dcf
......@@ -69,11 +69,6 @@ class UserController extends \Application\Master\GlobalActionController
$post = $this->getRequest()->getPost();
$session = $this->getSession();
// if (strlen('' . $post['token_keamanan']) <= 0 || $post['token_keamanan'] <> $session->get('token_keamanan')) {
// $message = htmlspecialchars('Token login tidak sesuai. Mohon ulangi.', ENT_QUOTES, 'UTF-8');
// $session->put(null, array('message' => $message));
// return $this->redirect()->toRoute('login');
// }
$username = $post['username'];
$password = $post['passwd'];
......
......@@ -43,19 +43,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/index-js/action-listdata.js');
return $view;
}
// public function templateAction(){
// $view = new ViewModel();
// $this->layout("layout/login");
// return $view;
// }
public function dashboardAction(){
$this->isLoggedIn();
......@@ -98,7 +89,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->headScript->appendFile('/template/js/demo/chart-pie2-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-pie-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-pie3-demo.js');
$this->headScript->appendFile('/template/js/demo/table-user-action.js');
$this->headScript->appendFile('/template/js/demo/table-user-info.js');
$this->headScript->appendFile('/template/js/demo/chart-area-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-bar-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-bar2-demo.js');
......@@ -241,8 +232,8 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/other-list-action.js');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/table-user-other.js');
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
......@@ -251,7 +242,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
}
public function userwebinfoAction(){
$pagename = 'info user';
if($_GET['token'] == null){
$this->redirect()->toRoute('home');
}
......@@ -262,6 +253,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
// $session_data->set()
$urltoken = $_GET['token'];
$session_data->put(null, array(
'pagename' => $pagename,
));
$view->setVariables(array(
'id_user' => $session_data->get('user_id'),
......@@ -271,9 +265,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
//$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
$this->headScript->appendFile('/template/js/demo/table-user-info.js');//js nya ganti lagi
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
......@@ -302,9 +297,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
$this->headScript->appendFile('/template/js/demo/table-user-page.js');//js nya ganti lagi
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
......@@ -333,9 +328,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
$this->headScript->appendFile('/template/js/demo/table-user-button.js');//js nya ganti lagi
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
......@@ -364,10 +359,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/table-user-browser.js');//js nya ganti lagi
$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
$this->layout('layout/menu');
......@@ -395,9 +390,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
$this->headScript->appendFile('/template/js/demo/table-user-image.js');//js nya ganti lagi
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
......@@ -410,6 +405,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
if($_GET['token'] == null){
$this->redirect()->toRoute('home');
}
$view = new ViewModel();
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
......@@ -422,17 +418,22 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
'id_user' => $session_data->get('user_id'),
'token' => $urltoken,
));
// print_r($urltoken);
$this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var token = "' . $urltoken . '"');
$this->headScript->appendScript(' var validasiToken = "' . $urltoken . '"');
$this->headScript->appendFile('/template/js/demo/other-list-action.js');//js nya ganti lagi
$this->headScript->appendFile('/template/js/demo/table-user-video.js');//js nya ganti lagi
//print_r($baseurl);die;
$this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename');
$this->layout('layout/menu');
return $view;
}
}
......@@ -53,12 +53,12 @@ class Param extends Mapper {
$data = $this->_storage->loadChartData($id);
return $data;
}
public function loadChartimage($id){
$data = $this->_storage->loadChartDataimage($id);
public function loadChartimage($idweb, $country, $province, $city){
$data = $this->_storage->loadChartDataimage($idweb, $country, $province, $city);
return $data;
}
public function loadChartbutton($id){
$data = $this->_storage->loadBarButtonData($id);
public function loadChartbutton($idweb, $country, $province, $city){
$data = $this->_storage->loadBarButtonData($idweb, $country, $province, $city);
return $data;
}
......@@ -66,6 +66,18 @@ class Param extends Mapper {
$data = $this->_storage->loadPieBrowserData($idweb);
return $data;
}
public function getbrowserbylocat($idweb, $city, $province, $country){
$data = $this->_storage->loadbrowserbylocat($idweb, $city, $province, $country);
return $data;
}
public function getpagebylocat($idweb, $city, $province, $country){
$data = $this->_storage->loadpagebylocat($idweb, $city, $province, $country);
return $data;
}
public function getvisitorbytime($idweb, $year, $month, $province, $country){
$data = $this->_storage->loadvisitorbytime($idweb, $year, $month, $province, $country);
return $data;
}
public function loadTableUser($id){
$data = $this->_storage->loadTableUserData($id);
......@@ -178,6 +190,43 @@ class Param extends Mapper {
return $data;
}
public function getTablePage($idweb){
$data = $this->_storage->loadtablepage($idweb);
return $data;
}
public function getTableButton($idweb){
$data = $this->_storage->loadtablebutton($idweb);
return $data;
}
public function getTableBrowser($idweb){
$data = $this->_storage->loadtablebrowser($idweb);
return $data;
}
public function getTableVideo($idweb){
$data = $this->_storage->loadtablevideo($idweb);
return $data;
}
public function getTableImage($idweb){
$data = $this->_storage->loadtableimage($idweb);
return $data;
}
public function getTableOther($idweb){
$data = $this->_storage->loadtableother($idweb);
return $data;
}
public function getcountry($idweb){
$data = $this->_storage->loadcountry($idweb);
return $data;
}
public function getprovince($idweb, $country){
$data = $this->_storage->loadprovince($idweb, $country);
return $data;
}
public function getcity($idweb, $country, $province){
$data = $this->_storage->loadcity($idweb, $country, $province);
return $data;
}
public function getnumbervisitor($idweb, $year){
$data = $this->_storage->loadnumbervisitor($idweb, $year);
return $data;
......
<!-- <div class="row">
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Test Login</h3>
</div>
<div class="panel-body">
<p># Modul config harus disesuaikan dengan koneksi database masing-masing : <i>/Application/config/module.config</i> </p>
<p><a href="https://drive.google.com/file/d/1V7B8tMNJIq60PTXdEO_xs05OBWiAn7_p/view?usp=sharing" target="_blank"># download tabel USER</a></p>
<form method="post" id="login" action="<?php echo $this->basePath()?>/user/authenticate">
<fieldset>
<center>
<div class="form-group" style="margin-top:20px;">
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="text" id="username" name="username" class="form-control" placeholder="Username" required />
<i class="icon-user"></i>
</span>
</label>
</div>
<div class="form-group">
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="password" id="passwd" name="passwd" class="form-control" placeholder="Password" required />
<i class="icon-lock"></i>
</span>
</label>
</div>
<div class="space"></div>
<div class="modal-footer">
<button type="submit" class="width-35 pull-right btn btn-sm btn-danger">
<i class="icon-key"></i>
Login
</button>
</div>
<div class="space-4"></div>
<input type="text" name="token_keamanan" value="<?php if(isset($this->token_keamanan)) { echo $this->token_keamanan; }?>">
<div style="font-weight: bold;"><?php if(isset($this->message)) { echo $this->message; }?></div>
</center>
</fieldset>
</form>
</div>
</div>
</div>
</div> -->
<!-- <link href="<?php $this->basePath();?> /template/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<link href="<?php $this->basePath();?> /template/css/sb-admin-2.min.css" rel="stylesheet"> -->
<div class="row justify-content-center mt-4">
<div class="col-xl-5 col-lg-6 col-md-8">
<div class="card o-hidden border-0 shadow-lg my-5">
......
<!-- laskhdlkashdlkashdlksahd -->
\ No newline at end of file
......@@ -5,7 +5,7 @@
<!-- Custom styles for this template-->
<!-- <link href="<?php $this->basePath();?> /template/css/sb-admin-2.min.css" rel="stylesheet"> -->
<!-- Outer Row -->
<div class="container-fluid">
<div class="row justify-content-center" id="hui">
<div class="col-xl-5 col-lg-12 col-md-9" >
......
......@@ -11,18 +11,21 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">Other Table</h1>
</div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebOther', 'W3C Example Table')" value="Download to Excel">
<div >
<table class="table table-bordered" id="dataTable1" >
<table class="table table-bordered" id="dataTableUserWebOther" >
<caption hidden>User Web Other Table</caption>
<thead>
<tr>
<!-- <th>No</th> -->
<th>Nama Website</th>
<th>Domain</th>
<th>Token</th>
<th>Action</th>
<th style="width:50px">No</th>
<th>IP Address User</th>
<th>Name Other</th>
<th>Date Access</th>
<th>Time Access</th>
</tr>
</thead>
<tbody id="tabeltoken">
<tbody id="tbluserwebother">
<!-- tabel from website list action -->
</tbody>
</table>
......
......@@ -11,18 +11,20 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Browser Table</h1>
</div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebBrowser', 'Table Browser')" value="Download to Excel">
<div >
<table class="table table-bordered" id="dataTable1" >
<table class="table table-bordered" id="dataTableUserWebBrowser" >
<caption hidden>User Web Browser Table</caption>
<thead>
<tr>
<!-- <th>No</th> -->
<th>Nama Website</th>
<th>Domain</th>
<th>Token</th>
<th>Action</th>
<th style="width:50px">No</th>
<th>IP Address User</th>
<th>Browser</th>
<th>Browser Version</th>
</tr>
</thead>
<tbody id="tabeltoken">
<tbody id="tbluserwebbrowser">
<!-- tabel from website list action -->
</tbody>
</table>
......
......@@ -11,19 +11,21 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Button Table</h1>
</div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebButton', 'Table Button')" value="Download to Excel">
<div >
<table class="table table-bordered" id="dataTable1" >
<table class="table table-bordered" id="dataTableUserWebButton" >
<caption hidden>User Web Button Table</caption>
<thead>
<tr>
<!-- <th>No</th> -->
<th>Nama Website</th>
<th>Domain</th>
<th>Token</th>
<th>Action</th>
<th style="width:50px">No</th>
<th>IP user</th>
<th>Name Button</th>
<th>Date Access</th>
<th>Time Access</th>
</tr>
</thead>
<tbody id="tabeltoken">
<!-- tabel from website list action -->
<tbody id="tbluserwebbtn">
</tbody>
</table>
</div>
......
......@@ -11,18 +11,21 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Image Table</h1>
</div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebImage', 'Table Image')" value="Download to Excel">
<div >
<table class="table table-bordered" id="dataTable1" >
<table class="table table-bordered" id="dataTableUserWebImage" >
<caption hidden>User Web Image Table</caption>
<thead>
<tr>
<!-- <th>No</th> -->
<th>Nama Website</th>
<th>Domain</th>
<th>Token</th>
<th>Action</th>
<th style="width:50px">No</th>
<th>IP Address User</th>
<th>Name Image</th>
<th>Date Access</th>
<th>Time Access</th>
</tr>
</thead>
<tbody id="tabeltoken">
<tbody id="tbluserwebimage">
<!-- tabel from website list action -->
</tbody>
</table>
......
......@@ -11,21 +11,26 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Info Table</h1>
</div>
<div >
<table class="table table-bordered" id="dataTable1" >
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableuserwebinfo', 'Table User Info')" value="Download to Excel">
<div class="table-responsive">
<table class="table table-bordered" id="dataTableuserwebinfo" width="100%" cellspacing="0">
<caption hidden>User Web Info Table</caption>
<thead>
<tr>
<!-- <th>No</th> -->
<th>No</th>
<th>IP Address Public</th>
<th style="width:50px">No</th>
<th>IP Address Client</th>
<th>Mac Address</th>
<th>Location</th>
<th>Browser</th>
<th>IP Address Public</th>
<th>Date Visit</th>
</tr>
</thead>
<tbody id="tabeltoken">
<!-- tabel from website list action -->
<tbody id="tbluserwebinfo">
</tbody>
</table>
</div>
</div>
......
......@@ -11,19 +11,21 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Page Table</h1>
</div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebPage', 'Table User Page')" value="Download to Excel">
<div >
<table class="table table-bordered" id="dataTable1" >
<table class="table table-bordered" id="dataTableUserWebPage" >
<caption hidden>User Web Page Table</caption>
<thead>
<tr>
<th>No</th>
<th style="width:50px">No</th>
<th>IP User</th>
<th>Name Page</th>
<th>Date Access</th>
<th>Time Access</th>
<th>Total Time</th>
</tr>
</thead>
<tbody id="tabeltoken">
<!-- tabel from website list action -->
<tbody id="tabeluserwebpage">
</tbody>
</table>
</div>
......
......@@ -11,18 +11,20 @@
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Video Table</h1>
</div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebVideo', 'Table Video')" value="Download to Excel">
<div >
<table class="table table-bordered" id="dataTable1" >
<table class="table table-bordered" id="dataTableUserWebVideo" >
<caption hidden>User Web Video Table</caption>
<thead>
<tr>
<!-- <th>No</th> -->
<th>Nama Website</th>
<th>Domain</th>
<th>Token</th>
<th>Action</th>
<th style="width:50px">No</th>
<th>IP Address User</th>
<th>Name Video</th>
<th>Date Access</th>
<th>Time Access</th>
</tr>
</thead>
<tbody id="tabeltoken">
<tbody id="tbluserwebvideo">
<!-- tabel from website list action -->
</tbody>
</table>
......
......@@ -4,8 +4,6 @@
if(defined('RUNNING_FROM_ROOT')){
$this->plugin('basePath')->setBasePath($this->basePath().'/public');
}
?>
<html lang="en">
......
......@@ -4,8 +4,6 @@ Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,Bli
Chart.defaults.global.defaultFontColor = '#858796';
var config;
function number_format(number, decimals, dec_point, thousands_sep) {
number = (number + '').replace(',', '').replace(' ', '');
var n = !isFinite(+number) ? 0 : +number,
......@@ -30,12 +28,16 @@ function number_format(number, decimals, dec_point, thousands_sep) {
}
window.setInterval(function(){
loaddatavisitor();
},60000);
changefunct();
if($('#selectmonth').val()!='all month'){
changemonthfunc();
}
loaddatavisitor();
},6000);
loaddatavisitor(validasiToken);
function loaddatavisitor(){
function setnewload(token){
dates = new Date();
year = dates.getFullYear();
......@@ -46,7 +48,68 @@ function loaddatavisitor(){
async : false,
data : {
year : year,
token : validasiToken
token : token
},
success:function(result){
var data = result.data;
months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
total =[0,0,0,0,0,0,0,0,0,0,0,0];
for (x in data){
if(data[x]['month'] == 1 ){
total[0] = data[x]['total'];
}
if(data[x]['month'] == 2 ){
total[1] = data[x]['total'];
}
if(data[x]['month'] == 3 ){
total[2] = data[x]['total'];
}
if(data[x]['month'] == 4 ){
total[3] = data[x]['total'];
}
if(data[x]['month'] == 5 ){
total[4] = data[x]['total'];
}
if(data[x]['month'] == 6 ){
total[5] = data[x]['total'];
}
if(data[x]['month'] == 7 ){
total[6] = data[x]['total'];
}
if(data[x]['month'] == 8 ){
total[7] = data[x]['total'];
}
if(data[x]['month'] == 9 ){
total[8] = data[x]['total'];
}
if(data[x]['month'] == 10 ){
total[9] = data[x]['total'];
}
if(data[x]['month'] == 11 ){
total[10] = data[x]['total'];
}
if(data[x]['month'] == 12 ){
total[11] = data[x]['total'];
}
}
$('#totVisitor').html('Total Vistor '+year);
}
});
}
function loaddatavisitor(token){
dates = new Date();
year = dates.getFullYear();
$.ajax({
type : 'POST',
dataType : 'JSON',
url : baseURL + "/api/loadvisitorperyear",
async : false,
data : {
year : year,
token : token
},
success:function(result){
var data = result.data;
......@@ -185,8 +248,6 @@ function loaddatavisitor(){
}
}
function changefunct(){
var selectyear = document.getElementById("selectyear");
var selectedyear = selectyear.options[selectyear.selectedIndex].value;
......@@ -343,7 +404,7 @@ function loaddatavisitor(){
}
loadselectfirst(validasiToken);
function loadselectfirst(tokeni){
function loadselectfirst(tokeni){x
$.ajax({
type : "post",
dataType : "JSON",
......@@ -356,7 +417,7 @@ function loadselectfirst(tokeni){
for (x in data){
option = '';
option += `<option val='`+data[x]['date_part']+`'>`+data[x]['date_part']+`</option>`;
option += `<option value='`+data[x]['date_part']+`'>`+data[x]['date_part']+`</option>`;
$('#selectyear').append(option);
}
}
......@@ -366,7 +427,7 @@ function loadselectfirst(tokeni){
let year = dates.getFullYear();
optionmonth = '';
optionmonth += '<option>All Month</option>';
optionmonth += '<option value="all month">All Month</option>';
$.ajax({
type : 'POST',
......
......@@ -2,8 +2,35 @@
Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#858796';
function number_format(number, decimals, dec_point, thousands_sep) {
// * example: number_format(1234.56, 2, ',', ' ');
// * return: '1 234,56'
number = (number + '').replace(',', '').replace(' ', '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function(n, prec) {
var k = Math.pow(10, prec);
return '' + Math.round(n * k) / k;
};
// Fix for IE parseFloat(0.55).toFixed(0) = 0;
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
if (s[0].length > 3) {
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
}
if ((s[1] || '').length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
}
return s.join(dec);
}
loadDataHalaman(validasiToken);
function loadDataHalaman(token){
$(document).ready(function(){
$.ajax({
......@@ -11,7 +38,7 @@ function loadDataHalaman(token){
dataType: 'json',
url: baseURL + '/api/loadcharthalaman',
data: {
token : validasiToken
token : token
},
success: function(result){
if(result.code==0){
......@@ -25,15 +52,14 @@ function loadDataHalaman(token){
halaman[o] = data[o].name_page;
jumlah[o] = data[o].count;
}
// Bar Chart Example
var ctx = document.getElementById("myBarChart");
var myBarChart = new Chart(ctx, {
configpagebar = {
type: 'bar',
data: {
labels: halaman,
datasets: [{
label: "Jumlah",
label: "Total",
backgroundColor: "#4e73df",
hoverBackgroundColor: "#2e59d9",
borderColor: "#4e73df",
......@@ -107,44 +133,165 @@ function loadDataHalaman(token){
}
},
}
});
}
var ctx = document.getElementById("myBarChart").getContext("2d");
window.myBarpage = getNewChart(ctx, configpagebar);
}else{
alert(result.info);
}
},
error: function(xhr){
alert(xhr.status+'-'+xhr.statusText);
}
});
});
}
function getNewChart(canvas, configpagebar) {
return new Chart(canvas, configpagebar);
}
function number_format(number, decimals, dec_point, thousands_sep) {
// * example: number_format(1234.56, 2, ',', ' ');
// * return: '1 234,56'
number = (number + '').replace(',', '').replace(' ', '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function(n, prec) {
var k = Math.pow(10, prec);
return '' + Math.round(n * k) / k;
};
// Fix for IE parseFloat(0.55).toFixed(0) = 0;
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
if (s[0].length > 3) {
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
loadselectfirstpage(validasiToken);
function loadselectfirstpage(tokeni){
option = '';
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcountry",
data : {
token : tokeni
},
success:function(result){
let data = result.data;
option = '';
option += `<option value=''>All Country</option>`
for (x in data){
option += `<option value = `+data[x]['country']+`>`+data[x]['country']+`</option>`
}
if ((s[1] || '').length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
$('#selectcountrypage').html(option);
}
return s.join(dec);
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovincepage').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcitypage').html(optioncity);
}
$('#selectcountrypage').change(function(){
let country = $('#selectcountrypage').val();
let province = $('#selectprovincepage').val();
let city = $('#selectcitypage').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadprovince",
data : {
token : validasiToken,
country : country
},success:function(result){
let data = result.data;
optionprov = '';
optionprov = `<option value=''>All Province</option>`;
for (x in data){
optionprov += `<option value = '`+data[x]['province']+`'>`+data[x]['province']+`</option>`
}
$('#selectprovincepage').html(optionprov);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovincepage').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcitypage').html(optioncity);
changedatapage(country, null, null);
});
$('#selectprovincepage').change(function(){
let province = $('#selectprovincepage').val();
let country = $('#selectcountrypage').val();
let city = $('#selectcitypage').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcity",
data : {
token : validasiToken,
country : country,
province : province
},success:function(result){
let data = result.data;
optioncity = '';
optioncity += `<option value=''>All City</option>`;
for (x in data){
optioncity += `<option value = `+data[x]['city']+`>`+data[x]['city']+`</option>`
}
$('#selectcitypage').html(optioncity);
}
});
changedatapage(country, province, city);
});
$('#selectcitypage').change(function(){
let province = $('#selectprovincepage').val();
let country = $('#selectcountrypage').val();
let city = $('#selectcitypage').val();
changedatapage(country, province, city);
})
function changedatapage(country, province, city){
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadpagebylocat",
data : {
token : validasiToken,
country : country,
province : province,
city : city
},success:function(result){
let data = result.data;
// console.log(data);
let label = [];
let total = [];
for(x in data){
label[x]=data[x]['name_page'];
total[x]=data[x]['count'];
}
configpagenew = {
labels: label,
datasets: [{
label: "Total",
backgroundColor: "#4e73df",
hoverBackgroundColor: "#2e59d9",
borderColor: "#4e73df",
data: total,
}],
};
myBarpage.data = configpagenew;
window.myBarpage.update();
}
});
}
......@@ -37,6 +37,9 @@ function loaddatabutton(token){
url : baseURL + '/api/loadbutton',
data :{
token : token,
country : null,
province: null,
city : null
},
success:function(result){
let data = result.data;
......@@ -49,8 +52,7 @@ function loaddatabutton(token){
}
// console.log(total);
var ctx = document.getElementById("myBarChart2");
var myBarChart = new Chart(ctx, {
var configbutton= {
type: 'bar',
data: {
labels: button,
......@@ -129,11 +131,153 @@ function loaddatabutton(token){
}
},
}
};
var ctx = document.getElementById("myBarChart2").getContext("2d");
window.myBarButton = getNewChart(ctx, configbutton);
}
})
}
loadselectfirstbutton(validasiToken);
function loadselectfirstbutton(tokeni){
option = '';
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcountry",
data : {
token : tokeni
},
success:function(result){
let data = result.data;
option = '';
option += `<option value=''>All Country</option>`
for (x in data){
option += `<option value = `+data[x]['country']+`>`+data[x]['country']+`</option>`
}
$('#selectcountrybutton').html(option);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovincebutton').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcitybutton').html(optioncity);
}
$('#selectcountrybutton').change(function(){
let country = $('#selectcountrybutton').val();
let province = $('#selectprovincebutton').val();
let city = $('#selectcitybutton').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadprovince",
data : {
token : validasiToken,
country : country
},success:function(result){
let data = result.data;
optionprov = '';
optionprov = `<option value=''>All Province</option>`;
for (x in data){
optionprov += `<option value = '`+data[x]['province']+`'>`+data[x]['province']+`</option>`
}
$('#selectprovincebutton').html(optionprov);
}
});
})
optionprov = `<option value=''>All Province</option>`
$('#selectprovincebutton').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcitybutton').html(optioncity);
changedatabutton(country, province, city);
});
$('#selectprovincebutton').change(function(){
let country = $('#selectcountrybutton').val();
let province = $('#selectprovincebutton').val();
let city = $('#selectcitybutton').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcity",
data : {
token : validasiToken,
country : country,
province : province
},success:function(result){
let data = result.data;
optioncity = '';
optioncity += `<option value=''>All City</option>`;
for (x in data){
optioncity += `<option value = `+data[x]['city']+`>`+data[x]['city']+`</option>`
}
$('#selectcitybutton').html(optioncity);
}
});
changedatabutton(country, province, city);
});
$('#selectcitybutton').change(function(){
let country = $('#selectcountrybutton').val();
let province = $('#selectprovincebutton').val();
let city = $('#selectcitybutton').val();
changedatabutton(country, province, city);
});
function changedatabutton(country, province, city){
$.ajax({
type : 'post',
dataType : 'json',
url : baseURL + '/api/loadbutton',
data :{
token : validasiToken,
country : country,
province: province,
city : city
},
success:function(result){
let data = result.data;
button = [];
total = [];
for (x in data){
button[x] = data[x].nodebtn;
total[x] = data[x].count;
}
configbarbuttonnew = {
labels: button,
datasets: [{
label: "Jumlah",
backgroundColor: "#4e73df",
hoverBackgroundColor: "#2e59d9",
borderColor: "#4e73df",
data: total
}],
}
myBarButton.data = configbarbuttonnew;
window.myBarButton.update();
}
});
}
\ No newline at end of file
......@@ -7,6 +7,16 @@ var ctx = document.getElementById("myPieChart").getContext("2d");
window.myPie = getNewChart(ctx, configpiebw);
window.setInterval(function(){
let province = $('#selectprovince').val();
let country = $('#selectcountry').val();
let city = $('#selectcity').val();
changedata(country, province, city);
},6000);
function loaddatabrowser(tokeni){
dates = new Date();
year = dates.getFullYear();
......@@ -32,7 +42,6 @@ function loaddatabrowser(tokeni){
}
},
});
configpiebw = {
type: 'pie',
data: {
......@@ -63,27 +72,14 @@ function loaddatabrowser(tokeni){
},
}
let colour = ['primary','success','info','warning','secondary'];
for(y in label){
var colour = ['primary','success','info','warning','secondary'];
var cols = "";
for(y in label){
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+label[y]+'</span>';
$('#infoChartBrowser').append(cols);
}
$('#infoChartBrowser').html(cols);
}
function setpie(){
configpiebwnew = {
labels: ['aa'],
datasets: [{
data: [12],
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#f6c23e', "#c5c5c5"],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
}
myPie.data = configpiebwnew;
window.myPie.update();
}
function getNewChart(canvas, configpiebw) {
......@@ -91,22 +87,153 @@ function getNewChart(canvas, configpiebw) {
}
loadloc(validasiToken);
function loadloc(tokeni){
loadselectfirst(validasiToken);
function loadselectfirst(tokeni){
option = '';
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadyear",
url : baseURL + "/api/loadcountry",
data : {
token : tokeni
},
success:function(result){
let data = result.data;
option = '';
option += `<option value=''>All Country</option>`
for (x in data){
option += `<option>`+data[x]['date_part']+`</option>`
$('#selectloct').append(option);
option += `<option value = `+data[x]['country']+`>`+data[x]['country']+`</option>`
}
$('#selectcountry').html(option);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovince').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcity').html(optioncity);
}
$('#selectcountry').change(function(){
let country = $('#selectcountry').val();
let province = $('#selectprovince').val();
let city = $('#selectcity').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadprovince",
data : {
token : validasiToken,
country : country
},success:function(result){
let data = result.data;
optionprov = '';
optionprov = `<option value=''>All Province</option>`;
for (x in data){
optionprov += `<option value = '`+data[x]['province']+`'>`+data[x]['province']+`</option>`
}
$('#selectprovince').html(optionprov);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovince').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcity').html(optioncity);
changedata(country, null, null);
});
$('#selectprovince').change(function(){
let province = $('#selectprovince').val();
let country = $('#selectcountry').val();
let city = $('#selectcity').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcity",
data : {
token : validasiToken,
country : country,
province : province
},success:function(result){
let data = result.data;
optioncity = '';
optioncity += `<option value=''>All City</option>`;
for (x in data){
optioncity += `<option value = `+data[x]['city']+`>`+data[x]['city']+`</option>`
}
$('#selectcity').html(optioncity);
}
});
changedata(country, province, city);
});
$('#selectcity').change(function(){
let province = $('#selectprovince').val();
let country = $('#selectcountry').val();
let city = $('#selectcity').val();
changedata(country, province, city);
})
function changedata(country, province, city){
// console.log(country+province+city)
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadbrowserbylocat",
data : {
token : validasiToken,
country : country,
province : province,
city : city
},success:function(result){
let data = result.data;
var label = [];
var total = [];
for(x in data){
label[x] = data[x]['browser_name'];
total[x] = data[x]['total'];
}
configpiebwnew = {
labels: label,
datasets: [{
data: total,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#f6c23e', "#c5c5c5"],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
}
myPie.data = configpiebwnew;
window.myPie.update();
let colour = ['primary','success','info','warning','secondary'];
var cols = "";
for(y in label){
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+label[y]+'</span>';
}
$('#infoChartBrowser').html(cols);
}
});
}
This diff is collapsed.
......@@ -4,33 +4,31 @@ Chart.defaults.global.defaultFontColor = '#858796';
$("#websiteName").html(websitetitle);
LoadDadta(validasiToken);
function LoadDadta(token){
$(document).ready(function(){
function LoadDadta(token){
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadchartimage',
data: {
token : validasiToken,
token : token,
country : null,
province: null,
city : null
},
success: function(result){
console.log(result);
if(result.code == 0){
// console.log(result);
let data = result.data;
var image_name = [];
let jumlah = [];
//let counter = 0;
for(x in data){
image_name[x] = data[x].nodeimage;
jumlah[x] = data[x].count;
}
var ctx = document.getElementById("myPieChart4");
var myPieChart = new Chart(ctx, {
var configimage = {
type: 'pie',
data: {
labels: image_name,
......@@ -58,7 +56,10 @@ LoadDadta(validasiToken);
},
cutoutPercentage: 0,
},
});
};
var ctx = document.getElementById("myPieChart4").getContext("2d");
window.myPieImage = getNewChart(ctx, configimage);
let colour = ['primary','success','info','warning','secondary'];
......@@ -67,14 +68,162 @@ LoadDadta(validasiToken);
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+image_name[y]+'</span>';
$('#infoChartImage').append(cols);
}
}else{
alert(result.info);
}
});
}
function getNewChart(canvas, configpiebw) {
return new Chart(canvas, configpiebw);
}
loadselectfirstimage(validasiToken);
function loadselectfirstimage(tokeni){
option = '';
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcountry",
data : {
token : tokeni
},
error: function(xhr) {
alert(xhr.status+'-'+xhr.statusText);
success:function(result){
let data = result.data;
option = '';
option += `<option value=''>All Country</option>`
for (x in data){
option += `<option value = `+data[x]['country']+`>`+data[x]['country']+`</option>`
}
$('#selectcountryimage').html(option);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovinceimage').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcityimage').html(optioncity);
}
$('#selectcountryimage').change(function(){
let country = $('#selectcountryimage').val();
let province = $('#selectprovinceimage').val();
let city = $('#selectcityimage').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadprovince",
data : {
token : validasiToken,
country : country
},success:function(result){
let data = result.data;
optionprov = '';
optionprov = `<option value=''>All Province</option>`;
for (x in data){
optionprov += `<option value = '`+data[x]['province']+`'>`+data[x]['province']+`</option>`
}
$('#selectprovinceimage').html(optionprov);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovinceimage').html(optionprov);
optioncity = `<option value=''>All City</option>`
$('#selectcityimage').html(optioncity);
changedataimage(country, province, city);
});
$('#selectprovinceimage').change(function(){
let country = $('#selectcountryimage').val();
let province = $('#selectprovinceimage').val();
let city = $('#selectcityimage').val();
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadcity",
data : {
token : validasiToken,
country : country,
province : province
},success:function(result){
let data = result.data;
optioncity = '';
optioncity += `<option value=''>All City</option>`;
for (x in data){
optioncity += `<option value = `+data[x]['city']+`>`+data[x]['city']+`</option>`
}
$('#selectcityimage').html(optioncity);
}
});
changedataimage(country, province, city);
});
$('#selectcityimage').change(function(){
let country = $('#selectcountryimage').val();
let province = $('#selectprovinceimage').val();
let city = $('#selectcityimage').val();
changedataimage(country, province, city);
});
function changedataimage($country, $province, $city){
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadchartimage',
data: {
token : validasiToken,
country : $country,
province: $province,
city : $city
},
success: function(result){
// console.log(result);
let data = result.data;
let image_name = [];
let jumlah = [];
for(x in data){
image_name[x] = data[x].nodeimage;
jumlah[x] = data[x].count;
}
configimagenew = {
labels: image_name,
datasets: [{
data: jumlah,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#ffd700', '#c5c5c5'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
}
myPieImage.data = configimagenew;
window.myPieImage.update();
let colour = ['primary','success','info','warning','secondary'];
for(y in data){
var cols = "";
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+image_name[y]+'</span>';
$('#infoChartImage').append(cols);
}
}
});
}
\ No newline at end of file
console.log(token)
\ No newline at end of file
loadUserWebsite(validasiToken);
function loadUserWebsite(token){
$(document).ready(function(){
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loaduserweb',
data: {
token : token,
},
success: function(result){
if(result){
let data = result.data;
let counter = 1;
for(z in data){
var cols = "";
cols += '<tr>'
cols += '<td>'+counter+'</td>'
cols += '<td>'+data[z].ip_address_client+'</td>';
cols += '<td>'+data[z].mac_address+'</td>';
cols += '<td>'+data[z].city+'</td>';
cols += '<td>'+data[z].browser_name+'</td>';
cols += '<td>'+data[z].ip_address_public+'</td>';
cols += '<td>'+data[z].date_first_visit+'</td>';
cols += '</tr>'
$("#tbluser").append(cols);
counter++;
}
$('#dataTable').DataTable({
scrollY: '350px',
scrollX: false,
fixedHeader: true,
scrollCollapse: true,
autoWidth: false,
paging: true,
columnDefs: [
{width: 30, targets: 0},
{width: 200, targets: 1},
{ width: 200, targets: 2 },
{ width: 150, targets: 3 },
{ width: 150, targets: 4 },
{ width: 200, targets: 5 },
{ width: 150, targets: 6 },
],
});
}else{
alert(result.info);
}
},
error: function(xhr){
alert(xhr.status+'-'+xhr.statusText);
}
});
});
}
\ No newline at end of file
user_analytics @ 0bf6352a
Subproject commit 0bf6352ae01a5831b19ffcc74f1703f12a0d7623
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment