ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssQuestionPreviewSession Class Reference
+ Collaboration diagram for ilAssQuestionPreviewSession:

Public Member Functions

 __construct ($userId, $questionId)
 
 init ()
 
 getUserId ()
 
 getQuestionId ()
 
 setInstantResponseActive ($instantResponseActive)
 
 isInstantResponseActive ()
 
 setParticipantsSolution ($participantSolution)
 
 getParticipantsSolution ()
 
 getNumRequestedHints ()
 
 isHintRequested ($hintId)
 
 addRequestedHint ($hintId)
 
 getRequestedHints ()
 
 resetRequestedHints ()
 
 setRandomizerSeed ($seed)
 
 getRandomizerSeed ()
 
 randomizerSeedExists ()
 

Data Fields

const SESSION_BASEINDEX = 'ilAssQuestionPreviewSessions'
 
const SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE = 'instantResponseActive'
 
const SESSION_SUBINDEX_PARTICIPANT_SOLUTION = 'participantSolution'
 
const SESSION_SUBINDEX_REQUESTED_HINTS = 'requestedHints'
 
const SESSION_SUBINDEX_RANDOMIZER_SEED = 'randomizerSeed'
 

Private Member Functions

 getSessionContextIndex ()
 
 saveSessionValue ($subIndex, $value)
 
 readSessionValue ($subIndex)
 
 ensureSessionStructureExists ()
 

Private Attributes

 $userId
 
 $questionId
 

Detailed Description

Definition at line 11 of file class.ilAssQuestionPreviewSession.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionPreviewSession::__construct (   $userId,
  $questionId 
)

Member Function Documentation

◆ addRequestedHint()

ilAssQuestionPreviewSession::addRequestedHint (   $hintId)

Definition at line 90 of file class.ilAssQuestionPreviewSession.php.

91 {
92 $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
93 $requestedHints[$hintId] = $hintId;
94 $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, $requestedHints);
95 }

References readSessionValue(), and saveSessionValue().

+ Here is the call graph for this function:

◆ ensureSessionStructureExists()

ilAssQuestionPreviewSession::ensureSessionStructureExists ( )
private

Definition at line 122 of file class.ilAssQuestionPreviewSession.php.

123 {
124 if(!isset($_SESSION[self::SESSION_BASEINDEX]) || !is_array($_SESSION[self::SESSION_BASEINDEX]))
125 {
127 }
128
129 $baseSession = &$_SESSION[self::SESSION_BASEINDEX];
130
131 if(!isset($baseSession[$this->getSessionContextIndex()]))
132 {
133 $baseSession[$this->getSessionContextIndex()] = array();
134 }
135
136 $contextSession = &$baseSession[$this->getSessionContextIndex()];
137
138 if(!isset($contextSession[self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE]))
139 {
141 }
142
143 if(!isset($contextSession[self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION]))
144 {
145 $contextSession[self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION] = null;
146 }
147
148 if(!isset($contextSession[self::SESSION_SUBINDEX_RANDOMIZER_SEED]))
149 {
150 $contextSession[self::SESSION_SUBINDEX_RANDOMIZER_SEED] = null;
151 }
152 }
$_SESSION["AccountId"]

References $_SESSION, getSessionContextIndex(), SESSION_BASEINDEX, SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE, SESSION_SUBINDEX_PARTICIPANT_SOLUTION, and SESSION_SUBINDEX_RANDOMIZER_SEED.

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumRequestedHints()

ilAssQuestionPreviewSession::getNumRequestedHints ( )

Definition at line 79 of file class.ilAssQuestionPreviewSession.php.

80 {
81 return count($this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS));
82 }

References readSessionValue().

+ Here is the call graph for this function:

◆ getParticipantsSolution()

◆ getQuestionId()

ilAssQuestionPreviewSession::getQuestionId ( )

Definition at line 39 of file class.ilAssQuestionPreviewSession.php.

40 {
41 return $this->questionId;
42 }

References $questionId.

◆ getRandomizerSeed()

ilAssQuestionPreviewSession::getRandomizerSeed ( )

Definition at line 112 of file class.ilAssQuestionPreviewSession.php.

113 {
114 return $this->readSessionValue(self::SESSION_SUBINDEX_RANDOMIZER_SEED);
115 }

References readSessionValue().

Referenced by randomizerSeedExists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequestedHints()

ilAssQuestionPreviewSession::getRequestedHints ( )

Definition at line 97 of file class.ilAssQuestionPreviewSession.php.

98 {
99 return $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
100 }

References readSessionValue().

+ Here is the call graph for this function:

◆ getSessionContextIndex()

ilAssQuestionPreviewSession::getSessionContextIndex ( )
private

Definition at line 44 of file class.ilAssQuestionPreviewSession.php.

45 {
46 return "u{$this->userId}::q{$this->questionId}";
47 }

Referenced by ensureSessionStructureExists(), readSessionValue(), and saveSessionValue().

+ Here is the caller graph for this function:

◆ getUserId()

ilAssQuestionPreviewSession::getUserId ( )

Definition at line 34 of file class.ilAssQuestionPreviewSession.php.

35 {
36 return $this->userId;
37 }

References $userId.

Referenced by assFileUpload\savePreviewData().

+ Here is the caller graph for this function:

◆ init()

ilAssQuestionPreviewSession::init ( )

Definition at line 29 of file class.ilAssQuestionPreviewSession.php.

References ensureSessionStructureExists().

+ Here is the call graph for this function:

◆ isHintRequested()

ilAssQuestionPreviewSession::isHintRequested (   $hintId)

Definition at line 84 of file class.ilAssQuestionPreviewSession.php.

85 {
86 $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
87 return isset($requestedHints[$hintId]);
88 }

References readSessionValue().

+ Here is the call graph for this function:

◆ isInstantResponseActive()

ilAssQuestionPreviewSession::isInstantResponseActive ( )

Definition at line 64 of file class.ilAssQuestionPreviewSession.php.

65 {
66 return $this->readSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE);
67 }

References readSessionValue().

+ Here is the call graph for this function:

◆ randomizerSeedExists()

ilAssQuestionPreviewSession::randomizerSeedExists ( )

Definition at line 117 of file class.ilAssQuestionPreviewSession.php.

118 {
119 return ($this->getRandomizerSeed() !== null);
120 }

References getRandomizerSeed().

+ Here is the call graph for this function:

◆ readSessionValue()

ilAssQuestionPreviewSession::readSessionValue (   $subIndex)
private

Definition at line 54 of file class.ilAssQuestionPreviewSession.php.

55 {
56 return $_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex];
57 }

References $_SESSION, getSessionContextIndex(), and SESSION_BASEINDEX.

Referenced by addRequestedHint(), getNumRequestedHints(), getParticipantsSolution(), getRandomizerSeed(), getRequestedHints(), isHintRequested(), and isInstantResponseActive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetRequestedHints()

ilAssQuestionPreviewSession::resetRequestedHints ( )

Definition at line 102 of file class.ilAssQuestionPreviewSession.php.

103 {
104 $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, array());
105 }

References saveSessionValue().

+ Here is the call graph for this function:

◆ saveSessionValue()

ilAssQuestionPreviewSession::saveSessionValue (   $subIndex,
  $value 
)
private

Definition at line 49 of file class.ilAssQuestionPreviewSession.php.

50 {
51 $_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex] = $value;
52 }

References $_SESSION, getSessionContextIndex(), and SESSION_BASEINDEX.

Referenced by addRequestedHint(), resetRequestedHints(), setInstantResponseActive(), setParticipantsSolution(), and setRandomizerSeed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setInstantResponseActive()

ilAssQuestionPreviewSession::setInstantResponseActive (   $instantResponseActive)

Definition at line 59 of file class.ilAssQuestionPreviewSession.php.

60 {
61 $this->saveSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE, $instantResponseActive);
62 }

References saveSessionValue().

+ Here is the call graph for this function:

◆ setParticipantsSolution()

ilAssQuestionPreviewSession::setParticipantsSolution (   $participantSolution)

◆ setRandomizerSeed()

ilAssQuestionPreviewSession::setRandomizerSeed (   $seed)

Definition at line 107 of file class.ilAssQuestionPreviewSession.php.

108 {
109 $this->saveSessionValue(self::SESSION_SUBINDEX_RANDOMIZER_SEED, $seed);
110 }

References saveSessionValue().

+ Here is the call graph for this function:

Field Documentation

◆ $questionId

ilAssQuestionPreviewSession::$questionId
private

Definition at line 21 of file class.ilAssQuestionPreviewSession.php.

Referenced by __construct(), and getQuestionId().

◆ $userId

ilAssQuestionPreviewSession::$userId
private

Definition at line 20 of file class.ilAssQuestionPreviewSession.php.

Referenced by __construct(), and getUserId().

◆ SESSION_BASEINDEX

const ilAssQuestionPreviewSession::SESSION_BASEINDEX = 'ilAssQuestionPreviewSessions'

◆ SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE = 'instantResponseActive'

Definition at line 15 of file class.ilAssQuestionPreviewSession.php.

Referenced by ensureSessionStructureExists().

◆ SESSION_SUBINDEX_PARTICIPANT_SOLUTION

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_PARTICIPANT_SOLUTION = 'participantSolution'

Definition at line 16 of file class.ilAssQuestionPreviewSession.php.

Referenced by ensureSessionStructureExists().

◆ SESSION_SUBINDEX_RANDOMIZER_SEED

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_RANDOMIZER_SEED = 'randomizerSeed'

Definition at line 18 of file class.ilAssQuestionPreviewSession.php.

Referenced by ensureSessionStructureExists().

◆ SESSION_SUBINDEX_REQUESTED_HINTS

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_REQUESTED_HINTS = 'requestedHints'

Definition at line 17 of file class.ilAssQuestionPreviewSession.php.


The documentation for this class was generated from the following file: