ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.EditSessionRepo.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Survey\Editing;
22 
28 {
29  protected const KEY_BASE = "svy_edit_";
30  protected const KEY_CONSTRAINT_STRUCTURE = self::KEY_BASE . "constraints";
31  protected const KEY_CONSTRAINT_ELEMENTS = self::KEY_BASE . "elements";
32  protected const KEY_EXT_TEXT = self::KEY_BASE . "ext_text";
33 
34  public function __construct()
35  {
36  }
37 
38  public function setConstraintStructure(?array $structure): void
39  {
40  \ilSession::set(self::KEY_CONSTRAINT_STRUCTURE, $structure);
41  }
42 
43  public function getConstraintStructure(): ?array
44  {
45  return \ilSession::get(self::KEY_CONSTRAINT_STRUCTURE);
46  }
47 
48  public function clearConstraintStructure(): void
49  {
50  \ilSession::clear(self::KEY_CONSTRAINT_STRUCTURE);
51  }
52 
53  public function setConstraintElements(?array $elements): void
54  {
55  \ilSession::set(self::KEY_CONSTRAINT_ELEMENTS, $elements);
56  }
57 
58  public function getConstraintElements(): ?array
59  {
60  return \ilSession::get(self::KEY_CONSTRAINT_ELEMENTS);
61  }
62 
63  public function clearConstraintElements(): void
64  {
65  \ilSession::clear(self::KEY_CONSTRAINT_ELEMENTS);
66  }
67 
68  public function setMoveSurveyQuestions(int $survey_id, array $question_ids): void
69  {
70  \ilSession::set(self::KEY_BASE . "move_svy_id", $survey_id);
71  \ilSession::set(self::KEY_BASE . "move_svy_qids", $question_ids);
72  }
73 
74  public function clearMoveSurveyQuestions(): void
75  {
76  \ilSession::clear(self::KEY_BASE . "move_svy_id");
77  \ilSession::clear(self::KEY_BASE . "move_svy_qids");
78  }
79 
80  public function getMoveSurveyQuestions(): array
81  {
82  if (\ilSession::has(self::KEY_BASE . "move_svy_qids")) {
83  return \ilSession::get(self::KEY_BASE . "move_svy_qids");
84  }
85  return [];
86  }
87 
88  public function getMoveSurveyId(): int
89  {
90  if (\ilSession::has(self::KEY_BASE . "move_svy_id")) {
91  return \ilSession::get(self::KEY_BASE . "move_svy_id");
92  }
93  return 0;
94  }
95 
96  protected function getClipKey(int $ref_id): string
97  {
98  return self::KEY_BASE . "q_clip_" . $ref_id;
99  }
100 
101  public function setQuestionClipboard(
102  int $ref_id,
103  int $page,
104  string $mode,
105  array $question_ids
106  ): void {
108  $this->getClipKey($ref_id),
109  [
110  "source_page" => $page,
111  "mode" => $mode,
112  "question_ids" => $question_ids
113  ]
114  );
115  }
116 
117  public function clearQuestionClipboard($ref_id): void
118  {
120  }
121 
123  {
124  if (\ilSession::has($this->getClipKey($ref_id))) {
125  $data = \ilSession::get($this->getClipKey($ref_id));
126  return $data["source_page"];
127  }
128  return null;
129  }
130 
131  public function getQuestionClipboardMode(int $ref_id): string
132  {
133  if (\ilSession::has($this->getClipKey($ref_id))) {
134  $data = \ilSession::get($this->getClipKey($ref_id));
135  return $data["mode"];
136  }
137  return "";
138  }
139 
140  public function getQuestionClipboardQuestions(int $ref_id): array
141  {
142  if (\ilSession::has($this->getClipKey($ref_id))) {
143  $data = \ilSession::get($this->getClipKey($ref_id));
144  return $data["question_ids"];
145  }
146  return [];
147  }
148 
149  public function isQuestionClipboardEmpty(int $ref_id): bool
150  {
151  if (\ilSession::has($this->getClipKey($ref_id))) {
152  return false;
153  }
154  return true;
155  }
156 
157  public function setPoolChoice(int $id): void
158  {
159  \ilSession::set(self::KEY_BASE . "pool_choice", $id);
160  }
161 
162  public function getPoolChoice(): int
163  {
164  if (\ilSession::has(self::KEY_BASE . "pool_choice")) {
165  return \ilSession::get(self::KEY_BASE . "pool_choice");
166  }
167  return 0;
168  }
169 
170  public function setExternalText(string $text): void
171  {
172  \ilSession::set(self::KEY_EXT_TEXT, $text);
173  }
174 
175  public function getExternalText(): string
176  {
177  return (string) \ilSession::get(self::KEY_EXT_TEXT);
178  }
179 }
static get(string $a_var)
setQuestionClipboard(int $ref_id, int $page, string $mode, array $question_ids)
Stores access codes of anonymous session.
$ref_id
Definition: ltiauth.php:67
static has($a_var)
get(string $key, Refinery\Transformation $t)
Get passed parameter, if not data passed, get key from http request.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setMoveSurveyQuestions(int $survey_id, array $question_ids)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.