Beispiel #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')));
 }
 public function view()
 {
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     Loader::model("page_statistics");
     Loader::model("user_statistics");
     $timeStr = '';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $timeStr = '%x ' . t('at') . ' %I:%M %p';
     } else {
         $timeStr = '%x ' . t('at') . ' %l:%M %p';
     }
     if (is_object($ui)) {
         $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
         $this->set('uName', $ui->getUserName());
         $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()));
         }
         Loader::block('form');
     }
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
 function getLastPageEditDate()
 {
     if (func_num_args() == 0) {
         return array('description' => t('Last site modification date'), 'customonclick' => ExtendedContentParseInput::getDateInput());
     }
     Loader::model('page_statistics');
     $time = strtotime(PageStatistics::getSiteLastEdit());
     return strftime(func_get_arg(0), $time);
 }
Beispiel #4
0
 public function view()
 {
     $this->addHeaderItem(Loader::helper('html')->javascript('jquery.visualize.js'));
     $this->addHeaderItem(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());
 }
		public function view() {
			$u = new User();
			$ui = UserInfo::getByID($u->getUserID());
			Loader::model("page_statistics");
			Loader::model("user_statistics");
			Loader::block('form');
			$dh = Loader::helper('date');
			if (is_object($ui)) { 
				$this->set('uLastLogin', $dh->date(DATE_APP_GENERIC_MDYT, $ui->getLastLogin('user')));
				$this->set('uName', $ui->getUserName());
				$this->set('lastEditSite', $dh->date(DATE_APP_GENERIC_MDYT, 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', $dh->date(DATE_APP_GENERIC_MDYT, $llu->getLastLogin()));
				}
			}				
			$this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
			$this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
		}
Beispiel #6
0
 public function addStatic($data)
 {
     $db = Loader::db();
     $cParentID = $this->getCollectionID();
     if (isset($data['pkgID'])) {
         $pkgID = $data['pkgID'];
     } else {
         $pkgID = 0;
     }
     $handle = $data['handle'];
     $cName = $data['name'];
     $cFilename = $data['filename'];
     $uID = USER_SUPER_ID;
     $data['uID'] = $uID;
     $cIsSystemPage = 0;
     parent::refreshCache();
     $cobj = parent::add($data);
     $cID = $cobj->getCollectionID();
     $this->rescanChildrenDisplayOrder();
     $cDisplayOrder = $this->getNextSubPageDisplayOrder();
     // These get set to parent by default here, but they can be overridden later
     $cInheritPermissionsFromCID = $this->getPermissionsCollectionID();
     $cInheritPermissionsFrom = 'PARENT';
     $v = array($cID, $cFilename, $cParentID, $cInheritPermissionsFrom, $this->overrideTemplatePermissions(), $cInheritPermissionsFromCID, $cDisplayOrder, $cIsSystemPage, $uID, $pkgID);
     $q = "insert into Pages (cID, cFilename, cParentID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, cIsSystemPage, uID, pkgID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
     $r = $db->prepare($q);
     $res = $db->execute($r, $v);
     if ($res) {
         // Collection added with no problem -- update cChildren on parrent
         Loader::model('page_statistics');
         PageStatistics::incrementParents($cID);
     }
     $pc = Page::getByID($cID);
     $pc->rescanCollectionPath();
     return $pc;
 }
}
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');