ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.EditSessionRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
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
35 public function __construct()
36 {
37 }
38
39 public function addQuestionToClipboard(int $qid, string $action): void
40 {
41 $entries = [];
42 if (\ilSession::has(self::KEY_QCLIP)) {
43 $entries = \ilSession::get(self::KEY_QCLIP);
44 }
45 $entries[$qid] = [
46 "question_id" => $qid,
47 "action" => $action
48 ];
49 \ilSession::set(self::KEY_QCLIP, $entries);
50 }
51
52 public function getQuestionsFromClipboard(): array
53 {
54 $entries = [];
55 if (\ilSession::has(self::KEY_QCLIP)) {
56 $entries = \ilSession::get(self::KEY_QCLIP);
57 }
58 return $entries;
59 }
60
61 public function clearClipboardQuestions(): void
62 {
63 if (\ilSession::has(self::KEY_QCLIP)) {
64 \ilSession::clear(self::KEY_QCLIP);
65 }
66 }
67
68 public function setSearchLinkType(string $type): void
69 {
70 \ilSession::set(self::KEY_SLTYPE, $type);
71 }
72
73 public function getSearchLinkType(): string
74 {
75 return (string) \ilSession::get(self::KEY_SLTYPE);
76 }
77
78 public function clearSearchLinkType(): void
79 {
80 if (\ilSession::has(self::KEY_SLTYPE)) {
81 \ilSession::clear(self::KEY_SLTYPE);
82 }
83 }
84
85 public function setNewLinkType(string $type): void
86 {
87 \ilSession::set(self::KEY_NLTYPE, $type);
88 }
89
90 public function getNewLinkType(): string
91 {
92 return (string) \ilSession::get(self::KEY_NLTYPE);
93 }
94
95 public function clearNewLinkType(): void
96 {
97 if (\ilSession::has(self::KEY_NLTYPE)) {
98 \ilSession::clear(self::KEY_NLTYPE);
99 }
100 }
101}
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static has($a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...