ILIAS  release_8 Revision v8.24
class.ilAssQuestionHintsOrderingClipboard.php
Go to the documentation of this file.
1<?php
2
29{
36 private $questionId = null;
37
44 public function __construct(assQuestion $questionOBJ)
45 {
46 $this->questionId = $questionOBJ->getId();
47
48 $class = ilSession::get(__CLASS__);
49 if ($class == null) {
50 ilSession::set(__CLASS__, array());
51 }
52
53 if (!isset($class[$this->questionId])) {
54 $class[$this->questionId] = null;
55 ilSession::set(__CLASS__, $class);
56 }
57 }
58
64 public function resetStored(): void
65 {
66 $class = ilSession::get(__CLASS__);
67 unset($class[$this->questionId]);
68 ilSession::set(__CLASS__, $class);
69 //$_SESSION[__CLASS__][$this->questionId] = null;
70 }
71
79 public function setStored($hintId): void
80 {
81 $class = ilSession::get(__CLASS__);
82 $class[$this->questionId] = $hintId;
83 ilSession::set(__CLASS__, $class);
84 //$_SESSION[__CLASS__][$this->questionId] = $hintId;
85 }
86
93 public function getStored(): int
94 {
95 $class = ilSession::get(__CLASS__);
96 return $class[$this->questionId];
97 }
98
107 public function isStored($hintId): bool
108 {
109 $class = ilSession::get(__CLASS__);
110 if ($class[$this->questionId] === $hintId) {
111 return true;
112 }
113
114 return false;
115 }
116
123 public function hasStored(): bool
124 {
125 $class = ilSession::get(__CLASS__);
126 if ($class[$this->questionId] !== null) {
127 return true;
128 }
129
130 return false;
131 }
132}
Abstract basic class which is to be extended by the concrete assessment question type classes.
setStored($hintId)
sets the passed hint id, so relating hint is deemed to be cut to clipboard
isStored($hintId)
returns the fact wether the hint relating to the passed hint id is stored in clipboard or not
resetStored()
resets the clipboard by ensuring no hint is stored
hasStored()
returns the fact wether any hint is stored in clipboard currently or not
getStored()
returns the hint id currently stored in clipboard
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.