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 
)

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

References $questionId, and $userId.

Member Function Documentation

◆ addRequestedHint()

ilAssQuestionPreviewSession::addRequestedHint (   $hintId)

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

References readSessionValue(), and saveSessionValue().

91  {
92  $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
93  $requestedHints[$hintId] = $hintId;
94  $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, $requestedHints);
95  }
+ Here is the call graph for this function:

◆ ensureSessionStructureExists()

ilAssQuestionPreviewSession::ensureSessionStructureExists ( )
private

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

References $_SESSION, and getSessionContextIndex().

Referenced by init().

123  {
124  if(!isset($_SESSION[self::SESSION_BASEINDEX]) || !is_array($_SESSION[self::SESSION_BASEINDEX]))
125  {
126  $_SESSION[self::SESSION_BASEINDEX] = array();
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  {
140  $contextSession[self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE] = 0;
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"]
+ 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.

References readSessionValue().

80  {
81  return count($this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS));
82  }
+ Here is the call graph for this function:

◆ getParticipantsSolution()

◆ getQuestionId()

ilAssQuestionPreviewSession::getQuestionId ( )

◆ getRandomizerSeed()

ilAssQuestionPreviewSession::getRandomizerSeed ( )

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

References readSessionValue().

Referenced by randomizerSeedExists().

113  {
114  return $this->readSessionValue(self::SESSION_SUBINDEX_RANDOMIZER_SEED);
115  }
+ 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.

References readSessionValue().

98  {
99  return $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
100  }
+ Here is the call graph for this function:

◆ getSessionContextIndex()

ilAssQuestionPreviewSession::getSessionContextIndex ( )
private

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

Referenced by ensureSessionStructureExists(), 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:

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

References readSessionValue().

85  {
86  $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
87  return isset($requestedHints[$hintId]);
88  }
+ Here is the call graph for this function:

◆ isInstantResponseActive()

ilAssQuestionPreviewSession::isInstantResponseActive ( )

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

References readSessionValue().

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

◆ randomizerSeedExists()

ilAssQuestionPreviewSession::randomizerSeedExists ( )

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

References getRandomizerSeed().

118  {
119  return ($this->getRandomizerSeed() !== null);
120  }
+ Here is the call graph for this function:

◆ readSessionValue()

ilAssQuestionPreviewSession::readSessionValue (   $subIndex)
private

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

References $_SESSION, and getSessionContextIndex().

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

55  {
56  return $_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:

◆ resetRequestedHints()

ilAssQuestionPreviewSession::resetRequestedHints ( )

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

References saveSessionValue().

103  {
104  $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, array());
105  }
+ 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 59 of file class.ilAssQuestionPreviewSession.php.

References saveSessionValue().

60  {
61  $this->saveSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE, $instantResponseActive);
62  }
+ 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.

References saveSessionValue().

108  {
109  $this->saveSessionValue(self::SESSION_SUBINDEX_RANDOMIZER_SEED, $seed);
110  }
+ 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: