Пример #1
0
 /**
  * Возвращает количество секунд, которое нужно подождать перед тем, 
  * как можно будет выполнить очередное дейтсие.
  */
 public static function getWaitTime()
 {
     $needWait = 0;
     //Не будем заставлять админа ждать:)
     if (self::isActivityRegistered()) {
         $needWait = PsSettings::ACTIVITY_INTERVAL() - (time() - $_SESSION[SESSION_ACT_WATCHER_PARAM]);
     }
     return $needWait < 0 ? 0 : $needWait;
 }
Пример #2
0
 private function jsCommon()
 {
     $params['url'] = PsUrl::current();
     $params['userId'] = AuthManager::getUserIdOrNull();
     $params['isAuthorized'] = AuthManager::isAuthorized();
     $params['isDOA'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['isLogging'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['currentSubmitTimeout'] = ActivityWatcher::getWaitTime();
     $params['tzOffset'] = PsTimeZone::inst()->getCurrentDateTimeZone()->getOffset(new DateTime());
     $params['marker'] = AuthManager::getUserSessoinMarker();
     $params['foldings'] = FoldedStorage::listEntitiesRel();
     return $params;
 }
Пример #3
0
 private function jsCommon(PageContext $ctxt)
 {
     $params['url'] = $ctxt->getRequestUrl();
     $params['isPopup'] = $ctxt->isPopupPage();
     $params['userId'] = AuthManager::getUserIdOrNull();
     $params['isAuthorized'] = AuthManager::isAuthorized();
     $params['isDOA'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['isLogging'] = PsSettings::DEVMODE_OR_ADMIN();
     $params['currentSubmitTimeout'] = ActivityWatcher::getWaitTime();
     $params['tzOffset'] = PsTimeZone::inst()->getCurrentDateTimeZone()->getOffset(new DateTime());
     $params['marker'] = AuthManager::getUserSessoinMarker();
     /* @var $folding FoldedResources */
     foreach (Handlers::getInstance()->getFoldingsIndexed() as $unique => $folding) {
         $params['foldings'][$unique] = $folding->getResourcesDm()->relDirPath();
     }
     return $params;
 }