/** * Parse this page * * @return void */ protected function parse() { // get page $page = $this->pageId != '' ? BackendAnalyticsModel::getPageForId($this->pageId) : null; // update date_viewed for this page BackendAnalyticsModel::updatePageDateViewed($this->pageId); // parse redirect link $this->tpl->assign('redirect', BackendModel::createURLForAction($this->redirectAction)); $this->tpl->assign('redirectGet', isset($page) ? 'page=' . $page : ''); $this->tpl->assign('settingsUrl', BackendModel::createURLForAction('settings')); $this->tpl->assign('page', $this->redirectAction); $this->tpl->assign('identifier', ($this->pageId != '' ? $this->pageId . '_' : '') . $this->identifier); }
/** * Get the top exit pages * * @return array * @param string $page The page. * @param int $startTimestamp The start timestamp for the cache file. * @param int $endTimestamp The end timestamp for the cache file. */ public static function getDataForPage($page, $startTimestamp, $endTimestamp) { // get database $db = BackendModel::getDB(); // get id for this page $id = (int) $db->getVar('SELECT id FROM analytics_pages WHERE page = ?', array((string) $page)); // no id? insert this page if ($id === 0) { $id = $db->insert('analytics_pages', array('page' => (string) $page)); } // get data from cache $items = array(); $items['aggregates'] = self::getAggregatesFromCacheByType('page_' . $id, $startTimestamp, $endTimestamp); $items['entries'] = self::getDataFromCacheByType('page_' . $id, $startTimestamp, $endTimestamp); // get current action $action = Spoon::get('url')->getAction(); // nothing in cache if ($items['aggregates'] === false || $items['entries'] === false) { self::redirectToLoadingPage($action, array('page_id' => $id)); } // reset loop counter for the current action if we got data from cache SpoonSession::set($action . 'Loop', null); // update date_viewed for this page BackendAnalyticsModel::updatePageDateViewed($id); // return results return $items; }
/** * Parse this page */ protected function parse() { parent::parse(); $page = $this->pageId != '' ? BackendAnalyticsModel::getPageForId($this->pageId) : null; // update date_viewed for this page BackendAnalyticsModel::updatePageDateViewed($this->pageId); // parse redirect link $this->tpl->assign('redirectGet', isset($page) ? 'page=' . $page : ''); $this->tpl->assign('page', $this->redirectAction); $this->tpl->assign('identifier', ($this->pageId != '' ? $this->pageId . '_' : '') . $this->identifier); // check if this action is allowed if (BackendAuthentication::isAllowedAction($this->redirectAction, $this->getModule())) { $this->tpl->assign('redirect', BackendModel::createURLForAction($this->redirectAction)); } // check if this action is allowed if (BackendAuthentication::isAllowedAction('settings', $this->getModule())) { $this->tpl->assign('settingsUrl', BackendModel::createURLForAction('settings')); } }