* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBStatistic'); /** * Statistic module for page and content views * * Simple interface to save page statistic * * @version 0.2.0 * @package WB * @subpackage base */ class WBStatistic_View extends WBStatistic { /** * name of page view table */ const TABLE = 'pageview'; /** * namespace: site */ const NS_SITE = 'site'; /** * namespace: ajaxcontent */ const NS_AJAX_CONTENT = 'ajax_content'; /** * namespace: ajaxxinha */ const NS_AJAX_XINHADIALOG = 'ajax_xinhadialog'; /** * namespace: ajaxwxml */ const NS_AJAX_WXMLDIALOG = 'ajax_wxmldialog'; /** * namespace: ajaxcall */ const NS_AJAX_CALL = 'ajax_call'; /** * add path to page views * * Save path in statistic table * * @param string $path * @param string $namespace */ public function addPath($path, $namespace = self::NS_SITE) { if (!$this->enabled) { return; } $path = trim($path, "/ \t\n\r"); $uid = $this->user->getId(); if (!$uid) { $uid = 0; } $timer = $this->sess->getTimer(); $save = array( 'trackid' => $this->getTrackingId(), 'path' => $path, 'namespace' => $namespace, 'addr' => $this->getAddress(), $this->uPrimary => $uid, 'counter' => $this->sess->getCounter(), 'elapsedstart' => $timer['elapsed_start'], 'elapsedlast' => $timer['elapsed_last'] ); if ($this->sess->has(WBStatistic::SESS_KEY_HINT)) { $save['hint'] = $this->sess->get(WBStatistic::SESS_KEY_HINT); } $this->table->save(self::TABLE, '__new', $save); } } ?>