Beispiel #1
0
 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());
 }
 public function view()
 {
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $dh = Core::make('helper/date');
     /* @var $dh \Concrete\Core\Localization\Service\Date */
     if (is_object($ui)) {
         $this->set('uLastLogin', $dh->formatDateTime($ui->getLastLogin()));
         $this->set('uName', $ui->getUserName());
         $this->set('lastEditSite', $dh->formatDateTime(PageStatistics::getSiteLastEdit()));
         $llu = UserStatistics::getLastLoggedInUser();
         if ($llu->getUserID() == $u->getUserID()) {
             $this->set('lastLoginSite', t('Your login is the most recent.'));
         } else {
             $this->set('lastLoginSite', $dh->formatDateTime($llu->getLastLogin()));
         }
     }
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
Beispiel #3
0
 public function addStatic($data)
 {
     $db = Database::get();
     $cParentID = $this->getCollectionID();
     if (isset($data['pkgID'])) {
         $pkgID = $data['pkgID'];
     } else {
         $pkgID = 0;
     }
     $cFilename = $data['filename'];
     $uID = USER_SUPER_ID;
     $data['uID'] = $uID;
     $cIsSystemPage = 0;
     $cobj = parent::addCollection($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
         PageStatistics::incrementParents($cID);
     }
     $pc = Page::getByID($cID);
     $pc->rescanCollectionPath();
     return $pc;
 }
Beispiel #4
0
 public static function addStatic($data, TreeInterface $parent = null)
 {
     $db = Database::connection();
     $cParentID = 1;
     $cDisplayOrder = 0;
     $cInheritPermissionsFromCID = 1;
     $cOverrideTemplatePermissions = 1;
     if ($parent instanceof Page) {
         $cParentID = $parent->getCollectionID();
         $parent->rescanChildrenDisplayOrder();
         $cDisplayOrder = $parent->getNextSubPageDisplayOrder();
         $cInheritPermissionsFromCID = $parent->getPermissionsCollectionID();
         $cOverrideTemplatePermissions = $parent->overrideTemplatePermissions();
     }
     if (isset($data['pkgID'])) {
         $pkgID = $data['pkgID'];
     } else {
         $pkgID = 0;
     }
     $cFilename = $data['filename'];
     $uID = USER_SUPER_ID;
     $data['uID'] = $uID;
     $cobj = parent::addCollection($data);
     $cID = $cobj->getCollectionID();
     // These get set to parent by default here, but they can be overridden later
     $cInheritPermissionsFrom = 'PARENT';
     $siteTreeID = 0;
     if (is_object($parent)) {
         $siteTreeID = $parent->getSiteTreeID();
     }
     $v = [$cID, $siteTreeID, $cFilename, $cParentID, $cInheritPermissionsFrom, $cOverrideTemplatePermissions, $cInheritPermissionsFromCID, $cDisplayOrder, $uID, $pkgID];
     $q = 'insert into Pages (cID, siteTreeID, cFilename, cParentID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, uID, pkgID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
     $r = $db->prepare($q);
     $res = $r->execute($v);
     if ($res) {
         // Collection added with no problem -- update cChildren on parrent
         PageStatistics::incrementParents($cID);
     }
     $pc = self::getByID($cID);
     $pc->rescanCollectionPath();
     return $pc;
 }