Вход Регистрация
Файл: concrete5.7.5.6/concrete/controllers/single_page/dashboard/reports/statistics.php
Строк: 47
<?php
namespace ConcreteControllerSinglePageDashboardReports;
use 
ConcreteCorePageControllerDashboardPageController;
use 
ConcreteCorePageStatistics as PageStatistics;
use 
Loader;
use 
File;
use 
User;
use 
ConcreteCoreUserStatistics as UserStatistics;

class 
Statistics extends DashboardPageController {

    protected 
$labels = array();
    protected 
$dates = array();

    protected function 
setLatestPageViews() {

        
$viewsArray = array();
        
$u = new User();
        foreach(
$this->dates as $i => $date) {
            
$total PageStatistics::getTotalPageViewsForOthers($u$date);
            
$viewsArray[$this->labels[$i]] = $total;
        }
        
$this->set('pageViews'$viewsArray);
    }

    protected function 
setLatestPagesCreated() {
        
$viewsArray = array();
        
$u = new User();
        foreach(
$this->dates as $i => $date) {
            
$total PageStatistics::getTotalPagesCreated($date);
            
$newPages[$this->labels[$i]] = $total;
        }
        
$this->set('newPages'$newPages);
    }

    protected function 
setLatestRegistrations() {
        
$registrationsArray = array();
        foreach(
$this->dates as $i => $date) {
            
$total UserStatistics::getTotalRegistrationsForDay($date);
            
$registrationsArray[$this->labels[$i]] = $total;
        }
        
$this->set('userRegistrations'$registrationsArray);
    }

    public function 
on_start() {
        
$dh Loader::helper('date');
        for (
$i = -4$i 1$i++) {
            
$date date('Y-m-d'strtotime($i ' days'));
            if (
$i == 0) {
                
$label t('Today');
            } else {
                
$label $dh->date('D'strtotime($i ' days'));
            }
            
$this->labels[] = $label;
            
$this->dates[] = $date;
        }
        
parent::on_start();
    }

    protected function 
setDownloadStatistics() {
        
$downloads File::getDownloadStatistics(5);
        
$this->set('downloads'$downloads);
    }

    public function 
view() {
        
$this->addFooterItem(Loader::helper('html')->javascript('jquery-visualize.js'));
        
$this->addFooterItem(Loader::helper('html')->css('jquery-visualize.css'));
        
$this->setLatestPageViews();
        
$this->setLatestPagesCreated();
        
$this->setLatestRegistrations();
        
$this->setDownloadStatistics();

        
$this->set('totalVersions'PageStatistics::getTotalPageVersions());
        
$this->set('totalEditMode'PageStatistics::getTotalPagesCheckedOut());

    }
}
Онлайн: 1
Реклама