当前位置: 首页>>代码示例>>PHP>>正文


PHP common_session_SessionManager::isAnonymous方法代码示例

本文整理汇总了PHP中common_session_SessionManager::isAnonymous方法的典型用法代码示例。如果您正苦于以下问题:PHP common_session_SessionManager::isAnonymous方法的具体用法?PHP common_session_SessionManager::isAnonymous怎么用?PHP common_session_SessionManager::isAnonymous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common_session_SessionManager的用法示例。


在下文中一共展示了common_session_SessionManager::isAnonymous方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rootEntry

 /**
  * Action used to redirect request made to root of tao.
  */
 public function rootEntry()
 {
     if (\common_session_SessionManager::isAnonymous()) {
         /* @var $urlRouteService DefaultUrlService */
         $urlRouteService = $this->getServiceManager()->get(DefaultUrlService::SERVICE_ID);
         $this->redirect($urlRouteService->getLoginUrl());
     } else {
         $this->redirect(_url('entry', 'Main', 'tao'));
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-community,代码行数:13,代码来源:Main.php

示例2: getCurrentUser

 /**
  * retrieve the logged in user
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @return core_kernel_classes_Resource
  */
 public function getCurrentUser()
 {
     $returnValue = null;
     if (!common_session_SessionManager::isAnonymous()) {
         $userUri = \common_session_SessionManager::getSession()->getUser()->getIdentifier();
         if (!empty($userUri)) {
             $returnValue = new core_kernel_classes_Resource($userUri);
         } else {
             common_Logger::d('no userUri');
         }
     }
     return $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:20,代码来源:class.UserService.php

示例3: entry

 /**
  * First page, when arriving on a system
  * to choose front or back office
  */
 public function entry()
 {
     $entries = array();
     foreach (EntryPointService::getRegistry()->getEntryPoints() as $entry) {
         if (tao_models_classes_accessControl_AclProxy::hasAccessUrl($entry->getUrl())) {
             $entries[] = $entry;
         }
     }
     if (empty($entries)) {
         // no access -> error
         if (common_session_SessionManager::isAnonymous()) {
             /* @var $urlRouteService DefaultUrlService */
             $urlRouteService = $this->getServiceManager()->get(DefaultUrlService::SERVICE_ID);
             $this->redirect($urlRouteService->getLoginUrl());
         } else {
             common_session_SessionManager::endSession();
             return $this->returnError(__('You currently have no access to the platform'));
         }
     } elseif (count($entries) == 1 && !common_session_SessionManager::isAnonymous()) {
         // single entrypoint -> redirect
         $entry = current($entries);
         return $this->redirect($entry->getUrl());
     } else {
         // multiple entries -> choice
         if (!common_session_SessionManager::isAnonymous()) {
             $this->setData('user', common_session_SessionManager::getSession()->getUserLabel());
         }
         $this->setData('entries', $entries);
         $naviElements = $this->getNavigationElementsByGroup('settings');
         foreach ($naviElements as $key => $naviElement) {
             if ($naviElement['perspective']->getId() !== 'user_settings') {
                 unset($naviElements[$key]);
                 continue;
             }
         }
         $this->setData('userLabel', \common_session_SessionManager::getSession()->getUserLabel());
         $this->setData('settings-menu', $naviElements);
         $this->setData('current-section', $this->getRequestParameter('section'));
         $this->setData('content-template', array('blocks/entry-points.tpl', 'tao'));
         $this->setView('layout.tpl', 'tao');
     }
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:46,代码来源:class.Main.php

示例4: entry

 /**
  * First page, when arriving on a system
  * to choose front or back office
  */
 public function entry()
 {
     $entries = array();
     foreach (MenuService::getEntryPoints() as $entry) {
         if ($entry->hasAccess()) {
             $entries[] = $entry;
         }
     }
     if (empty($entries)) {
         // no access -> error
         if (common_session_SessionManager::isAnonymous()) {
             return $this->redirect(_url('login'));
         } else {
             common_session_SessionManager::endSession();
             return $this->returnError(__('You currently have no access to the platform'));
         }
     } elseif (count($entries) == 1 && !common_session_SessionManager::isAnonymous()) {
         // single entrypoint -> redirect
         $entry = current($entries);
         return $this->redirect($entry->getUrl());
     } else {
         // multiple entries -> choice
         if (!common_session_SessionManager::isAnonymous()) {
             $this->setData('user', common_session_SessionManager::getSession()->getUserLabel());
         }
         $this->setData('entries', $entries);
         $naviElements = $this->getNavigationElementsByGroup('settings');
         foreach ($naviElements as $key => $naviElement) {
             if ($naviElement['perspective']->getId() !== 'user_settings') {
                 unset($naviElements[$key]);
                 continue;
             }
         }
         $this->setData('userLabel', \common_session_SessionManager::getSession()->getUserLabel());
         $this->setData('settings-menu', $naviElements);
         $this->setData('content-template', array('blocks/entry-points.tpl', 'tao'));
         $this->setView('layout.tpl', 'tao');
     }
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:43,代码来源:class.Main.php

示例5: scripts

 /**
  * Load external resources for the current context
  * @see tao_helpers_Scriptloader
  */
 protected function scripts()
 {
     $assetService = $this->getServiceManager()->get(AssetService::SERVICE_ID);
     $cssFiles = array($assetService->getJsBaseWww('tao') . 'css/layout.css', $assetService->getJsBaseWww('tao') . 'css/tao-main-style.css', $assetService->getJsBaseWww('tao') . 'css/tao-3.css');
     //stylesheets to load
     \tao_helpers_Scriptloader::addCssFiles($cssFiles);
     if (\common_session_SessionManager::isAnonymous()) {
         \tao_helpers_Scriptloader::addCssFile($assetService->getJsBaseWww('tao') . 'css/portal.css');
     }
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:14,代码来源:Bootstrap.php

示例6: setPropertyValueByLg

 /**
  * Short description of method setPropertyValueByLg
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param  Resource resource
  * @param  Property property
  * @param  string value
  * @param  string lg
  * @return boolean
  */
 public function setPropertyValueByLg(core_kernel_classes_Resource $resource, core_kernel_classes_Property $property, $value, $lg)
 {
     $returnValue = (bool) false;
     $platform = $this->getPersistence()->getPlatForm();
     $userId = \common_session_SessionManager::isAnonymous() ? null : \common_session_SessionManager::getSession()->getUser()->getIdentifier();
     $mask = 'yyy[admin,administrators,authors]';
     //now it's the default right mode
     $query = 'INSERT INTO statements (modelid,subject,predicate,object,l_language,author,epoch)
     			VALUES  (?, ?, ?, ?, ?, ?, ?)';
     $returnValue = $this->getPersistence()->exec($query, array($this->getNewTripleModelId(), $resource->getUri(), $property->getUri(), $value, $property->isLgDependent() ? $lg : '', $userId, $platform->getNowExpression()));
     return (bool) $returnValue;
 }
开发者ID:oat-sa,项目名称:lib-generis-smooth,代码行数:23,代码来源:Resource.php

示例7: duplicate

 /**
  * Short description of method duplicate
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param  Resource resource
  * @param  array excludedProperties
  * @return core_kernel_classes_Resource
  */
 public function duplicate(core_kernel_classes_Resource $resource, $excludedProperties = array())
 {
     $returnValue = null;
     $newUri = common_Utils::getNewUri();
     $collection = $this->getRdfTriples($resource);
     if ($collection->count() > 0) {
         $platform = $this->getPersistence()->getPlatForm();
         $multipleInsertQueryHelper = $platform->getMultipleInsertsSqlQueryHelper();
         $user = common_session_SessionManager::isAnonymous() ? $platform->getNullString() : $this->getPersistence()->quote(\common_session_SessionManager::getSession()->getUser()->getIdentifier());
         $columns = array("modelid", "subject", "predicate", "object", "l_language", "author", "epoch");
         $query = $multipleInsertQueryHelper->getFirstStaticPart('statements', $columns);
         foreach ($collection->getIterator() as $triple) {
             if (!in_array($triple->predicate, $excludedProperties)) {
                 $query .= $multipleInsertQueryHelper->getValuePart('statements', $columns, array("modelid" => $this->getNewTripleModelId(), "subject" => $this->getPersistence()->quote($newUri), "predicate" => $this->getPersistence()->quote($triple->predicate), "object" => $triple->object == null ? $platform->getNullString() : $this->getPersistence()->quote($triple->object), "l_language" => $triple->lg == null ? $platform->getNullString() : $this->getPersistence()->quote($triple->lg), "author" => $user, "epoch" => $this->getPersistence()->quote($platform->getNowExpression())));
             }
         }
         $query = substr($query, 0, strlen($query) - 1);
         $query .= $multipleInsertQueryHelper->getEndStaticPart();
         if ($this->getPersistence()->exec($query)) {
             $returnValue = new core_kernel_classes_Resource($newUri);
         }
     }
     return $returnValue;
 }
开发者ID:nagyist,项目名称:generis,代码行数:33,代码来源:class.Resource.php

示例8: scripts

 /**
  * Load external resources for the current context
  * @see tao_helpers_Scriptloader
  */
 protected function scripts()
 {
     $cssFiles = array(TAOBASE_WWW . 'css/layout.css', TAOBASE_WWW . 'css/tao-main-style.css', TAOBASE_WWW . 'css/tao-3.css');
     //stylesheets to load
     \tao_helpers_Scriptloader::addCssFiles($cssFiles);
     if (\common_session_SessionManager::isAnonymous()) {
         \tao_helpers_Scriptloader::addCssFile(TAOBASE_WWW . 'css/portal.css');
     }
     //ajax file upload works only without HTTP_AUTH
     if (!USE_HTTP_AUTH) {
         \tao_helpers_Scriptloader::addCssFile(TAOBASE_WWW . 'js/lib/jquery.uploadify/uploadify.css');
     }
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:17,代码来源:Bootstrap.php

示例9: isASessionOpened

 /**
  * Indicates if an Authenticated Session is open.
  *
  * @access public
  * @author Jerome Bogaerts, <jerome@taotesting.com>
  * @return boolean
  */
 public function isASessionOpened()
 {
     return !common_session_SessionManager::isAnonymous();
 }
开发者ID:nagyist,项目名称:generis,代码行数:11,代码来源:class.Service.php

示例10: checkTime

 /**
  * Check if it is time to perform an action.
  * If `$this->lastExecution` is null (action has never been executed)
  * or since the last execution took time more than specified interval (`$this->interval`) then action must be performed.
  * @return bool
  */
 protected function checkTime()
 {
     $result = false;
     $lastExecution = $this->getExecutionTime();
     $interval = $this->getInterval();
     $anonymous = \common_session_SessionManager::isAnonymous();
     if ($lastExecution === null && !$anonymous) {
         $result = true;
     } elseif ($lastExecution !== null && $interval !== null && !$anonymous) {
         $mustBeExecutedAt = clone $lastExecution;
         $mustBeExecutedAt->add($interval);
         $now = new DateTime('now');
         $result = $mustBeExecutedAt < $now;
     }
     return $result;
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:22,代码来源:TimeRule.php

示例11: getAmdLoader

 /**
  * Build script element for AMD loader
  *
  * @return string
  */
 public static function getAmdLoader()
 {
     if (\common_session_SessionManager::isAnonymous()) {
         $amdLoader = array('src' => Template::js('lib/require.js', 'tao'), 'data-main' => TAOBASE_WWW . 'js/login', 'data-config' => get_data('client_config_url'));
     } else {
         if (\tao_helpers_Mode::is('production')) {
             $amdLoader = array('src' => Template::js('main.min.js', 'tao'), 'data-config' => get_data('client_config_url'));
         } else {
             $amdLoader = array('src' => Template::js('lib/require.js', 'tao'), 'data-config' => get_data('client_config_url'), 'data-main' => TAOBASE_WWW . 'js/main');
         }
     }
     $amdScript = '<script id="amd-loader" ';
     foreach ($amdLoader as $attr => $value) {
         $amdScript .= $attr . '="' . $value . '" ';
     }
     return trim($amdScript) . '></script>';
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:22,代码来源:Layout.php

示例12: getAmdLoader

 /**
  * Create the AMD loader for the current context.
  * It will load login's modules for anonymous session.
  * Loads the bundle mode in production and the dynamic mode in debug.
  *
  * @param string $bundle the bundle URL
  * @param string $controller the controller module id
  * @param array  $params additional parameters
  * @return string the script tag
  */
 public static function getAmdLoader($bundle = null, $controller = null, $params = null)
 {
     $bundleMode = \tao_helpers_Mode::is('production');
     $configUrl = get_data('client_config_url');
     $requireJsUrl = Template::js('lib/require.js', 'tao');
     $bootstrapUrl = Template::js('loader/bootstrap', 'tao');
     $loader = new AmdLoader($configUrl, $requireJsUrl, $bootstrapUrl);
     if (\common_session_SessionManager::isAnonymous()) {
         $controller = 'controller/login';
         $bundle = Template::js('loader/login.min.js', 'tao');
     }
     if ($bundleMode) {
         return $loader->getBundleLoader($bundle, $controller, $params);
     }
     return $loader->getDynamicLoader($controller, $params);
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:26,代码来源:Layout.php


注:本文中的common_session_SessionManager::isAnonymous方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。