ILIAS  release_8 Revision v8.24
ilAccordionPropertiesStorageGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAccordionPropertiesStorageGUI:
+ Collaboration diagram for ilAccordionPropertiesStorageGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 setOpenedTab ()
 
 storeProperty (string $a_table_id, int $a_user_id, string $a_property, string $a_value)
 Store property in session. More...
 
 getProperty (string $a_table_id, int $a_user_id, string $a_property)
 
 getPropertyForIdStartsWith (string $id_starts_with, int $user_id, string $property)
 

Data Fields

array $properties
 

Protected Attributes

string $tab_nr
 
string $req_acc_id
 
int $user_id
 
ILIAS Accordion StandardGUIRequest $request
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Saves (mostly asynchronously) user properties of accordions

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilAccordionPropertiesStorageGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAccordionPropertiesStorageGUI::__construct ( )

Definition at line 36 of file class.ilAccordionPropertiesStorageGUI.php.

37 {
38 global $DIC;
39
40 $this->user = $DIC->user();
41 $this->ctrl = $DIC->ctrl();
42 $this->db = $DIC->database();
43 $this->request = new \ILIAS\Accordion\StandardGUIRequest(
44 $DIC->http(),
45 $DIC->refinery()
46 );
47 $this->user_id = $this->request->getUserId();
48 $this->req_acc_id = $this->request->getId();
49 $this->tab_nr = $this->request->getTabNr();
50 }
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilAccordionPropertiesStorageGUI::executeCommand ( )

Definition at line 52 of file class.ilAccordionPropertiesStorageGUI.php.

52 : void
53 {
54 $ilCtrl = $this->ctrl;
55 $cmd = $ilCtrl->getCmd();
56 $this->$cmd();
57 }
getCmd(string $fallback_command=null)
@inheritDoc

References $ctrl, and ilCtrl\getCmd().

+ Here is the call graph for this function:

◆ getProperty()

ilAccordionPropertiesStorageGUI::getProperty ( string  $a_table_id,
int  $a_user_id,
string  $a_property 
)

Definition at line 144 of file class.ilAccordionPropertiesStorageGUI.php.

148 : string {
149 $acc = [];
150 if (ilSession::has("accordion")) {
151 $acc = ilSession::get("accordion");
152 }
153 return $acc[$a_table_id][$a_user_id][$a_property] ?? "";
154 }
static get(string $a_var)
static has($a_var)

References ilSession\get().

Referenced by setOpenedTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPropertyForIdStartsWith()

ilAccordionPropertiesStorageGUI::getPropertyForIdStartsWith ( string  $id_starts_with,
int  $user_id,
string  $property 
)

Definition at line 157 of file class.ilAccordionPropertiesStorageGUI.php.

161 : array {
162 $ret = [];
163 switch ($this->properties[$property]["storage"]) {
164 case "session":
165 if (ilSession::has("accordion")) {
166 $acc = ilSession::get("accordion");
167 foreach ($acc as $id => $user_values) {
168 if (substr($id, 0, strlen($id_starts_with)) === $id_starts_with) {
169 if (isset($user_values[$user_id][$property])) {
170 $ret[$id] = $user_values[$user_id][$property];
171 }
172 }
173 }
174 }
175 break;
176 }
177 return $ret;
178 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ilSession\get(), and ilSession\has().

+ Here is the call graph for this function:

◆ setOpenedTab()

ilAccordionPropertiesStorageGUI::setOpenedTab ( )

Definition at line 59 of file class.ilAccordionPropertiesStorageGUI.php.

59 : void
60 {
62
63 if ($this->user_id == $ilUser->getId()) {
64 switch ($this->request->getAction()) {
65
66 case "add":
67 $cur = $this->getProperty(
68 $this->req_acc_id,
69 $this->user_id,
70 "opened"
71 );
72 $cur_arr = explode(";", $cur);
73 if (!in_array($this->tab_nr, $cur_arr)) {
74 $cur_arr[] = $this->tab_nr;
75 }
76 $this->storeProperty(
77 $this->req_acc_id,
78 $this->user_id,
79 "opened",
80 implode(";", $cur_arr)
81 );
82 break;
83
84 case "rem":
85 $cur = $this->getProperty(
86 $this->req_acc_id,
87 $this->user_id,
88 "opened"
89 );
90 $cur_arr = explode(";", $cur);
91 if (($key = array_search($this->tab_nr, $cur_arr)) !== false) {
92 unset($cur_arr[$key]);
93 }
94 $this->storeProperty(
95 $this->req_acc_id,
96 $this->user_id,
97 "opened",
98 implode(";", $cur_arr)
99 );
100 break;
101
102 case "clear":
103 $this->storeProperty(
104 $this->req_acc_id,
105 $this->user_id,
106 "opened",
107 ""
108 );
109 break;
110
111 case "set":
112 default:
113 $this->storeProperty(
114 $this->req_acc_id,
115 $this->user_id,
116 "opened",
117 $this->tab_nr
118 );
119 break;
120 }
121 }
122 }
storeProperty(string $a_table_id, int $a_user_id, string $a_property, string $a_value)
Store property in session.
getProperty(string $a_table_id, int $a_user_id, string $a_property)
$ilUser
Definition: imgupload.php:34
string $key
Consumer key/client ID value.
Definition: System.php:193

References $ilUser, ILIAS\LTI\ToolProvider\$key, $tab_nr, $user, getProperty(), and storeProperty().

+ Here is the call graph for this function:

◆ storeProperty()

ilAccordionPropertiesStorageGUI::storeProperty ( string  $a_table_id,
int  $a_user_id,
string  $a_property,
string  $a_value 
)

Store property in session.

Definition at line 127 of file class.ilAccordionPropertiesStorageGUI.php.

132 : void {
133 switch ($this->properties[$a_property]["storage"]) {
134 case "session":
135 if (ilSession::has("accordion")) {
136 $acc = ilSession::get("accordion");
137 }
138 $acc[$a_table_id][$a_user_id][$a_property] = $a_value;
139 ilSession::set("accordion", $acc);
140 break;
141 }
142 }
static set(string $a_var, $a_val)
Set a value.

References ilSession\get(), ilSession\has(), and ilSession\set().

Referenced by setOpenedTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilAccordionPropertiesStorageGUI::$ctrl
protected

Definition at line 30 of file class.ilAccordionPropertiesStorageGUI.php.

Referenced by executeCommand().

◆ $db

ilDBInterface ilAccordionPropertiesStorageGUI::$db
protected

Definition at line 31 of file class.ilAccordionPropertiesStorageGUI.php.

◆ $properties

array ilAccordionPropertiesStorageGUI::$properties
Initial value:
= array(
"opened" => array("storage" => "session")
)

Definition at line 32 of file class.ilAccordionPropertiesStorageGUI.php.

◆ $req_acc_id

string ilAccordionPropertiesStorageGUI::$req_acc_id
protected

Definition at line 26 of file class.ilAccordionPropertiesStorageGUI.php.

◆ $request

ILIAS Accordion StandardGUIRequest ilAccordionPropertiesStorageGUI::$request
protected

Definition at line 28 of file class.ilAccordionPropertiesStorageGUI.php.

◆ $tab_nr

string ilAccordionPropertiesStorageGUI::$tab_nr
protected

Definition at line 25 of file class.ilAccordionPropertiesStorageGUI.php.

Referenced by setOpenedTab().

◆ $user

ilObjUser ilAccordionPropertiesStorageGUI::$user
protected

Definition at line 29 of file class.ilAccordionPropertiesStorageGUI.php.

Referenced by setOpenedTab().

◆ $user_id

int ilAccordionPropertiesStorageGUI::$user_id
protected

Definition at line 27 of file class.ilAccordionPropertiesStorageGUI.php.


The documentation for this class was generated from the following file: