ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.EditSessionRepository.php
Go to the documentation of this file.
1<?php
2
20
27{
28 protected const BASE_SESSION_KEY = 'copg_';
29 protected const ERROR_KEY = self::BASE_SESSION_KEY . 'error';
30 protected const SUB_CMD_KEY = self::BASE_SESSION_KEY . 'sub_cmd';
31 protected const TXT_LANG_KEY = self::BASE_SESSION_KEY . 'text_lang';
32 protected const MEP_KEY = self::BASE_SESSION_KEY . 'mep';
33 protected const QPL_KEY = self::BASE_SESSION_KEY . 'qpl';
34
35 public function __construct()
36 {
37 }
38
39 public function clear(?array $text_ref_ids = null): void
40 {
41 $this->clearPageError();
42 $this->clearMediaPool();
43 $this->clearQuestionPool();
44 $this->clearSubCmd();
45 if (is_array($text_ref_ids)) {
46 foreach ($text_ref_ids as $text_ref_id) {
47 $this->clearTextLang($text_ref_id);
48 }
49 }
50 }
51
52 public function clearPageError(): void
53 {
54 \ilSession::clear(self::ERROR_KEY);
55 }
56
60 public function setPageError($error): void
61 {
62 \ilSession::set(self::ERROR_KEY, $error);
63 }
64
68 public function getPageError()
69 {
70 return \ilSession::get(self::ERROR_KEY) ?? "";
71 }
72
73 public function clearSubCmd(): void
74 {
75 \ilSession::clear(self::SUB_CMD_KEY);
76 }
77
78 public function setSubCmd(string $sub_cmd): void
79 {
80 \ilSession::set(self::SUB_CMD_KEY, $sub_cmd);
81 }
82
83 public function getSubCmd(): string
84 {
85 return \ilSession::get(self::SUB_CMD_KEY) ?? "";
86 }
87
88 public function clearTextLang(int $ref_id): void
89 {
90 \ilSession::clear(self::TXT_LANG_KEY . "_" . $ref_id);
91 }
92
93 public function setTextLang(int $ref_id, string $lang_key): void
94 {
95 \ilSession::set(self::TXT_LANG_KEY . "_" . $ref_id, $lang_key);
96 }
97
98 public function getTextLang(int $ref_id): string
99 {
100 return \ilSession::get(self::TXT_LANG_KEY . "_" . $ref_id) ?? "";
101 }
102
103 public function clearMediaPool(): void
104 {
105 \ilSession::clear(self::MEP_KEY);
106 }
107
108 public function setMediaPool(int $pool_id): void
109 {
110 \ilSession::set(self::MEP_KEY, $pool_id);
111 }
112
113 public function getMediaPool(): int
114 {
115 return \ilSession::get(self::MEP_KEY) ?? 0;
116 }
117
118 public function clearQuestionPool(): void
119 {
120 \ilSession::clear(self::QPL_KEY);
121 }
122
123 public function setQuestionPool(int $pool_id): void
124 {
125 \ilSession::set(self::QPL_KEY, $pool_id);
126 }
127
128 public function getQuestionPool(): int
129 {
130 return \ilSession::get(self::QPL_KEY) ?? 0;
131 }
132}
ilErrorHandling $error
Definition: class.ilias.php:69
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
$ref_id
Definition: ltiauth.php:66
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
get(string $class_name)