Commit bee27786 authored by reynaldi adriantama's avatar reynaldi adriantama
parents d7822202 f441d5d9
......@@ -266,7 +266,11 @@ class ApiController extends \Application\Master\GlobalActionController {
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$loadimage = $test->loadChartimage($idweb);
$country = $post->country;
$province = $post->province;
$city = $post->city;
$loadimage = $test->loadChartimage($idweb, $country, $province, $city);
if($loadimage->code == 0){
$result->code = $result::CODE_SUCCESS;
......@@ -293,10 +297,14 @@ class ApiController extends \Application\Master\GlobalActionController {
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$country = $post->country;
$province = $post->province;
$city = $post->city;
$loadbutton = $test->loadChartbutton($idweb, $country, $province, $city);
$loadbutton = $test->loadChartbutton($idweb);
// print_r($loadbutton);die;
if($loadbutton->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
......@@ -976,7 +984,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
if($ipaddress){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
......@@ -1291,6 +1299,369 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function loadtablepageAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$loadTablePage = $test->getTablePage($idweb);
if($loadTablePage->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadTablePage->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadtablebuttonAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$loadTableButton = $test->getTableButton($idweb);
if($loadTableButton->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadTableButton->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadtablebrowserAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$loadTableBrowser = $test->getTableBrowser($idweb);
if($loadTableBrowser->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadTableBrowser->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadtablevideoAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$loadTableVideo = $test->getTableVideo($idweb);
if($loadTableVideo->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadTableVideo->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadtableimageAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$loadTableImage = $test->getTableImage($idweb);
if($loadTableImage->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadTableImage->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadtableotherAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$loadTableOther = $test->getTableOther($idweb);
if($loadTableOther->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadTableOther->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadcountryAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
// print_r($idweb);die;
$loadcountry = $test->getcountry($idweb);
if($loadcountry->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadcountry->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadprovinceAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$country = $post->country;
$loadprovince = $test->getprovince($idweb, $country);
// print_r($idweb);die;
// $loadcountry = $test->getcountry($idweb);
if($loadprovince->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadprovince->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadcityAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$country = $post->country;
$province = $post->province;
$loadcity = $test->getcity($idweb, $country, $province);
if($loadcity){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadcity->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadbrowserbylocatAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$country = $post->country;
$province = $post->province;
$city = $post->city;
// print_r($idweb);die;
$loadbrowser = $test->getbrowserbylocat($idweb, $city, $province, $country);
if($loadbrowser){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadbrowser->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadpagebylocatAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$country = $post->country;
$province = $post->province;
$city = $post->city;
// print_r($idweb);die;
$loadhalaman = $test->getpagebylocat($idweb, $city, $province, $country);
if($loadhalaman){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadhalaman->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadvisitorbytimeAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$token = $post->token;
$web = $test->getweb($token);
$idweb = $web->data[0]['id_web'];
$year = $post->year;
$month = $post->month;
$country = $post->country;
$province = $post->province;
$loadvisitorbytime = $test->getvisitorbytime($idweb, $year, $month, $province, $country);
// print_r($loadvisitorbytime);die;
if($loadvisitorbytime){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $loadvisitorbytime->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
}
......
......@@ -68,19 +68,14 @@ 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'];
$storage = \Khansia\Access\User\Storage::factory($this->getDb(), $this->getConfig());
$user = new \Khansia\Access\User($storage);
if($user->load($username, \Khansia\Access\User\Storage::LOADBY_CODE)){ // sukses load then
$authResult = $user->authenticate($password, null, \Khansia\Access\User::RETRIES_TRUE);
......
......@@ -41,21 +41,12 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$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;
}
// 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,10 +405,11 @@ 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());
$session_data = $this->getSession();
$session_data = $this->getSession();
// $session_data->set()
$urltoken = $_GET['token'];
......@@ -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;
......
......@@ -404,19 +404,31 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result;
}
public function loadChartDataimage($idweb){
public function loadChartDataimage($idweb, $country, $province, $city){
$result = new Result();
try {
$sql = " SELECT ui.nodeimage, ud.id_image, count(*) FROM userweb_detailimage ud
INNER JOIN userweb_image ui
ON ui.id_image = ud.id_image
INNER JOIN userweb_info uin
ON uin.id_user = ud.id_user
WHERE uin.id_web = $idweb
GROUP BY ud.id_image, ui.id_image
$sql = "SELECT ui.nodeimage, count(*) FROM userweb_detailimage ud
INNER JOIN userweb_image ui
ON ui.id_image = ud.id_image
INNER JOIN userweb_info uin
ON uin.id_user = ud.id_user
INNER JOIN userweb_location ulo
ON ulo.id_location = uin.id_location
WHERE uin.id_web = $idweb";
if($country && $province && $city){
$sql .= "AND ulo.country = '$country' AND ulo.province='$province' AND ulo.city='$city'";
}else if ($country && $province){
$sql .= "AND ulo.country = '$country' AND ulo.province='$province'";
}else if($country){
$sql .= "AND ulo.country = '$country'";
}
$sql .= "GROUP BY ud.id_image, ui.id_image
ORDER BY count DESC
LIMIT 5";
// print_r($sql);die;
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
......@@ -451,7 +463,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT ui.ip_address_client, ui.mac_address, ul.city, ub.browser_name, ui.ip_address_public, ui.date_first_visit FROM userweb_info ui
$sql = " SELECT ui.id_user, ui.ip_address_client, ui.mac_address, ul.city, ub.browser_name, ui.ip_address_public, ui.date_first_visit FROM userweb_info ui
INNER JOIN userweb_browser ub
ON ub.id_browser = ui.id_browser
INNER JOIN userweb_location ul
......@@ -489,7 +501,384 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
}
public function loadtablepage($idweb){
$result = new Result();
try {
$sql = "SELECT ui.ip_address_client ,up.name_page , ud.date_access, ud.time_access, ud.total_time FROM userweb_detailpage ud
INNER JOIN userweb_info ui
ON ui.id_user = ud.id_user
INNER JOIN userweb_page up
ON up.id_page = ud.id_page
WHERE up.id_web = $idweb
ORDER BY ud. date_access DESC, ud.time_access DESC";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadtablebutton($idweb){
$result = new Result();
try {
$sql = "SELECT ui.ip_address_client, ub.nodebtn, ud.date, ud.time from userweb_detailbutton ud
INNER JOIN userweb_info ui
ON ui.id_user = ud.id_user
INNER JOIN userweb_button ub
ON ub.id_btn = ud.id_btn
WHERE ui.id_web = $idweb
ORDER BY ud.date DESC, ud.time DESC";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadtablebrowser($idweb){
$result = new Result();
try {
$sql = "SELECT ui.ip_address_client ,ub.browser_name, ub.browser_ver FROM userweb_info ui
INNER JOIN userweb_browser ub
ON ui.id_browser = ub.id_browser
WHERE ui.id_web = $idweb
ORDER BY ui.date_first_visit DESC";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadtablevideo($idweb){
$result = new Result();
try {
$sql = "SELECT ui.ip_address_client, uv.nodevideo, ud.date, ud.time FROM userweb_detailvideo ud
INNER JOIN userweb_info ui
ON ui.id_user = ud.id_user
INNER JOIN userweb_video uv
ON uv.id_video = ud.id_video
WHERE ui.id_web = $idweb
ORDER BY ud.date DESC, ud.time DESC";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadtableimage($idweb){
$result = new Result();
try {
$sql = "SELECT ui.ip_address_client, uim.nodeimage, ud.date, ud.time FROM userweb_detailimage ud
INNER JOIN userweb_info ui
ON ui.id_user = ud.id_user
INNER JOIN userweb_image uim
ON uim.id_image= ud.id_image
WHERE ui.id_web = $idweb
ORDER BY ud.date DESC, ud.time DESC";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadtableother($idweb){
$result = new Result();
try {
$sql = "SELECT ui.ip_address_client, uo.nodeother, ud.date, ud.time FROM userweb_detailother ud
INNER JOIN userweb_info ui
ON ui.id_user = ud.id_user
INNER JOIN userweb_other uo
ON uo.id_other= ud.id_other
WHERE ui.id_web = $idweb
ORDER BY ud.date DESC, ud.time DESC";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadcountry($idweb){
$result = new Result();
try {
$sql = "SELECT ul.country FROM userweb_info ui
INNER JOIN userweb_location ul
ON ul.id_location = ui.id_location
WHERE ui.id_web = $idweb
GROUP BY ul.country";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadprovince($idweb, $country){
$result = new Result();
try {
$sql = "SELECT ul.province FROM userweb_info ui
INNER JOIN userweb_location ul
ON ul.id_location = ui.id_location
WHERE ui.id_web = $idweb AND ul.country='$country'
GROUP BY ul.province";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadcity($idweb, $country, $city){
$result = new Result();
try {
$sql = "SELECT ul.city FROM userweb_info ui
INNER JOIN userweb_location ul
ON ul.id_location = ui.id_location
WHERE ui.id_web = $idweb AND ul.country='$country' AND ul.province='$city'
GROUP BY ul.city";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadAreaPengunjungData($id = null){
$result = new Result();
......@@ -543,6 +932,8 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
ON ud.id_page = up.id_page
WHERE up.id_web = $idweb
GROUP BY ud.id_page, up.id_page
ORDER BY count DESC
LIMIT 5
";
//print_r($sql);die;
......@@ -576,21 +967,31 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result;
}
public function loadBarButtonData($idweb){
public function loadBarButtonData($idweb, $country, $province, $city){
$result = new Result();
try {
$sql = "SELECT ui.nodebtn, ud.id_btn, count(*) FROM userweb_detailbutton ud
$sql = "SELECT ui.nodebtn, count(*) FROM userweb_detailbutton ud
INNER JOIN userweb_button ui
ON ui.id_btn = ud.id_btn
INNER JOIN userweb_info uin
ON uin.id_user = ud.id_user
WHERE uin.id_web = $idweb
GROUP BY ud.id_btn, ui.id_btn
ORDER BY count DESC
LIMIT 6";
INNER JOIN userweb_location ulo
ON ulo.id_location = uin.id_location
WHERE uin.id_web = $idweb";
if($country && $province && $city){
$sql .= "AND ulo.country = '$country' AND ulo.province='$province' AND ulo.city='$city'";
}else if ($country && $province){
$sql .= "AND ulo.country = '$country' AND ulo.province='$province'";
}else if($country){
$sql .= "AND ulo.country = '$country'";
}
$sql .= "GROUP BY ud.id_btn, ui.id_btn
ORDER BY count DESC
LIMIT 6";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
......@@ -1588,7 +1989,8 @@ public function loadPieBrowserData($idweb){
INNER JOIN userweb_browser ub
ON ui.id_browser = ub.id_browser
WHERE ui.id_web = $idweb
GROUP BY ub.browser_name ";
GROUP BY ub.browser_name
LIMIT 5";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
......@@ -1692,4 +2094,173 @@ public function loadvisitorbymonth($idweb, $year, $month){
}
public function loadbrowserbylocat($idweb, $city, $province, $country){
$result = new Result();
try {
$sql = "SELECT ub.browser_name, count(*) AS total FROM userweb_info ui
INNER JOIN userweb_browser ub
ON ui.id_browser = ub.id_browser
INNER JOIN userweb_location ul
ON ui.id_location = ul.id_location
WHERE ui.id_web = $idweb";
if($country && $province && $city){
$sql .= "AND ul.country = '$country' AND ul.province='$province' AND ul.city='$city'";
}else if ($country && $province){
$sql .= "AND ul.country = '$country' AND ul.province='$province'";
}else if($country){
$sql .= "AND ul.country = '$country'";
}
$sql .= "GROUP BY ub.browser_name
ORDER BY total DESC
LIMIT 5";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadpagebylocat($idweb, $city, $province, $country){
$result = new Result();
try {
$sql = "SELECT up.name_page, count(*) FROM userweb_detailpage ud
INNER JOIN userweb_page up
ON ud.id_page = up.id_page
INNER JOIN userweb_info ui
ON ud.id_user = ui.id_user
INNER JOIN userweb_location ul
ON ui.id_location = ul.id_location
WHERE ui.id_web = $idweb";
if($country && $province && $city){
$sql .= "AND ul.country = '$country' AND ul.province='$province' AND ul.city='$city'";
}else if ($country && $province){
$sql .= "AND ul.country = '$country' AND ul.province='$province'";
}else if($country){
$sql .= "AND ul.country = '$country'";
}
$sql .= "GROUP BY up.id_page
ORDER BY count DESC
LIMIT 5";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadvisitorbytime($idweb, $year, $month, $province, $country){
$result = new Result();
try {
if( $province && $country){
$sql = "SELECT userweb_location.city as location,";
}else if($country){
$sql = "SELECT userweb_location.province as location,";
}else{
$sql = "SELECT userweb_location.country as location,";
}
$sql .= "count(userweb_info.id_location) as total FROM userweb_info
INNER JOIN userweb_location
ON userweb_location.id_location=userweb_info.id_location
WHERE userweb_info.id_web = $idweb";
if($year && $month ){
$sql .= "AND EXTRACT(MONTH FROM userweb_info.date_first_visit) = $month AND EXTRACT(YEAR FROM userweb_info.date_first_visit) = $year";
}else if ($year){
$sql .= "AND EXTRACT(YEAR FROM userweb_info.date_first_visit) = $year";
}
if($province && $country){
$sql .= "AND userweb_location.country = '$country' AND userweb_location.province='$province'";
}else if ($country){
$sql .= "AND userweb_location.country='$country'";
}
$sql .= "GROUP BY location
ORDER BY total desc
limit 5";
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
}
<!-- <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
<div class="container-fluid">
<!-- <div class="d-sm flex align-items-center justify-content-center mb-4">
<h1 id="websiteName" style="padding-top: 20px" class="d-flex justify-content-center">NAMA WEBSITE </h1> -->
<!-- <div class="form-group">
<label for="sel1">Select website: </label>
<select class="form-control" id="sel1">
<option>Website 1</option>
<option>website 2</option>
<option>website 3</option>
<option>website 4</option>
</select>
</div> -->
<!-- </div> -->
<div class="d-sm-flex align-items-center justify-content-between mb-4 mt-4">
<h1 id="websiteName" class="h3 mb-0 text-gray-800">Dashboard</h1>
......@@ -99,13 +88,13 @@
<!-- </div> -->
<!-- Content Row -->
<div class="row">
<!-- Number of Visitor Chart -->
<div class="col-xl-7 col-lg-7">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary" id="totVisitor"></h6>
<div class="card-header py-3 align-items-center justify-content-between">
<h6 class=" font-weight-bold text-primary" id="totVisitor"></h6>
<div class="dropdown no-arrow">
<label style="font-size:10px" >Year :</label>
<select id='selectyear' class="custom-select" onChange="changefunct()" style="width:90px; height:25px; font-size:10px" >
......@@ -127,34 +116,84 @@
</div>
</div>
<!-- Browsesr Chart -->
<!-- Visitor Location chart -->
<div class="col-xl-5 col-lg-6">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Browser</h6>
<!-- <div class="dropdown no-arrow">
<a id="dropdown" class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<select id='selectloct' class="custom-select" style="width:80px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select> -->
<!-- </div> -->
<div class="card-header py-3 align-items-center justify-content-between">
<div class="dropdown no-arrow">
<table>
<tr style='border-bottom: solid #f8f9fc 15px;'>
<td colspan='9' class="font-weight-bold text-primary" id="visitorLocation">Visitor Location</td>
</tr>
<tr style='border-bottom: solid #f8f9fc 10px;'>
<td>
<label style="font-size:10px" >Year</label>
</td>
<td>
<label style="font-size:10px" > :</label>
</td>
<td>
<select id='selectyearvisit' class="custom-select" style="width:90px; height:28px; font-size:10px" >
<optgroup label="Year"> </optgroup>
</select>
</td>
<td>
<label style="font-size:10px" >Month</label>
</td>
<td>
<label style="font-size:10px" >:</label>
</td>
<td colspan='4'>
<select id='selectmonthvisit' class="custom-select" style="width:90px; height:28px; font-size:10px">
<optgroup label="Month"></optgroup>
</select>
</td>
</tr>
<tr>
<td>
<label style="font-size:10px" >Country</label>
</td>
<td>
<label style="font-size:10px" >:</label>
</td>
<td>
<select id='selectcountryvl' class="custom-select" style="width:100px; height:28px; font-size:10px">
<optgroup label="Country"></optgroup>
</select>
</td>
<td>
<label style="font-size:10px" >Provin</label>
</td>
<td>
<label style="font-size:10px" >:</label>
</td>
<td>
<select id='selectprovincevl' class="custom-select" style="width:100px; height:28px; font-size:10px">
<optgroup label="Province">
</optgroup>
</select>
</td>
</tr>
</table>
</div>
</div>
<!-- Card Body -->
<div class="card-body border-bottom-info">
<div class="chart-pie pt-4 pb-2">
<canvas id="myPieChart"></canvas>
<canvas id="myPieChart2"></canvas>
</div>
<div class="mt-4 text-center small" id="infoChartBrowser">
<div class="mt-4 text-center small" id="infoChartLokasi">
<!-- info kota dinamis -->
</div>
</div>
</div>
</div>
</div>
<!-- Content Row -->
......@@ -164,19 +203,24 @@
<div class="col-xl-7 col-lg-5">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary" id="pageVisit">Page Visits</h6>
<div class="card-header py-3 align-items-center justify-content-between">
<h6 class=" font-weight-bold text-primary">Page Visit</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Lokasi :</div>
<a class="dropdown-item" href="#">Kota 1</a>
<a class="dropdown-item" href="#">Kota 2</a>
<a class="dropdown-item" href="#">Kota 4</a>
<a class="dropdown-item" href="#">Kota 5</a>
</div>
<label style="font-size:10px" >Country :</label>
<select id='selectcountrypage' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Country">
</optgroup>
</select>
<label style="font-size:10px" >Provin :</label>
<select id='selectprovincepage' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
<label style="font-size:10px" >City :</label>
<select id='selectcitypage' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
</div>
</div>
<!-- Card Body -->
......@@ -188,88 +232,68 @@
</div>
</div>
<!-- Visitor Location chart -->
<!-- Browsesr Chart -->
<div class="col-xl-5 col-lg-6">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary" id="visitorLocation">Visitor Location</h6>
<div class="card-header py-3 align-items-center justify-content-between">
<h6 class=" font-weight-bold text-primary">Browser</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Dropdown Header:</div>
<a class="dropdown-item" href="#">Kota</a>
<a class="dropdown-item" href="#">Provinsi</a>
<a class="dropdown-item" href="#">Negara</a>
</div>
<label style="font-size:10px" >Country :</label>
<select id='selectcountry' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Country">
</optgroup>
</select>
<label style="font-size:10px" >Provin :</label>
<select id='selectprovince' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
<label style="font-size:10px" >City :</label>
<select id='selectcity' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
</div>
</div>
<!-- Card Body -->
<div class="card-body border-bottom-info">
<div class="chart-pie pt-4 pb-2">
<canvas id="myPieChart2"></canvas>
<canvas id="myPieChart"></canvas>
</div>
<div class="mt-4 text-center small" id="infoChartLokasi">
<!-- info kota dinamis -->
<div class="mt-4 text-center small" id="infoChartBrowser">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!-- progress -->
<!-- <div class="col-xl-4 col-lg-7">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Image View</h6>
</div>
<div class="card-body">
<h4 class="small font-weight-bold">Server Migration <span class="float-right">20%</span></h4>
<div class="progress mb-4">
<div class="progress-bar bg-danger" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<h4 class="small font-weight-bold">Server Migration <span class="float-right">20%</span></h4>
<div class="progress mb-4">
<div class="progress-bar bg-danger" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<h4 class="small font-weight-bold">Sales Tracking <span class="float-right">40%</span></h4>
<div class="progress mb-4">
<div class="progress-bar bg-warning" role="progressbar" style="width: 40%" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<h4 class="small font-weight-bold">Customer Database <span class="float-right">60%</span></h4>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 60%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<h4 class="small font-weight-bold">Payout Details <span class="float-right">80%</span></h4>
<div class="progress mb-4">
<div class="progress-bar bg-info" role="progressbar" style="width: 80%" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<h4 class="small font-weight-bold">Account Setup <span class="float-right">Complete!</span></h4>
<div class="progress mb-4">
<div class="progress-bar bg-success" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
</div> -->
<div class="col-xl-4 col-lg-6">
<div class="row">
<div class="col-xl-5 col-lg-6">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary" id="visitorLodwdwcation">Image View</h6>
<div class="card-header py-3 align-items-center justify-content-between">
<h6 class=" font-weight-bold text-primary" id="visitorLodwdwcation">Image View</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Dropdown Header:</div>
<a class="dropdown-item" href="#">Kota</a>
<a class="dropdown-item" href="#">Provinsi</a>
<a class="dropdown-item" href="#">Negara</a>
</div>
<label style="font-size:10px" >Country :</label>
<select id='selectcountryimage' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Country">
</optgroup>
</select>
<label style="font-size:10px" >Provin :</label>
<select id='selectprovinceimage' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
<label style="font-size:10px" >City :</label>
<select id='selectcityimage' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
</div>
</div>
<!-- Card Body -->
......@@ -287,22 +311,27 @@
<!-- ButtonClicks -->
<div class="col-xl-8 col-lg-6">
<div class="col-xl-7 col-lg-6">
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary" id="buttonClicks">Button Clicks</h6>
<div class="card-header py-3 align-items-center justify-content-between">
<h6 class=" font-weight-bold text-primary" id="buttonClicks">Button Clicks</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Lokasi :</div>
<a class="dropdown-item" href="#">Kota 1</a>
<a class="dropdown-item" href="#">Kota 2</a>
<a class="dropdown-item" href="#">Kota 4</a>
<a class="dropdown-item" href="#">Kota 5</a>
</div>
<label style="font-size:10px" >Country :</label>
<select id='selectcountrybutton' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Country">
</optgroup>
</select>
<label style="font-size:10px" >Provin :</label>
<select id='selectprovincebutton' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
<label style="font-size:10px" >City :</label>
<select id='selectcitybutton' class="custom-select" style="width:90px; height:25px; font-size:10px">
<optgroup label="Location">
</optgroup>
</select>
</div>
</div>
<!-- Card Body -->
......@@ -339,10 +368,11 @@
<th>Date Visit</th>
</tr>
</thead>
<tbody id="tbluser">
<tbody id="tbluserwebinfo">
</tbody>
</table>
<a target="_blank" href="<?php $this->basePath()?>/useranalytics/printdata">EXPORT KE EXCEL</a>
</div>
</div>
</div>
......
......@@ -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,23 +11,28 @@
<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" >
<thead>
<tr>
<!-- <th>No</th> -->
<th>No</th>
<th>IP Address Public</th>
<th>IP Address Client</th>
<th>Mac Address</th>
<th>Location</th>
</tr>
</thead>
<tbody id="tabeltoken">
<!-- tabel from website list action -->
</tbody>
</table>
</div>
<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 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="tbluserwebinfo">
</tbody>
</table>
</div>
</div>
</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);
}
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>`
}
$('#selectcountrypage').html(option);
}
});
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();
}
});
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);
}
......@@ -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,50 +72,168 @@ function loaddatabrowser(tokeni){
},
}
let colour = ['primary','success','info','warning','secondary'];
var colour = ['primary','success','info','warning','secondary'];
var cols = "";
for(y in label){
var cols = "";
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+label[y]+'</span>';
$('#infoChartBrowser').append(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();
$('#infoChartBrowser').html(cols);
}
function getNewChart(canvas, configpiebw) {
return new Chart(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);
}
});
}
\ No newline at end of file
});
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);
}
});
}
......@@ -4,78 +4,350 @@ Chart.defaults.global.defaultFontColor = '#858796';
$("#websiteName").html(websitetitle);
LoadDadta(validasiToken);
function LoadDadta(token){
$(document).ready(function(){
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadchart',
data: {
token : validasiToken,
},
success: function(result){
if(result.code == 0){
let data = result.data;
var nama_kota = [];
let jumlah = [];
//let counter = 0;
for(x in data){
nama_kota[x] = data[x].city;
jumlah[x] = data[x].sumlocation;
}
// console.log(nama_kota);
// console.log(jumlah);
var ctx = document.getElementById("myPieChart2");
var myPieChart = new Chart(ctx, {
function LoadDadta(token){
$(document).ready(function(){
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadvisitorbytime',
data: {
token : token,
year : null,
month : null,
country : null,
province : null
},
success: function(result){
if(result.code == 0){
let data = result.data;
var location = [];
let jumlah = [];
//let counter = 0;
for(x in data){
location[x] = data[x].location;
jumlah[x] = data[x].total;
}
var myPieChart = {
type: 'pie',
data: {
labels: nama_kota,
labels: location,
datasets: [{
data: jumlah,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#ffd700', '#c5c5c5'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
data: jumlah,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#ffd700', '#c5c5c5'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: false
display: false
},
cutoutPercentage: 0,
},
});
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> '+nama_kota[y]+'</span>';
$('#infoChartLokasi').append(cols);
}
}
var ctx = document.getElementById("myPieChart2").getContext("2d");
window.myVisitorPie = getNewChart(ctx, myPieChart);
var colour = ['primary','success','info','warning','secondary'];
var cols = "";
for(y in location){
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+location[y]+'</span>';
}
$('#infoChartLokasi').html(cols);
$('#visitorLocation').html('Visitor Location Country');
}else{
alert(result.info);
}
},
error: function(xhr) {
alert(xhr.status+'-'+xhr.statusText);
}
});
},
error: function(xhr) {
alert(xhr.status+'-'+xhr.statusText);
}
});
});
}
loadselectfirst(validasiToken);
function loadselectfirst(tokeni){
$.ajax({
type : "post",
dataType : "JSON",
url : baseURL + "/api/loadyear",
data : {
token : tokeni
},
success:function(result){
let data = result.data;
option = '';
option += `<option value=''>All Year</option>`
for (x in data){
option += `<option value='`+data[x]['date_part']+`'>`+data[x]['date_part']+`</option>`;
}
$('#selectyearvisit').html(option);
}
});
let dates = new Date();
let year = dates.getFullYear();
optionmonth = '';
optionmonth += '<option value="">All Month</option>';
$.ajax({
type : 'POST',
dataType : 'JSON',
url : baseURL + "/api/loadvisitormonth",
async : false,
data : {
year : year,
token : validasiToken
},
success:function(result){
let data = result.data;
var month = [];
for(x in data){
month[x] = data[x]['month']
if(month[x]==1){
month[x]='Jan';
}else if(month[x]==2){
month[x]='Feb';
}else if(month[x]==3){
month[x]='Mar';
}else if(month[x]==4){
month[x]='April';
}else if(month[x]==5){
month[x]='May';
}else if(month[x]==6){
month[x]='Jun';
}else if(month[x]==7){
month[x]='Jul';
}else if(month[x]==8){
month[x]='Aug';
}else if(month[x]==9){
month[x]='Sept';
}else if(month[x]==10){
month[x]='Oct';
}else if(month[x]==11){
month[x]='Nov';
}else if(month[x]==12){
month[x]='Dec';
}
optionmonth += `<option value='`+data[x]['month']+`'>`+month[x]+`</option>`;
$('#selectmonthvisit').html(optionmonth);
}
}
});
}
$('#selectyearvisit').change(function(){
let selectyear = $('#selectyearvisit').val();
let selectmonth = $('#selectmonthvisit').val();
let country = $('#selectcountryvl').val();
let province = $('#selectprovincevl').val();
optionmonth = '';
optionmonth += `<option value=''>All Month</option>`;
$.ajax({
type : 'POST',
dataType : 'JSON',
url : baseURL + "/api/loadvisitormonth",
async : false,
data : {
year : selectyear,
token : validasiToken
},
success:function(result){
let data = result.data;
var month = [];
for(x in data){
month[x] = data[x]['month']
if(month[x]==1){
month[x]='Januari';
}else if(month[x]==2){
month[x]='Februari';
}else if(month[x]==3){
month[x]='Maret';
}else if(month[x]==4){
month[x]='April';
}else if(month[x]==5){
month[x]='Mei';
}else if(month[x]==6){
month[x]='Juni';
}else if(month[x]==7){
month[x]='Juli';
}else if(month[x]==8){
month[x]='Agustus';
}else if(month[x]==9){
month[x]='September';
}else if(month[x]==10){
month[x]='Oktober';
}else if(month[x]==11){
month[x]='November';
}else if(month[x]==12){
month[x]='Desember';
}
optionmonth += `<option value='`+data[x]['month']+`'>`+month[x]+`</option>`;
$('#selectmonthvisit').html(optionmonth);
}
}
});
changevistorbytime(selectyear, selectmonth, country, province);
});
$('#selectmonthvisit').change(function(){
let selectyear = $('#selectyearvisit').val();
let selectmonth = $('#selectmonthvisit').val();
let country = $('#selectcountryvl').val();
let province = $('#selectprovincevl').val();
changevistorbytime(selectyear, selectmonth, country, province);
});
loadselectfirstvl(validasiToken);
function loadselectfirstvl(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>`
}
$('#selectcountryvl').html(option);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovincevl').html(optionprov);
}
$('#selectcountryvl').change(function(){
let country = $('#selectcountryvl').val();
let province = $('#selectprovincevl').val();
let selectyear = $('#selectyearvisit').val();
let selectmonth = $('#selectmonthvisit').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>`
}
$('#selectprovincevl').html(optionprov);
}
});
optionprov = `<option value=''>All Province</option>`
$('#selectprovincevl').html(optionprov);
changevistorbytime(selectyear, selectmonth, country, province);
if(country){
$('#visitorLocation').html('Visitor Location Province');
}else{
$('#visitorLocation').html('Visitor Location Country');
}
});
$('#selectprovincevl').change(function(){
let country = $('#selectcountryvl').val();
let province = $('#selectprovincevl').val();
let selectyear = $('#selectyearvisit').val();
let selectmonth = $('#selectmonthvisit').val();
changevistorbytime(selectyear, selectmonth, country, province);
if(province){
$('#visitorLocation').html('Visitor Location City');
}else{
$('#visitorLocation').html('Visitor Location Province');
}
});
function changevistorbytime(year, month, country, province){
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadvisitorbytime',
data: {
token : validasiToken,
year : year,
month : month,
country : country,
province : province
},
success: function(result){
// console.log(result.data);
let data = result.data;
// console.log(data);
let location = [];
let total = [];
for (x in data){
location[x] = data[x]['location'];
total[x] = data[x]['total'];
}
myPieChartnew = {
labels: location,
datasets: [{
data: total,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#ffd700', '#c5c5c5'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
};
myVisitorPie.data = myPieChartnew;
window.myVisitorPie.update();
var colour = ['primary','success','info','warning','secondary'];
var cols = "";
for(y in location){
cols += '<span class="mr-2"><i class="fas fa-circle text-'+colour[y]+'"></i> '+location[y]+'</span>';
}
$('#infoChartLokasi').html(cols);
}
});
}
\ No newline at end of file
......@@ -4,77 +4,226 @@ Chart.defaults.global.defaultFontColor = '#858796';
$("#websiteName").html(websitetitle);
LoadDadta(validasiToken);
function LoadDadta(token){
$(document).ready(function(){
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadchartimage',
function LoadDadta(token){
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadchartimage',
data: {
token : token,
country : null,
province: null,
city : null
},
success: function(result){
// console.log(result);
let data = result.data;
var image_name = [];
let jumlah = [];
for(x in data){
image_name[x] = data[x].nodeimage;
jumlah[x] = data[x].count;
}
var configimage = {
type: 'pie',
data: {
token : validasiToken,
labels: image_name,
datasets: [{
data: jumlah,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#ffd700', '#c5c5c5'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
success: function(result){
console.log(result);
if(result.code == 0){
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, {
type: 'pie',
data: {
labels: image_name,
datasets: [{
data: jumlah,
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', "#c5c5c5"],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf', '#ffd700', '#c5c5c5'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: false
},
cutoutPercentage: 0,
},
});
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: false
},
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'];
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);
}
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);
}
}
});
}
}else{
alert(result.info);
}
},
error: function(xhr) {
alert(xhr.status+'-'+xhr.statusText);
}
});
});
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
},
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
......@@ -112,7 +112,7 @@ class User extends \Khansia\Generic\Objects\Mapper {
}
if ($authenticated) {
$this->retries = 'NULL';
$this->save(true);
......
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