ILIAS  release_8 Revision v8.23
class.EditSessionRepository.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
29 {
30  public const KEY_BASE = "svy_edit_";
31  public const KEY_QCLIP = self::KEY_BASE . "qclip";
32  public const KEY_SLTYPE = self::KEY_BASE . "search_link_type";
33  public const KEY_NLTYPE = self::KEY_BASE . "new_link_type";
34  public const KEY_PHRASE_DATA = self::KEY_BASE . "phr_data";
35 
36  public function __construct()
37  {
38  }
39 
40  public function addQuestionToClipboard(int $qid, string $action): void
41  {
42  $entries = [];
43  if (\ilSession::has(self::KEY_QCLIP)) {
44  $entries = \ilSession::get(self::KEY_QCLIP);
45  }
46  $entries[$qid] = [
47  "question_id" => $qid,
48  "action" => $action
49  ];
50  \ilSession::set(self::KEY_QCLIP, $entries);
51  }
52 
53  public function getQuestionsFromClipboard(): array
54  {
55  $entries = [];
56  if (\ilSession::has(self::KEY_QCLIP)) {
57  $entries = \ilSession::get(self::KEY_QCLIP);
58  }
59  return $entries;
60  }
61 
62  public function clearClipboardQuestions(): void
63  {
64  if (\ilSession::has(self::KEY_QCLIP)) {
65  \ilSession::clear(self::KEY_QCLIP);
66  }
67  }
68 
69  public function setSearchLinkType(string $type): void
70  {
71  \ilSession::set(self::KEY_SLTYPE, $type);
72  }
73 
74  public function getSearchLinkType(): string
75  {
76  return (string) \ilSession::get(self::KEY_SLTYPE);
77  }
78 
79  public function clearSearchLinkType(): void
80  {
81  if (\ilSession::has(self::KEY_SLTYPE)) {
82  \ilSession::clear(self::KEY_SLTYPE);
83  }
84  }
85 
86  public function setNewLinkType(string $type): void
87  {
88  \ilSession::set(self::KEY_NLTYPE, $type);
89  }
90 
91  public function getNewLinkType(): string
92  {
93  return (string) \ilSession::get(self::KEY_NLTYPE);
94  }
95 
96  public function clearNewLinkType(): void
97  {
98  if (\ilSession::has(self::KEY_NLTYPE)) {
99  \ilSession::clear(self::KEY_NLTYPE);
100  }
101  }
102 
103  public function setPhraseData(array $data): void
104  {
105  \ilSession::set(self::KEY_PHRASE_DATA, $data);
106  }
107 
108  public function getPhraseData(): array
109  {
110  return (\ilSession::get(self::KEY_PHRASE_DATA) ?? []);
111  }
112 }
static get(string $a_var)
$type
static has($a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.