ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssQuestionPreviewSession Class Reference
+ Collaboration diagram for ilAssQuestionPreviewSession:

Public Member Functions

 __construct ($userId, $questionId)
 
 init ()
 
 getUserId ()
 
 getQuestionId ()
 
 setInstantResponseActive ($instantResponseActive)
 
 isInstantResponseActive ()
 
 setParticipantsSolution ($participantSolution)
 
 getParticipantsSolution ()
 
 hasParticipantSolution ()
 
 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)
 
 issetSessionValue ($subIndex)
 
 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 
)

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

References $questionId, and $userId.

Member Function Documentation

◆ addRequestedHint()

ilAssQuestionPreviewSession::addRequestedHint (   $hintId)

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

References readSessionValue(), and saveSessionValue().

107  {
108  $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
109  $requestedHints[$hintId] = $hintId;
110  $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, $requestedHints);
111  }
+ Here is the call graph for this function:

◆ ensureSessionStructureExists()

ilAssQuestionPreviewSession::ensureSessionStructureExists ( )
private

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

References $_SESSION, array, and getSessionContextIndex().

Referenced by init().

139  {
140  if(!isset($_SESSION[self::SESSION_BASEINDEX]) || !is_array($_SESSION[self::SESSION_BASEINDEX]))
141  {
142  $_SESSION[self::SESSION_BASEINDEX] = array();
143  }
144 
145  $baseSession = &$_SESSION[self::SESSION_BASEINDEX];
146 
147  if(!isset($baseSession[$this->getSessionContextIndex()]))
148  {
149  $baseSession[$this->getSessionContextIndex()] = array();
150  }
151 
152  $contextSession = &$baseSession[$this->getSessionContextIndex()];
153 
154  if(!isset($contextSession[self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE]))
155  {
156  $contextSession[self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE] = 0;
157  }
158 
159  if(!isset($contextSession[self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION]))
160  {
161  $contextSession[self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION] = null;
162  }
163 
164  if(!isset($contextSession[self::SESSION_SUBINDEX_RANDOMIZER_SEED]))
165  {
166  $contextSession[self::SESSION_SUBINDEX_RANDOMIZER_SEED] = null;
167  }
168  }
$_SESSION["AccountId"]
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumRequestedHints()

ilAssQuestionPreviewSession::getNumRequestedHints ( )

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

References readSessionValue().

90  {
91  $hints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
92 
93  if (!is_array($hints)) {
94  return 0;
95  }
96 
97  return count($hints);
98  }
+ Here is the call graph for this function:

◆ getParticipantsSolution()

◆ getQuestionId()

ilAssQuestionPreviewSession::getQuestionId ( )

◆ getRandomizerSeed()

ilAssQuestionPreviewSession::getRandomizerSeed ( )

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

References readSessionValue().

Referenced by randomizerSeedExists().

129  {
130  return $this->readSessionValue(self::SESSION_SUBINDEX_RANDOMIZER_SEED);
131  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequestedHints()

ilAssQuestionPreviewSession::getRequestedHints ( )

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

References readSessionValue().

114  {
115  return $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
116  }
+ Here is the call graph for this function:

◆ getSessionContextIndex()

ilAssQuestionPreviewSession::getSessionContextIndex ( )
private

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

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

45  {
46  return "u{$this->userId}::q{$this->questionId}";
47  }
+ Here is the caller graph for this function:

◆ getUserId()

ilAssQuestionPreviewSession::getUserId ( )

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

References $userId.

Referenced by assFileUpload\savePreviewData().

+ Here is the caller graph for this function:

◆ hasParticipantSolution()

ilAssQuestionPreviewSession::hasParticipantSolution ( )

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

References issetSessionValue().

Referenced by assOrderingQuestion\calculateReachedPointsFromPreviewSession().

85  {
86  return $this->issetSessionValue(self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION);
87  }
+ Here is the call graph for this function:
+ 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 100 of file class.ilAssQuestionPreviewSession.php.

References readSessionValue().

101  {
102  $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
103  return isset($requestedHints[$hintId]);
104  }
+ Here is the call graph for this function:

◆ isInstantResponseActive()

ilAssQuestionPreviewSession::isInstantResponseActive ( )

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

References readSessionValue().

70  {
71  return $this->readSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE);
72  }
+ Here is the call graph for this function:

◆ issetSessionValue()

ilAssQuestionPreviewSession::issetSessionValue (   $subIndex)
private

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

References $_SESSION, and getSessionContextIndex().

Referenced by hasParticipantSolution().

55  {
56  return isset($_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex]);
57  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ randomizerSeedExists()

ilAssQuestionPreviewSession::randomizerSeedExists ( )

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

References getRandomizerSeed().

134  {
135  return ($this->getRandomizerSeed() !== null);
136  }
+ Here is the call graph for this function:

◆ readSessionValue()

ilAssQuestionPreviewSession::readSessionValue (   $subIndex)
private

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

References $_SESSION, and getSessionContextIndex().

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

60  {
61  return $_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex];
62  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetRequestedHints()

ilAssQuestionPreviewSession::resetRequestedHints ( )

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

References array, and saveSessionValue().

119  {
120  $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, array());
121  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ saveSessionValue()

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

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

References $_SESSION, and getSessionContextIndex().

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

50  {
51  $_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex] = $value;
52  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setInstantResponseActive()

ilAssQuestionPreviewSession::setInstantResponseActive (   $instantResponseActive)

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

References saveSessionValue().

65  {
66  $this->saveSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE, $instantResponseActive);
67  }
+ Here is the call graph for this function:

◆ setParticipantsSolution()

ilAssQuestionPreviewSession::setParticipantsSolution (   $participantSolution)

◆ setRandomizerSeed()

ilAssQuestionPreviewSession::setRandomizerSeed (   $seed)

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

References saveSessionValue().

124  {
125  $this->saveSessionValue(self::SESSION_SUBINDEX_RANDOMIZER_SEED, $seed);
126  }
+ 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'

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

◆ SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE = 'instantResponseActive'

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

◆ SESSION_SUBINDEX_PARTICIPANT_SOLUTION

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_PARTICIPANT_SOLUTION = 'participantSolution'

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

◆ SESSION_SUBINDEX_RANDOMIZER_SEED

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_RANDOMIZER_SEED = 'randomizerSeed'

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

◆ 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: