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


PHP common_session_SessionManager::getSession方法代码示例

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


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

示例1: properties

 /**
  * Action dedicated to change the settings of the user (language, ...)
  */
 public function properties()
 {
     $myFormContainer = new tao_actions_form_UserSettings($this->getUserSettings());
     $myForm = $myFormContainer->getForm();
     if ($myForm->isSubmited()) {
         if ($myForm->isValid()) {
             $currentUser = $this->userService->getCurrentUser();
             $userSettings = array(PROPERTY_USER_UILG => $myForm->getValue('ui_lang'), PROPERTY_USER_DEFLG => $myForm->getValue('data_lang'), PROPERTY_USER_TIMEZONE => $myForm->getValue('timezone'));
             $uiLang = new core_kernel_classes_Resource($myForm->getValue('ui_lang'));
             $dataLang = new core_kernel_classes_Resource($myForm->getValue('data_lang'));
             $userSettings[PROPERTY_USER_UILG] = $uiLang->getUri();
             $userSettings[PROPERTY_USER_DEFLG] = $dataLang->getUri();
             $binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($currentUser);
             if ($binder->bind($userSettings)) {
                 \common_session_SessionManager::getSession()->refresh();
                 $uiLangCode = tao_models_classes_LanguageService::singleton()->getCode($uiLang);
                 $extension = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
                 tao_helpers_I18n::init($extension, $uiLangCode);
                 $this->setData('message', __('Settings updated'));
                 $this->setData('reload', true);
             }
         }
     }
     $userLabel = $this->userService->getCurrentUser()->getLabel();
     $this->setData('formTitle', sprintf(__("My settings (%s)"), __($userLabel)));
     $this->setData('myForm', $myForm->render());
     //$this->setView('form.tpl');
     $this->setView('form/settings_user.tpl');
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:32,代码来源:class.UserSettings.php

示例2: displayeDate

 /**
  * Dispalys a date/time
  * Should in theorie be dependant on the users locale and timezone
  *
  * @param mixed $timestamp            
  * @param int $format  The date format. See tao_helpers_Date's constants.
  * @return string The formatted date.
  */
 public static function displayeDate($timestamp, $format = self::FORMAT_LONG)
 {
     $returnValue = '';
     if (is_object($timestamp) && $timestamp instanceof core_kernel_classes_Literal) {
         $dateTime = new DateTime();
         $dateTime->setTimestamp($timestamp->__toString());
     } else {
         if (is_object($timestamp) && $timestamp instanceof DateTime) {
             $dateTime = $timestamp;
         } else {
             $dateTime = new DateTime();
             $dateTime->setTimestamp($timestamp);
         }
     }
     $dateTime->setTimezone(new DateTimeZone(common_session_SessionManager::getSession()->getTimeZone()));
     switch ($format) {
         case self::FORMAT_LONG:
             $returnValue = $dateTime->format('d/m/Y H:i:s');
             break;
         case self::FORMAT_DATEPICKER:
             $returnValue = $dateTime->format('Y-m-d H:i');
             break;
         case self::FORMAT_VERBOSE:
             $returnValue = $dateTime->format('F j, Y, g:i:s a');
             break;
         default:
             common_Logger::w('Unkown date format ' . $format . ' for ' . __FUNCTION__, 'TAO');
     }
     return $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:38,代码来源:class.Date.php

示例3: getServiceStorage

 public static function getServiceStorage($serviceCallId)
 {
     $serviceService = ServiceManager::getServiceManager()->get('tao/stateStorage');
     $state = $serviceService->get(common_session_SessionManager::getSession()->getUserUri(), $serviceCallId);
     $submitUrl = _url('submitState', 'ServiceModule', 'tao', array('serviceCallId' => $serviceCallId));
     return 'new StateStorage(' . tao_helpers_Javascript::buildObject($state) . ', ' . tao_helpers_Javascript::buildObject($submitUrl) . ')';
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:class.ServiceJavascripts.php

示例4: index

 public function index()
 {
     $userId = common_session_SessionManager::getSession()->getUserUri();
     if (is_null($userId)) {
         throw new common_exception_Error('No user is logged in');
     }
     $lang = common_session_SessionManager::getSession()->getDataLanguage();
     if ($this->hasRequestParameter('serviceCallId')) {
         $serviceCallId = $this->getRequestParameter('serviceCallId');
         $variableData = tao_models_classes_service_StateStorage::singleton()->get($userId, $serviceCallId);
         $this->setData('storageData', array('serial' => $serviceCallId, 'data' => is_null($variableData) ? array() : $variableData));
     }
     $directory = $this->getDirectory($this->getRequestParameter('itemPath'));
     $basepath = $directory->getPath();
     if (!file_exists($basepath . $lang) && file_exists($basepath . DEFAULT_LANG)) {
         $lang = DEFAULT_LANG;
     }
     $this->setData('itemPath', $directory->getPublicAccessUrl() . $lang . '/index.html');
     $this->setData('itemId', $this->getRequestParameter('itemUri'));
     $this->setData('resultServerEndpoint', $this->getResultServerEndpoint());
     $this->setData('resultServerParams', $this->getResultServerParams());
     $this->setData('client_timeout', $this->getClientTimeout());
     $this->setData('client_config_url', $this->getClientConfigUrl());
     $this->selectView();
 }
开发者ID:nagyist,项目名称:tao-extension-tao-item,代码行数:25,代码来源:class.ItemRunner.php

示例5: hasAccess

 /**
  * Compatibility class for old implementation
  * 
  * @param string $extension
  * @param string $controller
  * @param string $action
  * @param array $parameters
  * @return boolean
  * @deprecated
  */
 public function hasAccess($action, $controller, $extension, $parameters = array())
 {
     $user = common_session_SessionManager::getSession()->getUser();
     $uri = funcAcl_models_classes_ModuleAccessService::singleton()->makeEMAUri($extension, $controller);
     $controllerClassName = funcAcl_helpers_Map::getControllerFromUri($uri);
     return self::accessPossible($user, $controllerClassName, $action);
 }
开发者ID:oat-sa,项目名称:extension-tao-funcacl,代码行数:17,代码来源:class.FuncAcl.php

示例6: loadModule

 /**
  * (non-PHPdoc)
  * @see FrontController::loadModule()
  */
 public function loadModule()
 {
     $resolver = new Resolver($this->getRequest());
     // load the responsible extension
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     // load translations
     $uiLang = \common_session_SessionManager::getSession()->getInterfaceLanguage();
     \tao_helpers_I18n::init($ext, $uiLang);
     //if the controller is a rest controller we try to authenticate the user
     $controllerClass = $resolver->getControllerClass();
     if (is_subclass_of($controllerClass, 'tao_actions_CommonRestModule')) {
         $authAdapter = new \tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
         try {
             $user = $authAdapter->authenticate();
             $session = new \common_session_RestSession($user);
             \common_session_SessionManager::startSession($session);
         } catch (\common_user_auth_AuthFailedException $e) {
             $class = new $controllerClass();
             $class->requireLogin();
         }
     }
     try {
         $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $this->getRequest()->getParams());
         $enforcer->execute();
     } catch (InterruptedActionException $iE) {
         // Nothing to do here.
     }
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:33,代码来源:TaoFrontController.php

示例7: getUserUri

 /**
  * Get the URI (Uniform Resource Identifier) of the user the Test Session belongs to.
  *
  * @return string
  */
 public function getUserUri()
 {
     if (is_null($this->userUri)) {
         return \common_session_SessionManager::getSession()->getUserUri();
     }
     return $this->userUri;
 }
开发者ID:oat-sa,项目名称:extension-tao-testqti,代码行数:12,代码来源:TestSession.php

示例8: testDisplayDateDefaultTimeZone

 /**
  *
  * @author Lionel Lecaque, lionel@taotesting.com
  */
 public function testDisplayDateDefaultTimeZone()
 {
     $mybirthday = DateTime::createFromFormat('Y-m-d H:i:s.u', '1980-02-01 10:00:00.012345', new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone()));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthday));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.012', tao_helpers_Date::displayeDate($mybirthday, tao_helpers_Date::FORMAT_ISO8601));
     $mybirthdayTs = $mybirthday->getTimeStamp();
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthdayTs));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.000', tao_helpers_Date::displayeDate($mybirthdayTs, tao_helpers_Date::FORMAT_ISO8601));
     $literal = new \core_kernel_classes_Literal($mybirthdayTs);
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($literal));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.000', tao_helpers_Date::displayeDate($literal, tao_helpers_Date::FORMAT_ISO8601));
     $ms = tao_helpers_Date::getTimeStampWithMicroseconds($mybirthday);
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($ms));
     $this->assertEquals('01/02/1980 10:00:00', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_LONG));
     $this->assertEquals('1980-02-01 10:00', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_DATEPICKER));
     $this->assertEquals('February 1, 1980, 10:00:00 am', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_VERBOSE));
     $this->assertEquals('1980-02-01T10:00:00.012', tao_helpers_Date::displayeDate($ms, tao_helpers_Date::FORMAT_ISO8601));
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:31,代码来源:DateHelperTest.php

示例9: saveExtra

 /**
  * Stores extended state information
  * @param string $testSessionId
  * @param array $extra
  */
 protected function saveExtra($testSessionId, $extra)
 {
     self::$cache[$testSessionId] = $extra;
     $storageService = \tao_models_classes_service_StateStorage::singleton();
     $userUri = \common_session_SessionManager::getSession()->getUserUri();
     $storageService->set($userUri, self::STORAGE_PREFIX . $testSessionId, json_encode($extra));
 }
开发者ID:oat-sa,项目名称:extension-tao-testqti,代码行数:12,代码来源:ExtendedStateService.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     $tzName = $this->getRequestParameter('timeZone') === null ? \common_session_SessionManager::getSession()->getTimeZone() : $this->getRequestParameter('timeZone');
     $this->tz = new \DateTimeZone($tzName);
     $this->scheduleService = DeliveryScheduleService::singleton();
     $this->service = DeliveryAssemblyService::singleton();
     switch ($this->getRequestMethod()) {
         case "GET":
             $this->action = 'get';
             break;
         case "PUT":
             $this->action = 'update';
             break;
         case "POST":
             $this->action = 'create';
             break;
         case "DELETE":
             $this->action = 'deleteDelivery';
             break;
         default:
             $this->sendData(array('message' => 'Not found'), 404);
             exit;
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-schedule,代码行数:25,代码来源:CalendarApi.php

示例11: legacy

 /**
  * Run the controller
  * 
  * @param common_http_Request $pRequest
  * @throws \ActionEnforcingException
  * @throws \Exception
  * @throws \common_exception_Error
  * @throws \common_ext_ExtensionException
  */
 public function legacy(common_http_Request $pRequest)
 {
     $resolver = new Resolver($pRequest);
     // load the responsible extension
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     // load translations
     $uiLang = \common_session_SessionManager::getSession()->getInterfaceLanguage();
     \tao_helpers_I18n::init($ext, $uiLang);
     //if the controller is a rest controller we try to authenticate the user
     $controllerClass = $resolver->getControllerClass();
     if (is_subclass_of($controllerClass, \tao_actions_RestController::class)) {
         $authAdapter = new \tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
         try {
             $user = $authAdapter->authenticate();
             $session = new \common_session_RestSession($user);
             \common_session_SessionManager::startSession($session);
         } catch (\common_user_auth_AuthFailedException $e) {
             $data['success'] = false;
             $data['errorCode'] = '401';
             $data['errorMsg'] = 'You are not authorized to access this functionality.';
             $data['version'] = TAO_VERSION;
             header('HTTP/1.0 401 Unauthorized');
             header('WWW-Authenticate: Basic realm="' . GENERIS_INSTANCE_NAME . '"');
             echo json_encode($data);
             exit(0);
         }
     }
     try {
         $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $pRequest->getParams());
         $enforcer->execute();
     } catch (InterruptedActionException $iE) {
         // Nothing to do here.
     }
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:44,代码来源:TaoFrontController.php

示例12: sendSelfMsg

 public function sendSelfMsg()
 {
     $message = new Message();
     $message->setTo(\common_session_SessionManager::getSession()->getUser());
     $message->setBody('<h1>Tao Dev Message send on the ' . \tao_helpers_Date::displayeDate(time()) . '</h1>');
     $success = MessagingService::singleton()->send($message);
     return $this->returnJson(array('success' => $success, 'message' => __('Send a message')));
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:8,代码来源:ScriptRunner.php

示例13: getPrivatePathByLanguage

 /**
  * Get the flysystem path to the compilation folder described by $directory.
  * 
  * @param tao_models_classes_service_StorageDirectory $directory The root directory resource where the item is stored.
  * @return string The flysystem path to the private folder with a trailing directory separator.
  */
 public static function getPrivatePathByLanguage(tao_models_classes_service_StorageDirectory $directory)
 {
     $lang = \common_session_SessionManager::getSession()->getDataLanguage();
     if (!$directory->has($lang) && $directory->has(DEFAULT_LANG)) {
         $lang = DEFAULT_LANG;
     }
     return $lang . DIRECTORY_SEPARATOR;
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:14,代码来源:QtiRunner.php

示例14: getLtiSession

 /**
  * Returns the current LTI session
  * @return taoLti_models_classes_TaoLtiSession 
  */
 public function getLtiSession()
 {
     $session = common_session_SessionManager::getSession();
     if (!$session instanceof taoLti_models_classes_TaoLtiSession) {
         throw new taoLti_models_classes_LtiException(__FUNCTION__ . ' called on a non LTI session');
     }
     return $session;
 }
开发者ID:nagyist,项目名称:extension-tao-lti,代码行数:12,代码来源:class.LtiService.php

示例15: restore

 public function restore()
 {
     $currentSession = \common_session_SessionManager::getSession();
     if ($currentSession instanceof \common_session_RestrictedSession) {
         $currentSession->restoreOriginal();
     }
     $this->redirect(_url('index', 'Main', 'tao'));
 }
开发者ID:nagyist,项目名称:extension-tao-devtools,代码行数:8,代码来源:UserDebug.php


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