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


PHP sfSessionStorage::read方法代码示例

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


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

示例1: getFavorites

 /**
  * @return ArrayObject
  */
 public static function getFavorites()
 {
     $session = new sfSessionStorage();
     if ($session->read('favorites') === null) {
         $session->initialize(array('session_cookie_lifetime' => 2592000));
         $session->write('favorites', new ArrayObject(array()));
     }
     return $session->read('favorites');
 }
开发者ID:HHirano,项目名称:TEST100,代码行数:12,代码来源:Utils.php

示例2: realpath

ob_start();
$_test_dir = realpath(dirname(__FILE__) . '/../../');
require_once $_test_dir . '/../lib/vendor/lime/lime.php';
sfConfig::set('sf_symfony_lib_dir', realpath($_test_dir . '/../lib'));
$t = new lime_test(8, new lime_output_color());
// initialize the storage
try {
    $storage = new sfSessionStorage();
    $t->pass('->__construct() does not throw an exception when not provided with options');
} catch (InvalidArgumentException $e) {
    $t->fail('->__construct() Startup failure');
}
$storage = new sfSessionStorage();
$t->ok($storage instanceof sfStorage, '->__construct() is an instance of sfStorage');
$storage->write('test', 123);
$t->is($storage->read('test'), 123, '->read() can read data that has been written to storage');
// regenerate()
$oldSessionData = 'foo:bar';
$key = md5($oldSessionData);
$storage->write($key, $oldSessionData);
$session_id = session_id();
$storage->regenerate(false);
$t->is($storage->read($key), $oldSessionData, '->regenerate(false) regenerated the session with a different session id - this class by default doesn\'t regen the id');
$t->isnt(session_id(), $session_id, '->regenerate(false) regenerated the session with a different session id');
$storage->regenerate(true);
$t->is($storage->read($key), $oldSessionData, '->regenerate(true) regenerated the session with a different session id and destroyed data');
$t->isnt(session_id(), $session_id, '->regenerate(true) regenerated the session with a different session id');
$storage->remove($key);
$t->is($storage->read($key), null, '->remove() removes data from the storage');
// shutdown the storage
$storage->shutdown();
开发者ID:mediasadc,项目名称:alba,代码行数:31,代码来源:sfSessionStorageTest.php

示例3: invokeAction

 /**
  * Invoke an action given its name
  *
  * This function requests information necessary to operate on
  * VSES017 AIS application
  *
  * @param Trace $trace trace object
  * @param string $action action name
  * @param Request $request incoming request
  */
 public function invokeAction(Trace $trace, $action, Request $request)
 {
     Preconditions::checkIsString($action);
     if (!$this->loginManager->isLoggedIn()) {
         throw new AuthenticationRequiredException();
     }
     Preconditions::checkNotNull($request);
     // check access to application
     $apps = $this->session->read('ais/aisApps');
     if (!is_array($apps)) {
         throw new Exception("Interná chyba - zoznam AIS aplikácii je nekorektný.");
     }
     if (!in_array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA, $apps)) {
         return $this->renderResponse('studium/notAvailable');
     }
     $screenFactory = $this->factory;
     $adminStudia = $screenFactory->newAdministraciaStudiaScreen($trace);
     $this->administraciaStudiaScreen = $adminStudia;
     $this->studium = $request->getParameter('studium', '0');
     $this->zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:"));
     $this->zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium);
     $this->warnings->warnWrongTableStructure($trace, 'zoznam studii', regression\ZoznamStudiiRegression::get(), $this->zoznamStudii->getTableDefinition());
     $this->warnings->warnWrongTableStructure($trace, 'zoznam zapisnych listov', regression\ZoznamZapisnychListovRegression::get(), $this->zapisneListy->getTableDefinition());
     $zapisneListyData = $this->zapisneListy->getData();
     if (count($zapisneListyData) == 0) {
         $this->zapisnyList = null;
         $this->terminyHodnoteniaScreen = null;
         $this->hodnoteniaScreen = null;
         $this->templateParams['zapisnyListObj'] = null;
     } else {
         $this->zapisnyList = $request->getParameter('list');
         if ($this->zapisnyList === '') {
             // Ak nemame nastaveny zapisny list, zobreme aktualny
             // ak nenajdeme aktualny, zoberme posledny v zozname
             $aktualnyAkadRok = FajrUtils::getAcademicYear();
             $this->zapisnyList = null;
             foreach ($zapisneListyData as $zapList) {
                 if ($zapList['popisAkadRok'] == $aktualnyAkadRok) {
                     $this->zapisnyList = $zapList['index'];
                 }
             }
             // nenasli sme
             if ($this->zapisnyList === null) {
                 $lastList = end($zapisneListyData);
                 $this->zapisnyList = $lastList['index'];
             }
         }
         $this->zapisnyList = intval($this->zapisnyList);
         $this->zapisnyListObj = $zapisneListyData[$this->zapisnyList];
         $this->templateParams['zapisnyListObj'] = $this->zapisnyListObj;
         try {
             $this->terminyHodnoteniaScreen = $screenFactory->newTerminyHodnoteniaScreen($trace, $adminStudia->getParamNameFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_TERMINY_HODNOTENIA));
         } catch (ParseException $e) {
             $this->terminyHodnoteniaScreen = null;
         }
         // FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
         // objekty, ktore v konstruktore robia requesty
         $this->hodnoteniaScreen = $screenFactory->newHodnoteniaPriemeryScreen($trace, $adminStudia->getParamNameFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_HODNOTENIA_PRIEMERY));
     }
     $this->templateParams['currentTab'] = '';
     $this->templateParams['zoznamStudii'] = $this->zoznamStudii;
     $this->templateParams['studium'] = $this->studium;
     // TODO(anty): refactor
     $zoznamStudiiData = $this->zoznamStudii->getData();
     $this->templateParams['studiumObj'] = $zoznamStudiiData[$this->studium];
     $this->templateParams['zapisneListy'] = $this->zapisneListy;
     $this->templateParams['zapisnyList'] = $this->zapisnyList;
     // TODO(anty): refactor
     if (array_key_exists($action, $this->actionInfo)) {
         $info = $this->actionInfo[$action];
         if ($info['requiresZapisnyList'] && $this->zapisnyList === null) {
             $this->templateParams['activeTab'] = $info['tabName'];
             return $this->renderResponse('studium/chybaZapisnyList', $this->templateParams);
         }
     }
     $result = parent::invokeAction($trace, $action, $request);
     if ($this->terminyHodnoteniaScreen) {
         $this->terminyHodnoteniaScreen->closeWindow();
     }
     if ($this->hodnoteniaScreen) {
         $this->hodnoteniaScreen->closeWindow();
     }
     if ($this->administraciaStudiaScreen) {
         $this->administraciaStudiaScreen->closeWindow();
     }
     return $result;
 }
开发者ID:BGCX067,项目名称:fajr-git,代码行数:97,代码来源:StudiumController.php


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