Commit f441d5d9 authored by Anggi Saputra's avatar Anggi Saputra

HAHA

parent c45d5dcf
...@@ -69,11 +69,6 @@ class UserController extends \Application\Master\GlobalActionController ...@@ -69,11 +69,6 @@ class UserController extends \Application\Master\GlobalActionController
$post = $this->getRequest()->getPost(); $post = $this->getRequest()->getPost();
$session = $this->getSession(); $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']; $username = $post['username'];
$password = $post['passwd']; $password = $post['passwd'];
......
...@@ -43,19 +43,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -43,19 +43,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/index-js/action-listdata.js'); $this->headScript->appendFile('/action-js/index-js/action-listdata.js');
return $view; return $view;
} }
// public function templateAction(){
// $view = new ViewModel();
// $this->layout("layout/login");
// return $view;
// }
public function dashboardAction(){ public function dashboardAction(){
$this->isLoggedIn(); $this->isLoggedIn();
...@@ -98,7 +89,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -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-pie2-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-pie-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/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-area-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-bar-demo.js'); $this->headScript->appendFile('/template/js/demo/chart-bar-demo.js');
$this->headScript->appendFile('/template/js/demo/chart-bar2-demo.js'); $this->headScript->appendFile('/template/js/demo/chart-bar2-demo.js');
...@@ -241,8 +232,8 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -241,8 +232,8 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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'); $this->headScript->appendFile('/template/js/demo/table-user-other.js');
//print_r($baseurl);die; //print_r($baseurl);die;
$this->layout()->token = $session_data->get('token'); $this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
...@@ -251,7 +242,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -251,7 +242,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
} }
public function userwebinfoAction(){ public function userwebinfoAction(){
$pagename = 'info user';
if($_GET['token'] == null){ if($_GET['token'] == null){
$this->redirect()->toRoute('home'); $this->redirect()->toRoute('home');
} }
...@@ -262,6 +253,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -262,6 +253,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
// $session_data->set() // $session_data->set()
$urltoken = $_GET['token']; $urltoken = $_GET['token'];
$session_data->put(null, array(
'pagename' => $pagename,
));
$view->setVariables(array( $view->setVariables(array(
'id_user' => $session_data->get('user_id'), 'id_user' => $session_data->get('user_id'),
...@@ -271,9 +265,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -271,9 +265,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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; //print_r($baseurl);die;
$this->layout()->token = $session_data->get('token'); $this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
...@@ -302,9 +297,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -302,9 +297,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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; //print_r($baseurl);die;
$this->layout()->token = $session_data->get('token'); $this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
...@@ -333,9 +328,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -333,9 +328,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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; //print_r($baseurl);die;
$this->layout()->token = $session_data->get('token'); $this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
...@@ -364,10 +359,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -364,10 +359,10 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
$this->layout('layout/menu'); $this->layout('layout/menu');
...@@ -395,9 +390,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -395,9 +390,9 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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; //print_r($baseurl);die;
$this->layout()->token = $session_data->get('token'); $this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
...@@ -410,6 +405,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -410,6 +405,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
if($_GET['token'] == null){ if($_GET['token'] == null){
$this->redirect()->toRoute('home'); $this->redirect()->toRoute('home');
} }
$view = new ViewModel(); $view = new ViewModel();
$uri = $this->getRequest()->getUri(); $uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost()); $baseurl = sprintf('//%s', $uri->getHost());
...@@ -422,17 +418,22 @@ class UseranalyticsController extends \Application\Master\GlobalActionController ...@@ -422,17 +418,22 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
'id_user' => $session_data->get('user_id'), 'id_user' => $session_data->get('user_id'),
'token' => $urltoken, 'token' => $urltoken,
)); ));
// print_r($urltoken); // print_r($urltoken);
$this->layout()->myParameter = $session_data->get('usernamed'); $this->layout()->myParameter = $session_data->get('usernamed');
//$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css'); //$this->headLink->appendStyleSheet('/template/vendor/fontawesome-free/css/fonts.css');
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"'); $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; //print_r($baseurl);die;
$this->layout()->token = $session_data->get('token'); $this->layout()->token = $session_data->get('token');
$this->layout()->webname = $session_data->get('websitename'); $this->layout()->webname = $session_data->get('websitename');
$this->layout('layout/menu'); $this->layout('layout/menu');
return $view; return $view;
} }
} }
...@@ -53,12 +53,12 @@ class Param extends Mapper { ...@@ -53,12 +53,12 @@ class Param extends Mapper {
$data = $this->_storage->loadChartData($id); $data = $this->_storage->loadChartData($id);
return $data; return $data;
} }
public function loadChartimage($id){ public function loadChartimage($idweb, $country, $province, $city){
$data = $this->_storage->loadChartDataimage($id); $data = $this->_storage->loadChartDataimage($idweb, $country, $province, $city);
return $data; return $data;
} }
public function loadChartbutton($id){ public function loadChartbutton($idweb, $country, $province, $city){
$data = $this->_storage->loadBarButtonData($id); $data = $this->_storage->loadBarButtonData($idweb, $country, $province, $city);
return $data; return $data;
} }
...@@ -66,6 +66,18 @@ class Param extends Mapper { ...@@ -66,6 +66,18 @@ class Param extends Mapper {
$data = $this->_storage->loadPieBrowserData($idweb); $data = $this->_storage->loadPieBrowserData($idweb);
return $data; 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){ public function loadTableUser($id){
$data = $this->_storage->loadTableUserData($id); $data = $this->_storage->loadTableUserData($id);
...@@ -178,6 +190,43 @@ class Param extends Mapper { ...@@ -178,6 +190,43 @@ class Param extends Mapper {
return $data; 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){ public function getnumbervisitor($idweb, $year){
$data = $this->_storage->loadnumbervisitor($idweb, $year); $data = $this->_storage->loadnumbervisitor($idweb, $year);
return $data; 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="row justify-content-center mt-4">
<div class="col-xl-5 col-lg-6 col-md-8"> <div class="col-xl-5 col-lg-6 col-md-8">
<div class="card o-hidden border-0 shadow-lg my-5"> <div class="card o-hidden border-0 shadow-lg my-5">
......
<!-- laskhdlkashdlkashdlksahd -->
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<!-- Custom styles for this template--> <!-- Custom styles for this template-->
<!-- <link href="<?php $this->basePath();?> /template/css/sb-admin-2.min.css" rel="stylesheet"> --> <!-- <link href="<?php $this->basePath();?> /template/css/sb-admin-2.min.css" rel="stylesheet"> -->
<!-- Outer Row -->
<div class="container-fluid"> <div class="container-fluid">
<div class="row justify-content-center" id="hui"> <div class="row justify-content-center" id="hui">
<div class="col-xl-5 col-lg-12 col-md-9" > <div class="col-xl-5 col-lg-12 col-md-9" >
......
...@@ -11,18 +11,21 @@ ...@@ -11,18 +11,21 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">Other Table</h1> <h1 class="h4 text-gray-900 mb-4">Other Table</h1>
</div> </div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebOther', 'W3C Example Table')" value="Download to Excel">
<div > <div >
<table class="table table-bordered" id="dataTable1" > <table class="table table-bordered" id="dataTableUserWebOther" >
<caption hidden>User Web Other Table</caption>
<thead> <thead>
<tr> <tr>
<!-- <th>No</th> --> <th style="width:50px">No</th>
<th>Nama Website</th> <th>IP Address User</th>
<th>Domain</th> <th>Name Other</th>
<th>Token</th> <th>Date Access</th>
<th>Action</th> <th>Time Access</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tbluserwebother">
<!-- tabel from website list action --> <!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
......
...@@ -11,18 +11,20 @@ ...@@ -11,18 +11,20 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Browser Table</h1> <h1 class="h4 text-gray-900 mb-4">User Web Browser Table</h1>
</div> </div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebBrowser', 'Table Browser')" value="Download to Excel">
<div > <div >
<table class="table table-bordered" id="dataTable1" > <table class="table table-bordered" id="dataTableUserWebBrowser" >
<caption hidden>User Web Browser Table</caption>
<thead> <thead>
<tr> <tr>
<!-- <th>No</th> --> <th style="width:50px">No</th>
<th>Nama Website</th> <th>IP Address User</th>
<th>Domain</th> <th>Browser</th>
<th>Token</th> <th>Browser Version</th>
<th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tbluserwebbrowser">
<!-- tabel from website list action --> <!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
......
...@@ -11,19 +11,21 @@ ...@@ -11,19 +11,21 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Button Table</h1> <h1 class="h4 text-gray-900 mb-4">User Web Button Table</h1>
</div> </div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebButton', 'Table Button')" value="Download to Excel">
<div > <div >
<table class="table table-bordered" id="dataTable1" > <table class="table table-bordered" id="dataTableUserWebButton" >
<caption hidden>User Web Button Table</caption>
<thead> <thead>
<tr> <tr>
<!-- <th>No</th> --> <th style="width:50px">No</th>
<th>Nama Website</th> <th>IP user</th>
<th>Domain</th> <th>Name Button</th>
<th>Token</th> <th>Date Access</th>
<th>Action</th> <th>Time Access</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tbluserwebbtn">
<!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
</div> </div>
......
...@@ -11,18 +11,21 @@ ...@@ -11,18 +11,21 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Image Table</h1> <h1 class="h4 text-gray-900 mb-4">User Web Image Table</h1>
</div> </div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebImage', 'Table Image')" value="Download to Excel">
<div > <div >
<table class="table table-bordered" id="dataTable1" > <table class="table table-bordered" id="dataTableUserWebImage" >
<caption hidden>User Web Image Table</caption>
<thead> <thead>
<tr> <tr>
<!-- <th>No</th> --> <!-- <th>No</th> -->
<th>Nama Website</th> <th style="width:50px">No</th>
<th>Domain</th> <th>IP Address User</th>
<th>Token</th> <th>Name Image</th>
<th>Action</th> <th>Date Access</th>
<th>Time Access</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tbluserwebimage">
<!-- tabel from website list action --> <!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
......
...@@ -11,21 +11,26 @@ ...@@ -11,21 +11,26 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Info Table</h1> <h1 class="h4 text-gray-900 mb-4">User Web Info Table</h1>
</div> </div>
<div > <input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableuserwebinfo', 'Table User Info')" value="Download to Excel">
<table class="table table-bordered" id="dataTable1" >
<div class="table-responsive">
<table class="table table-bordered" id="dataTableuserwebinfo" width="100%" cellspacing="0">
<caption hidden>User Web Info Table</caption>
<thead> <thead>
<tr> <tr>
<!-- <th>No</th> --> <th style="width:50px">No</th>
<th>No</th>
<th>IP Address Public</th>
<th>IP Address Client</th> <th>IP Address Client</th>
<th>Mac Address</th> <th>Mac Address</th>
<th>Location</th> <th>Location</th>
<th>Browser</th>
<th>IP Address Public</th>
<th>Date Visit</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tbluserwebinfo">
<!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
......
...@@ -11,19 +11,21 @@ ...@@ -11,19 +11,21 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Page Table</h1> <h1 class="h4 text-gray-900 mb-4">User Web Page Table</h1>
</div> </div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebPage', 'Table User Page')" value="Download to Excel">
<div > <div >
<table class="table table-bordered" id="dataTable1" > <table class="table table-bordered" id="dataTableUserWebPage" >
<caption hidden>User Web Page Table</caption>
<thead> <thead>
<tr> <tr>
<th>No</th> <th style="width:50px">No</th>
<th>IP User</th>
<th>Name Page</th> <th>Name Page</th>
<th>Date Access</th> <th>Date Access</th>
<th>Time Access</th> <th>Time Access</th>
<th>Total Time</th> <th>Total Time</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tabeluserwebpage">
<!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
</div> </div>
......
...@@ -11,18 +11,20 @@ ...@@ -11,18 +11,20 @@
<div class="text-center"> <div class="text-center">
<h1 class="h4 text-gray-900 mb-4">User Web Video Table</h1> <h1 class="h4 text-gray-900 mb-4">User Web Video Table</h1>
</div> </div>
<input class="btn btn-success" type="button" style="margin:10px; padding: 5px"onclick="tableToExcel('dataTableUserWebVideo', 'Table Video')" value="Download to Excel">
<div > <div >
<table class="table table-bordered" id="dataTable1" > <table class="table table-bordered" id="dataTableUserWebVideo" >
<caption hidden>User Web Video Table</caption>
<thead> <thead>
<tr> <tr>
<!-- <th>No</th> --> <th style="width:50px">No</th>
<th>Nama Website</th> <th>IP Address User</th>
<th>Domain</th> <th>Name Video</th>
<th>Token</th> <th>Date Access</th>
<th>Action</th> <th>Time Access</th>
</tr> </tr>
</thead> </thead>
<tbody id="tabeltoken"> <tbody id="tbluserwebvideo">
<!-- tabel from website list action --> <!-- tabel from website list action -->
</tbody> </tbody>
</table> </table>
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
if(defined('RUNNING_FROM_ROOT')){ if(defined('RUNNING_FROM_ROOT')){
$this->plugin('basePath')->setBasePath($this->basePath().'/public'); $this->plugin('basePath')->setBasePath($this->basePath().'/public');
} }
?> ?>
<html lang="en"> <html lang="en">
......
...@@ -4,8 +4,6 @@ Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,Bli ...@@ -4,8 +4,6 @@ Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,Bli
Chart.defaults.global.defaultFontColor = '#858796'; Chart.defaults.global.defaultFontColor = '#858796';
var config; var config;
function number_format(number, decimals, dec_point, thousands_sep) { function number_format(number, decimals, dec_point, thousands_sep) {
number = (number + '').replace(',', '').replace(' ', ''); number = (number + '').replace(',', '').replace(' ', '');
var n = !isFinite(+number) ? 0 : +number, var n = !isFinite(+number) ? 0 : +number,
...@@ -30,12 +28,16 @@ function number_format(number, decimals, dec_point, thousands_sep) { ...@@ -30,12 +28,16 @@ function number_format(number, decimals, dec_point, thousands_sep) {
} }
window.setInterval(function(){ window.setInterval(function(){
loaddatavisitor(); changefunct();
},60000); if($('#selectmonth').val()!='all month'){
changemonthfunc();
}
loaddatavisitor(); },6000);
loaddatavisitor(validasiToken);
function loaddatavisitor(){ function setnewload(token){
dates = new Date(); dates = new Date();
year = dates.getFullYear(); year = dates.getFullYear();
...@@ -46,7 +48,68 @@ function loaddatavisitor(){ ...@@ -46,7 +48,68 @@ function loaddatavisitor(){
async : false, async : false,
data : { data : {
year : year, 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){ success:function(result){
var data = result.data; var data = result.data;
...@@ -185,8 +248,6 @@ function loaddatavisitor(){ ...@@ -185,8 +248,6 @@ function loaddatavisitor(){
} }
} }
function changefunct(){ function changefunct(){
var selectyear = document.getElementById("selectyear"); var selectyear = document.getElementById("selectyear");
var selectedyear = selectyear.options[selectyear.selectedIndex].value; var selectedyear = selectyear.options[selectyear.selectedIndex].value;
...@@ -343,7 +404,7 @@ function loaddatavisitor(){ ...@@ -343,7 +404,7 @@ function loaddatavisitor(){
} }
loadselectfirst(validasiToken); loadselectfirst(validasiToken);
function loadselectfirst(tokeni){ function loadselectfirst(tokeni){x
$.ajax({ $.ajax({
type : "post", type : "post",
dataType : "JSON", dataType : "JSON",
...@@ -356,7 +417,7 @@ function loadselectfirst(tokeni){ ...@@ -356,7 +417,7 @@ function loadselectfirst(tokeni){
for (x in data){ for (x in data){
option = ''; 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); $('#selectyear').append(option);
} }
} }
...@@ -366,7 +427,7 @@ function loadselectfirst(tokeni){ ...@@ -366,7 +427,7 @@ function loadselectfirst(tokeni){
let year = dates.getFullYear(); let year = dates.getFullYear();
optionmonth = ''; optionmonth = '';
optionmonth += '<option>All Month</option>'; optionmonth += '<option value="all month">All Month</option>';
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
......
...@@ -2,8 +2,35 @@ ...@@ -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.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#858796'; 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); loadDataHalaman(validasiToken);
function loadDataHalaman(token){ function loadDataHalaman(token){
$(document).ready(function(){ $(document).ready(function(){
$.ajax({ $.ajax({
...@@ -11,7 +38,7 @@ function loadDataHalaman(token){ ...@@ -11,7 +38,7 @@ function loadDataHalaman(token){
dataType: 'json', dataType: 'json',
url: baseURL + '/api/loadcharthalaman', url: baseURL + '/api/loadcharthalaman',
data: { data: {
token : validasiToken token : token
}, },
success: function(result){ success: function(result){
if(result.code==0){ if(result.code==0){
...@@ -25,15 +52,14 @@ function loadDataHalaman(token){ ...@@ -25,15 +52,14 @@ function loadDataHalaman(token){
halaman[o] = data[o].name_page; halaman[o] = data[o].name_page;
jumlah[o] = data[o].count; jumlah[o] = data[o].count;
} }
// Bar Chart Example // Bar Chart Example
var ctx = document.getElementById("myBarChart");
var myBarChart = new Chart(ctx, { configpagebar = {
type: 'bar', type: 'bar',
data: { data: {
labels: halaman, labels: halaman,
datasets: [{ datasets: [{
label: "Jumlah", label: "Total",
backgroundColor: "#4e73df", backgroundColor: "#4e73df",
hoverBackgroundColor: "#2e59d9", hoverBackgroundColor: "#2e59d9",
borderColor: "#4e73df", borderColor: "#4e73df",
...@@ -107,44 +133,165 @@ function loadDataHalaman(token){ ...@@ -107,44 +133,165 @@ function loadDataHalaman(token){
} }
}, },
} }
}); }
var ctx = document.getElementById("myBarChart").getContext("2d");
window.myBarpage = getNewChart(ctx, configpagebar);
}else{ }else{
alert(result.info); 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, ',', ' '); loadselectfirstpage(validasiToken);
// * return: '1 234,56' function loadselectfirstpage(tokeni){
number = (number + '').replace(',', '').replace(' ', ''); option = '';
var n = !isFinite(+number) ? 0 : +number, $.ajax({
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), type : "post",
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dataType : "JSON",
dec = (typeof dec_point === 'undefined') ? '.' : dec_point, url : baseURL + "/api/loadcountry",
s = '', data : {
toFixedFix = function(n, prec) { token : tokeni
var k = Math.pow(10, prec); },
return '' + Math.round(n * k) / k; success:function(result){
}; let data = result.data;
// Fix for IE parseFloat(0.55).toFixed(0) = 0; option = '';
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); option += `<option value=''>All Country</option>`
if (s[0].length > 3) { for (x in data){
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); option += `<option value = `+data[x]['country']+`>`+data[x]['country']+`</option>`
} }
if ((s[1] || '').length < prec) { $('#selectcountrypage').html(option);
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
} }
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){ ...@@ -37,6 +37,9 @@ function loaddatabutton(token){
url : baseURL + '/api/loadbutton', url : baseURL + '/api/loadbutton',
data :{ data :{
token : token, token : token,
country : null,
province: null,
city : null
}, },
success:function(result){ success:function(result){
let data = result.data; let data = result.data;
...@@ -49,8 +52,7 @@ function loaddatabutton(token){ ...@@ -49,8 +52,7 @@ function loaddatabutton(token){
} }
// console.log(total); // console.log(total);
var ctx = document.getElementById("myBarChart2"); var configbutton= {
var myBarChart = new Chart(ctx, {
type: 'bar', type: 'bar',
data: { data: {
labels: button, labels: button,
...@@ -129,11 +131,153 @@ function loaddatabutton(token){ ...@@ -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"); ...@@ -7,6 +7,16 @@ var ctx = document.getElementById("myPieChart").getContext("2d");
window.myPie = getNewChart(ctx, configpiebw); 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){ function loaddatabrowser(tokeni){
dates = new Date(); dates = new Date();
year = dates.getFullYear(); year = dates.getFullYear();
...@@ -32,7 +42,6 @@ function loaddatabrowser(tokeni){ ...@@ -32,7 +42,6 @@ function loaddatabrowser(tokeni){
} }
}, },
}); });
configpiebw = { configpiebw = {
type: 'pie', type: 'pie',
data: { data: {
...@@ -63,27 +72,14 @@ function loaddatabrowser(tokeni){ ...@@ -63,27 +72,14 @@ function loaddatabrowser(tokeni){
}, },
} }
let colour = ['primary','success','info','warning','secondary']; var colour = ['primary','success','info','warning','secondary'];
for(y in label){
var cols = ""; var cols = "";
for(y in label){
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+label[y]+'</span>'; 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) { function getNewChart(canvas, configpiebw) {
...@@ -91,22 +87,153 @@ function getNewChart(canvas, configpiebw) { ...@@ -91,22 +87,153 @@ function getNewChart(canvas, configpiebw) {
} }
loadloc(validasiToken); loadselectfirst(validasiToken);
function loadloc(tokeni){ function loadselectfirst(tokeni){
option = ''; option = '';
$.ajax({ $.ajax({
type : "post", type : "post",
dataType : "JSON", dataType : "JSON",
url : baseURL + "/api/loadyear", url : baseURL + "/api/loadcountry",
data : { data : {
token : tokeni token : tokeni
}, },
success:function(result){ success:function(result){
let data = result.data; let data = result.data;
option = '';
option += `<option value=''>All Country</option>`
for (x in data){ for (x in data){
option += `<option>`+data[x]['date_part']+`</option>` option += `<option value = `+data[x]['country']+`>`+data[x]['country']+`</option>`
$('#selectloct').append(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'; ...@@ -4,33 +4,31 @@ Chart.defaults.global.defaultFontColor = '#858796';
$("#websiteName").html(websitetitle); $("#websiteName").html(websitetitle);
LoadDadta(validasiToken); LoadDadta(validasiToken);
function LoadDadta(token){ function LoadDadta(token){
$(document).ready(function(){
/* save data */ /* save data */
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
url: baseURL + '/api/loadchartimage', url: baseURL + '/api/loadchartimage',
data: { data: {
token : validasiToken, token : token,
country : null,
province: null,
city : null
}, },
success: function(result){ success: function(result){
console.log(result); // console.log(result);
if(result.code == 0){
let data = result.data; let data = result.data;
var image_name = []; var image_name = [];
let jumlah = []; let jumlah = [];
//let counter = 0;
for(x in data){ for(x in data){
image_name[x] = data[x].nodeimage; image_name[x] = data[x].nodeimage;
jumlah[x] = data[x].count; jumlah[x] = data[x].count;
} }
var ctx = document.getElementById("myPieChart4"); var configimage = {
var myPieChart = new Chart(ctx, {
type: 'pie', type: 'pie',
data: { data: {
labels: image_name, labels: image_name,
...@@ -58,7 +56,10 @@ LoadDadta(validasiToken); ...@@ -58,7 +56,10 @@ LoadDadta(validasiToken);
}, },
cutoutPercentage: 0, cutoutPercentage: 0,
}, },
}); };
var ctx = document.getElementById("myPieChart4").getContext("2d");
window.myPieImage = getNewChart(ctx, configimage);
let colour = ['primary','success','info','warning','secondary']; let colour = ['primary','success','info','warning','secondary'];
...@@ -67,14 +68,162 @@ LoadDadta(validasiToken); ...@@ -67,14 +68,162 @@ LoadDadta(validasiToken);
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+image_name[y]+'</span>'; cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+image_name[y]+'</span>';
$('#infoChartImage').append(cols); $('#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) { success:function(result){
alert(xhr.status+'-'+xhr.statusText); 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