ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ClipboardSessionRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
30 public const KEY_BASE = "repo_clip";
31
32 public function __construct()
33 {
34 }
35
36 public function setCmd(string $cmd): void
37 {
38 \ilSession::set(self::KEY_BASE . "_cmd", $cmd);
39 }
40
41 public function getCmd(): string
42 {
43 if (\ilSession::has(self::KEY_BASE . "_cmd")) {
44 return \ilSession::get(self::KEY_BASE . "_cmd");
45 }
46 return "";
47 }
48
49 public function setParent(int $parent): void
50 {
51 \ilSession::set(self::KEY_BASE . "_parent", $parent);
52 }
53
54 public function getParent(): int
55 {
56 if (\ilSession::has(self::KEY_BASE . "_parent")) {
57 return (int) \ilSession::get(self::KEY_BASE . "_parent");
58 }
59 return 0;
60 }
61
62 public function setRefIds(array $ref_ids): void
63 {
64 \ilSession::set(self::KEY_BASE . "_ref_ids", $ref_ids);
65 }
66
67 public function getRefIds(): array
68 {
69 if (\ilSession::has(self::KEY_BASE . "_ref_ids")) {
70 return \ilSession::get(self::KEY_BASE . "_ref_ids");
71 }
72 return [];
73 }
74
75 public function hasEntries(): bool
76 {
77 return (count($this->getRefIds()) > 0 && $this->getCmd() !== "");
78 }
79
80 public function clear(): void
81 {
82 \ilSession::clear(self::KEY_BASE . "_cmd");
83 \ilSession::clear(self::KEY_BASE . "_parent");
84 \ilSession::clear(self::KEY_BASE . "_ref_ids");
85 }
86}
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static has($a_var)
get(string $class_name)