Example #1
0
 public function __construct()
 {
     Loader::model('user_statistics');
     Loader::model('page_statistics');
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $us = new UserStatistics($ui);
     $this->set('uLastActivity', $us->getPreviousSessionPageViews());
     $timeStr = '';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $timeStr = '%x ' . t('at') . ' %I:%M %p';
     } else {
         $timeStr = '%x ' . t('at') . ' %l:%M %p';
     }
     $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
     $this->set('uName', $ui->getUserName());
     $this->set('totalViews', PageStatistics::getTotalPageViewsForOthers($u));
     $this->set('totalVersions', PageStatistics::getTotalPageVersions());
     $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
     $llu = UserStatistics::getLastLoggedInUser();
     if ($llu->getUserID() == $u->getUserID()) {
         $this->set('lastLoginSite', t('Your login is the most recent.'));
     } else {
         $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
     }
     $this->set('totalEditMode', PageStatistics::getTotalPagesCheckedOut());
     Loader::block('form');
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
Example #2
0
	protected function setLatestPageViews() {
		Loader::model('page_statistics');
		$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);
	}
}
Loader::library('3rdparty/open_flash_chart');
Loader::model('page_statistics');
$daysRow = array();
// first, we grab the last 5 days
$viewsArray = array();
$u = new User();
$max = 0;
for ($i = -4; $i < 1; $i++) {
    $date = date('Y-m-d', strtotime($i . ' days'));
    if ($i == 0) {
        $daysRow[] = t('Today');
    } else {
        $daysRow[] = strftime('%a', strtotime($i . ' days'));
    }
    $total = PageStatistics::getTotalPageViewsForOthers($u, $date);
    $viewsArray[] = $total;
    if ($total > $max) {
        $max = $total;
    }
}
$g = new graph();
$g->set_title('&nbsp;', '{color: #ffffff}');
$g->set_data($viewsArray);
$g->bg_colour = '#ffffff';
$g->set_inner_background('#ffffff', "#cccccc", 90);
// we add the 3 line types and key labels
$g->line_dot(3, 5, '#4C85BB', false, 10);
$g->set_x_labels($daysRow);
$g->set_x_label_style(10, '#ababab', 0, 2);
$g->x_axis_colour('#333333', '#bebebe');