| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- /****************************
- * File : hitcount.php
- * Author : Cygnusa
- * @2018
- ****************************/
- //SECURITY
- if ( ! defined('APPLICATION_PATH')) exit('No direct script access allowed');
- class hitcount
- {
-
- //FUNCTION LISTS
- function __construct($parent)
- {
- //GET PAGE MESSAGE
- $this->page_data=globalfunc::getMessage($parent,$parent->lang,'hitcount');
- if(count($parent->params)==0)
- {
- $this->hitcountfunc($parent);
- }
- $parent->response(array('response'=>'failed', 'message' => 'PAGE NOT FOUND'), 404);
- }
-
- /* /////////////////////////////// HITCOUNT LIST //////////////////////////////////////////////// */
- private function hitcountfunc($parent)
- {
- globalfunc::checkMethodType($parent,array('POST'));
- globalfunc::checkParamCount($parent,0);
- globalfunc::checkAuthrozation($parent,array('type'=>'user'));
-
- //FIELDS VALIDATION
- $REQUEST_KEYS=array('page'=>'string');
- globalfunc::mandatoryKey($parent,$REQUEST_KEYS);
-
- $page= escape_str($parent->_request["page"]);
- $cateid= escape_str($parent->_request["cateid"]);
- $assettopicid= escape_str($parent->_request["assettopicid"]);
- $contentid= escape_str($parent->_request["contentid"]);
- $viewtime= escape_str($parent->_request["viewtime"]);
-
- //if($parent->current_user_role>'7' && $parent->current_user_role!='14' && $parent->current_user_role!='16')
- if(in_array($parent->current_user_role, $parent->dse_roles))
- {
-
- if(strtolower($page)=='learning')
- {
- if($contentid!='')
- {
- $query_str="SELECT c.assettopicid,ca.cateid FROM `".TABLE_ASSET_CONTENT."` as c JOIN ".TABLE_ASSET_TOPIC." as t ON c.assettopicid=t.assettopicid JOIN ".TABLE_CATEGORY." as ca ON ca.cateid=t.cateid WHERE c.contentid ='".$contentid."' LIMIT 1";
- $query_arr=$parent->getQueryValue($query_str);
-
- if(count($query_arr)>0)
- {
- $cateid=$query_arr[0]->cateid;
- $assettopicid=$query_arr[0]->assettopicid;
- }
-
- }
- }
-
-
- //RESULT INSERT
- $parent->executeQuery("INSERT INTO ".TABLE_USER_ACCESSCOUNT." (device_type, `smpin`, `page`, `cateid`, `assettopicid`, `contentid`, `viewtime`, `created_on` )VALUES('".$parent->device_type."', '".$parent->current_user_data->smpin."','".$page."','".$cateid."', '".$assettopicid."', '".$contentid."', '".$viewtime."','".NOW."')");
-
- } else
- {
- if(strtolower($page)=='learning')
- {
- if($contentid!='')
- {
- $query_str="SELECT c.assettopicid,ca.cateid FROM `".TABLE_ASSET_CONTENT."` as c JOIN ".TABLE_ASSET_TOPIC." as t ON c.assettopicid=t.assettopicid JOIN ".TABLE_CATEGORY." as ca ON ca.cateid=t.cateid WHERE c.contentid ='".$contentid."' LIMIT 1";
- $query_arr=$parent->getQueryValue($query_str);
-
- if(count($query_arr)>0)
- {
- $cateid=$query_arr[0]->cateid;
- $assettopicid=$query_arr[0]->assettopicid;
- }
-
- }
- }
-
-
- //RESULT INSERT
- $parent->executeQuery("INSERT INTO ".TABLE_USER_ACCESSCOUNT." (device_type, `emp_code`, `page`, `cateid`, `assettopicid`, `contentid`, `viewtime`, `created_on` )VALUES('".$parent->device_type."', '".$parent->current_user_data->emp_code."','".$page."','".$cateid."', '".$assettopicid."', '".$contentid."', '".$viewtime."','".NOW."')");
- }
-
- $parent->response(array('response'=>'success' ,'message'=>$this->page_data['success1']),200);
- }
- /* //////////////////////////////////////////////////////////////////////////////////////////// */
-
-
- }
- ?>
|