ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.WorkspaceSessionRepository.php
Go to the documentation of this file.
1<?php
2
20
27{
28 protected const BASE_SESSION_KEY = 'wsp_';
29
30 public function __construct()
31 {
32 }
33
34 public function clearClipboard(): void
35 {
36 \ilSession::clear(self::BASE_SESSION_KEY . "_clip_wsp2repo");
37 \ilSession::clear(self::BASE_SESSION_KEY . "_clip_source_ids");
38 \ilSession::clear(self::BASE_SESSION_KEY . "_clip_cmd");
39 \ilSession::clear(self::BASE_SESSION_KEY . "_clip_shared");
40 }
41
42 public function isClipboardEmpty(): bool
43 {
44 return !($this->getClipboardCmd() !== "" && count($this->getClipboardSourceIds()) > 0);
45 }
46
47 public function setClipboardWsp2Repo(bool $wsp2repo): void
48 {
49 \ilSession::set(self::BASE_SESSION_KEY . "_clip_wsp2repo", $wsp2repo);
50 }
51
52 public function getClipboardWsp2Repo(): bool
53 {
54 return \ilSession::get(self::BASE_SESSION_KEY . "_clip_wsp2repo") ?? false;
55 }
56
57 public function setClipboardSourceIds(array $ids): void
58 {
59 \ilSession::set(self::BASE_SESSION_KEY . "_clip_source_ids", $ids);
60 }
61
62 public function getClipboardSourceIds(): array
63 {
64 return \ilSession::get(self::BASE_SESSION_KEY . "_clip_source_ids") ?? [];
65 }
66
67 public function setClipboardCmd(string $cmd): void
68 {
69 \ilSession::set(self::BASE_SESSION_KEY . "_clip_cmd", $cmd);
70 }
71
72 public function getClipboardCmd(): string
73 {
74 return \ilSession::get(self::BASE_SESSION_KEY . "_clip_cmd") ?? "";
75 }
76
77 public function setClipboardShared(bool $shared): void
78 {
79 \ilSession::set(self::BASE_SESSION_KEY . "_clip_shared", $shared);
80 }
81
82 public function getClipboardShared(): bool
83 {
84 return \ilSession::get(self::BASE_SESSION_KEY . "_clip_shared") ?? false;
85 }
86}
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
get(string $class_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...