ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 ()
 

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'
 

Private Member Functions

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

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 111 of file class.ilAssQuestionPreviewSession.php.

112 {
113 $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
114 $requestedHints[$hintId] = $hintId;
115 $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, $requestedHints);
116 }

References readSessionValue(), and saveSessionValue().

+ Here is the call graph for this function:

◆ getNumRequestedHints()

ilAssQuestionPreviewSession::getNumRequestedHints ( )

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

101 {
102 return count($this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS));
103 }

References readSessionValue().

+ Here is the call graph for this function:

◆ getParticipantsSolution()

◆ getQuestionId()

ilAssQuestionPreviewSession::getQuestionId ( )

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

61 {
62 return $this->questionId;
63 }

References $questionId.

◆ getRequestedHints()

ilAssQuestionPreviewSession::getRequestedHints ( )

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

119 {
120 return $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
121 }

References readSessionValue().

+ Here is the call graph for this function:

◆ getSessionContextIndex()

ilAssQuestionPreviewSession::getSessionContextIndex ( )
private

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

66 {
67 return "u{$this->userId}::q{$this->questionId}";
68 }

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

+ Here is the caller graph for this function:

◆ getUserId()

ilAssQuestionPreviewSession::getUserId ( )

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

56 {
57 return $this->userId;
58 }

References $userId.

Referenced by assFileUpload\savePreviewData().

+ Here is the caller graph for this function:

◆ init()

ilAssQuestionPreviewSession::init ( )

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

29 {
30 if( !isset($_SESSION[self::SESSION_BASEINDEX]) || !is_array($_SESSION[self::SESSION_BASEINDEX]) )
31 {
33 }
34
35 $baseSession = &$_SESSION[self::SESSION_BASEINDEX];
36
37 if( !isset($baseSession[$this->getSessionContextIndex()]) )
38 {
39 $baseSession[$this->getSessionContextIndex()] = array();
40 }
41
42 $contextSession = &$baseSession[$this->getSessionContextIndex()];
43
44 if( !isset($contextSession[self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE]) )
45 {
47 }
48
49 if( !isset($contextSession[self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION]) )
50 {
51 $contextSession[self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION] = null;
52 }
53 }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

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

+ Here is the call graph for this function:

◆ isHintRequested()

ilAssQuestionPreviewSession::isHintRequested (   $hintId)

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

106 {
107 $requestedHints = $this->readSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS);
108 return isset($requestedHints[$hintId]);
109 }

References readSessionValue().

+ Here is the call graph for this function:

◆ isInstantResponseActive()

ilAssQuestionPreviewSession::isInstantResponseActive ( )

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

86 {
87 return $this->readSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE);
88 }

References readSessionValue().

+ Here is the call graph for this function:

◆ readSessionValue()

ilAssQuestionPreviewSession::readSessionValue (   $subIndex)
private

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

76 {
77 return $_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex];
78 }

References $_SESSION, getSessionContextIndex(), and SESSION_BASEINDEX.

Referenced by addRequestedHint(), getNumRequestedHints(), getParticipantsSolution(), 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 123 of file class.ilAssQuestionPreviewSession.php.

124 {
125 $this->saveSessionValue(self::SESSION_SUBINDEX_REQUESTED_HINTS, array());
126 }

References saveSessionValue().

+ Here is the call graph for this function:

◆ saveSessionValue()

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

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

71 {
72 $_SESSION[self::SESSION_BASEINDEX][$this->getSessionContextIndex()][$subIndex] = $value;
73 }

References $_SESSION, getSessionContextIndex(), and SESSION_BASEINDEX.

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

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

◆ setInstantResponseActive()

ilAssQuestionPreviewSession::setInstantResponseActive (   $instantResponseActive)

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

81 {
82 $this->saveSessionValue(self::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE, $instantResponseActive);
83 }

References saveSessionValue().

+ Here is the call graph for this function:

◆ setParticipantsSolution()

ilAssQuestionPreviewSession::setParticipantsSolution (   $participantSolution)

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

91 {
92 $this->saveSessionValue(self::SESSION_SUBINDEX_PARTICIPANT_SOLUTION, $participantSolution);
93 }

References saveSessionValue().

Referenced by assErrorText\savePreviewData(), assFileUpload\savePreviewData(), assFormulaQuestion\savePreviewData(), assImagemapQuestion\savePreviewData(), assMatchingQuestion\savePreviewData(), assNumeric\savePreviewData(), assOrderingQuestion\savePreviewData(), assQuestion\savePreviewData(), and assSingleChoice\savePreviewData().

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

Field Documentation

◆ $questionId

ilAssQuestionPreviewSession::$questionId
private

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

Referenced by __construct(), and getQuestionId().

◆ $userId

ilAssQuestionPreviewSession::$userId
private

Definition at line 19 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.

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

◆ SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_INSTANT_RESPONSE_ACTIVE = 'instantResponseActive'

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

Referenced by init().

◆ SESSION_SUBINDEX_PARTICIPANT_SOLUTION

const ilAssQuestionPreviewSession::SESSION_SUBINDEX_PARTICIPANT_SOLUTION = 'participantSolution'

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

Referenced by init().

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