Exemple #1
0
 /**
  * Visual index
  *
  * @access public
  * @return void
  */
 public function index($referer = '')
 {
     $template = $this->config->template->{$this->device}->name;
     $this->loadModel('block')->loadTemplateLang($template);
     $this->view->referer = helper::safe64decode($referer);
     $this->view->title = $this->lang->visual->common;
     $this->view->blocks = $this->lang->block->{$template};
     if ($referer == '') {
         $this->view->referer = getWebRoot();
     }
     $this->display();
 }
Exemple #2
0
 /**
  * Save referer info.
  * 
  * @access public
  * @return array
  */
 public function saveReferer()
 {
     if (!$this->get->referer) {
         if ($this->session->referer) {
             $referer = $this->getRefererByID($this->session->referer);
             if (!empty($referer)) {
                 return $referer;
             }
         }
         return null;
     }
     $url = helper::safe64decode($this->get->referer);
     $refererInDB = $this->dao->select("*")->from(TABLE_STATREFERER)->where('url')->eq($url)->fetch();
     if (!empty($refererInDB)) {
         $this->session->set('referer', $refererInDB->id);
         return $refererInDB;
     }
     $referer = parse_url($url);
     if (isset($this->config->searchEngine->domains[$referer['host']])) {
         $searchEngine = $this->config->searchEngine->domains[$referer['host']];
         $param = $this->config->searchEngine->params[$searchEngine];
         parse_str($referer['query'], $queryInfo);
         if (is_array($param)) {
             foreach ($param as $paramName) {
                 if (isset($queryInfo[$paramName])) {
                     $keywords = $queryInfo[$paramName];
                 }
             }
         } else {
             $keywords = $queryInfo[$param];
         }
         $referer['searchEngine'] = $searchEngine;
         $referer['keywords'] = $keywords;
     }
     $referer['domain'] = $referer['host'];
     $referer['url'] = $url;
     $this->dao->replace(TABLE_STATREFERER)->data($referer, "host,query,path,scheme")->autoCheck()->exec();
     $referer['id'] = $this->dao->lastInsertId();
     $this->session->set('referer', $referer['id']);
     return (object) $referer;
 }
Exemple #3
0
 /**
  * Domain trend report.
  * 
  * @param  string    $domain 
  * @param  string    $mode 
  * @param  string    $begin 
  * @param  string    $end 
  * @access public
  * @return void
  */
 public function domainTrend($domain, $mode = 'today', $begin = '', $end = '')
 {
     $domain = helper::safe64decode($domain);
     $date = $this->stat->parseDate($mode, $begin, $end);
     $begin = $date->begin;
     $end = $date->end;
     if ($begin < $end) {
         $labels = $this->stat->getDayLabels($begin, $end);
     }
     if ($begin == $end) {
         $labels = $this->stat->getHourLabels($begin, false);
     }
     $this->view->title = $this->lang->stat->domain . ' - ' . $domain;
     $this->view->domain = $domain;
     $this->view->labels = $labels;
     $this->view->mode = $mode;
     $this->view->lineChart = $this->stat->getItemLine('domain', $domain, $begin, $end);
     $this->view->pieCharts = $this->stat->getItemExtraPie('domain', $domain, $begin, $end);
     $this->display();
 }