ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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
65 public function getPageError(): string|array
66 {
67 return \ilSession::get(self::ERROR_KEY) ?? "";
68 }
69
70 public function clearSubCmd(): void
71 {
72 \ilSession::clear(self::SUB_CMD_KEY);
73 }
74
75 public function setSubCmd(string $sub_cmd): void
76 {
77 \ilSession::set(self::SUB_CMD_KEY, $sub_cmd);
78 }
79
80 public function getSubCmd(): string
81 {
82 return \ilSession::get(self::SUB_CMD_KEY) ?? "";
83 }
84
85 public function clearTextLang(int $ref_id): void
86 {
87 \ilSession::clear(self::TXT_LANG_KEY . "_" . $ref_id);
88 }
89
90 public function setTextLang(int $ref_id, string $lang_key): void
91 {
92 \ilSession::set(self::TXT_LANG_KEY . "_" . $ref_id, $lang_key);
93 }
94
95 public function getTextLang(int $ref_id): string
96 {
97 return \ilSession::get(self::TXT_LANG_KEY . "_" . $ref_id) ?? "";
98 }
99
100 public function clearMediaPool(): void
101 {
102 \ilSession::clear(self::MEP_KEY);
103 }
104
105 public function setMediaPool(int $pool_id): void
106 {
107 \ilSession::set(self::MEP_KEY, $pool_id);
108 }
109
110 public function getMediaPool(): int
111 {
112 return \ilSession::get(self::MEP_KEY) ?? 0;
113 }
114
115 public function clearQuestionPool(): void
116 {
117 \ilSession::clear(self::QPL_KEY);
118 }
119
120 public function setQuestionPool(int $pool_id): void
121 {
122 \ilSession::set(self::QPL_KEY, $pool_id);
123 }
124
125 public function getQuestionPool(): int
126 {
127 return \ilSession::get(self::QPL_KEY) ?? 0;
128 }
129}
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)