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


PHP common_session_SessionManager类代码示例

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


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

示例1: __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

示例2: 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

示例3: 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

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $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) {
         $this->requireLogin();
     }
     /*
     	    $this->headers = tao_helpers_Http::getHeaders();
     	    $this->files = tao_helpers_Http::getFiles();
     */
     if ($this->hasHeader("Accept")) {
         try {
             $this->responseEncoding = tao_helpers_Http::acceptHeader($this->acceptedMimeTypes, $this->getHeader("Accept"));
         } catch (common_exception_ClientException $e) {
             $this->returnFailure($e);
         }
     }
     if ($this->hasHeader("Accept-Language")) {
         try {
         } catch (common_exception_ClientException $e) {
             $this->returnFailure($e);
         }
     }
     header('Content-Type: ' . $this->responseEncoding);
     //check auth method requested
     /**/
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:32,代码来源:class.CommonRestModule.php

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: login

 /**
  * action to perform authwith open_ID
  */
 public function login()
 {
     try {
         # Change 'localhost' to your domain name.
         $openid = new LightOpenID('http://e-learning-22/');
         $openid_identfier = "http://192.168.0.201:8080/Sayegh-OpenID-Provider/auth";
         if (!$openid->mode) {
             if (isset($openid_identfier)) {
                 $openid->identity = $openid_identfier;
                 # The following two lines request email, full name, and a nickname
                 # from the provider. Remove them if you don't need that data.
                 $openid->required = array('contact/email', 'namePerson');
                 $openid->optional = array("role");
                 header('Location: ' . $openid->authUrl());
                 die;
             }
             ?>
             WTF you should never reached here! XO
             <?php 
         } elseif ($openid->mode == 'cancel') {
             echo 'User has canceled authentication!';
         } else {
             $res = $openid->getAttributes();
             // [contact/email] => sara@syrianep.com [namePerson] => sara lakah
             $user = new OpenIDUser(new \core_kernel_classes_Resource("http://sep.com/" . $res['contact/email']));
             $session = new \common_session_DefaultSession($user);
             \common_session_SessionManager::startSession($session);
             $this->redirect(_url('entry', 'Main', "tao"));
             //   echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
             //  print_r($openid->getAttributes());
         }
     } catch (ErrorException $e) {
         echo $e->getMessage();
     }
 }
开发者ID:khaledvic,项目名称:oat-tao-tao-openid-auth,代码行数:38,代码来源:OpenIDLogin.php

示例10: loadModule

 /**
  * (non-PHPdoc)
  * @see FrontController::loadModule()
  */
 public function loadModule()
 {
     $resolver = new Resolver($this->getRequest());
     // load the responsible extension
     common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     //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:swapnilaptara,项目名称:tao-aptara-assess,代码行数:30,代码来源:TaoFrontController.php

示例11: 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

示例12: 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

示例13: 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

示例14: getCurrentUserMap

 public static function getCurrentUserMap()
 {
     $user = \common_session_SessionManager::getSession()->getUser();
     if (is_null(self::$current) || self::$current->getUserId() != $user->getIdentifier()) {
         self::$current = new self($user->getIdentifier());
     }
     return self::$current;
 }
开发者ID:nagyist,项目名称:extension-tao-workspace,代码行数:8,代码来源:WorkspaceMap.php

示例15: 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


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