/** * Процессор: */ public function process($template) { $session = Session::getInstance(); $stats = Blog_BlogStatisticsModel::getGlobalStats(); $links_on = $session->persistenceGet('show_links_panel', true); if ($links_on) { $filter = $session->persistenceGet('live_filter', true); $links = Blog_BlogOnlineModel::GetLinks($filter); $template->setParameter('online_links', array_slice($links, 0, 12)); $template->setParameter('right_panel', $links_on); } $template->setParameter('global_unique', $stats['unique']); $template->setParameter('global_online', $stats['online']); $template->setParameter('global_posts', $stats['posts']); $template->setParameter('global_unique_posters', $stats['unique_posters']); $template->setParameter('global_speed', $stats['speed']); if ($session->persistenceGet('global_theme', false)) { return $template->render($this->viewParams, $session->persistenceGet('global_theme')); } parent::process($template); }
/** * Получение статистики: */ public function getGlobalStatsAjaxAction(Application $application) { $stats = Blog_BlogStatisticsModel::getGlobalStats(); return array('global_online' => $stats['online'], 'global_unique' => $stats['unique'], 'global_posts' => $stats['posts'], 'global_speed' => $stats['speed']); }