ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAccordionPropertiesStorage Class Reference

Saves (mostly asynchronously) user properties of accordions. More...

+ Collaboration diagram for ilAccordionPropertiesStorage:

Public Member Functions

 __construct ()
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 setOpenedTab ()
 Show Filter. More...
 
 storeProperty ( $a_table_id, $a_user_id, $a_property, $a_value)
 Store property in session or db. More...
 
 getProperty ($a_table_id, $a_user_id, $a_property)
 Get property in session or db. More...
 

Data Fields

 $properties
 

Protected Attributes

 $user
 
 $ctrl
 
 $db
 

Detailed Description

Saves (mostly asynchronously) user properties of accordions.

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

Definition at line 10 of file class.ilAccordionPropertiesStorage.php.

Constructor & Destructor Documentation

◆ __construct()

ilAccordionPropertiesStorage::__construct ( )

Constructor.

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

32 {
33 global $DIC;
34
35 $this->user = $DIC->user();
36 $this->ctrl = $DIC->ctrl();
37 $this->db = $DIC->database();
38 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

& ilAccordionPropertiesStorage::executeCommand ( )

execute command

Definition at line 47 of file class.ilAccordionPropertiesStorage.php.

48 {
50 $ilCtrl = $this->ctrl;
51
52 $cmd = $ilCtrl->getCmd();
53 // $next_class = $this->ctrl->getNextClass($this);
54
55 $this->$cmd();
56 }
$ilUser
Definition: imgupload.php:18

References $ctrl, $ilUser, and $user.

◆ getProperty()

ilAccordionPropertiesStorage::getProperty (   $a_table_id,
  $a_user_id,
  $a_property 
)

Get property in session or db.

Definition at line 159 of file class.ilAccordionPropertiesStorage.php.

160 {
162
163 switch ($this->properties[$a_property]["storage"]) {
164 case "session":
165 $r = $_SESSION["accordion"][$a_table_id][$a_user_id][$a_property];
166//echo "<br><br><br><br><br><br><br><br>get-".$r;
167 return $r;
168 break;
169
170 case "db":
171/*
172 $set = $ilDB->query("SELECT value FROM table_properties ".
173 " WHERE table_id = ".$ilDB->quote($a_table_id, "text").
174 " AND user_id = ".$ilDB->quote($a_user_id, "integer").
175 " AND property = ".$ilDB->quote($a_property, "text")
176 );
177 $rec = $ilDB->fetchAssoc($set);
178 return $rec["value"];
179 break;
180*/
181 }
182 }
$_SESSION["AccountId"]
global $ilDB

References $_SESSION, $db, and $ilDB.

Referenced by setOpenedTab().

+ Here is the caller graph for this function:

◆ setOpenedTab()

ilAccordionPropertiesStorage::setOpenedTab ( )

Show Filter.

Definition at line 61 of file class.ilAccordionPropertiesStorage.php.

62 {
64
65 if ($_GET["user_id"] == $ilUser->getId()) {
66 switch ($_GET["act"]) {
67
68 case "add":
69 $cur = $this->getProperty(
70 $_GET["accordion_id"],
71 (int) $_GET["user_id"],
72 "opened"
73 );
74 $cur_arr = explode(";", $cur);
75 if (!in_array((int) $_GET["tab_nr"], $cur_arr)) {
76 $cur_arr[] = (int) $_GET["tab_nr"];
77 }
78 $this->storeProperty(
79 $_GET["accordion_id"],
80 (int) $_GET["user_id"],
81 "opened",
82 implode(";", $cur_arr)
83 );
84 break;
85
86 case "rem":
87 $cur = $this->getProperty(
88 $_GET["accordion_id"],
89 (int) $_GET["user_id"],
90 "opened"
91 );
92 $cur_arr = explode(";", $cur);
93 if (($key = array_search((int) $_GET["tab_nr"], $cur_arr)) !== false) {
94 unset($cur_arr[$key]);
95 }
96 $this->storeProperty(
97 $_GET["accordion_id"],
98 (int) $_GET["user_id"],
99 "opened",
100 implode(";", $cur_arr)
101 );
102 break;
103
104 case "clear":
105 $this->storeProperty(
106 $_GET["accordion_id"],
107 (int) $_GET["user_id"],
108 "opened",
109 ""
110 );
111 break;
112
113 case "set":
114 default:
115 $this->storeProperty(
116 $_GET["accordion_id"],
117 (int) $_GET["user_id"],
118 "opened",
119 $_GET["tab_nr"]
120 );
121 break;
122 }
123 }
124 }
$_GET["client_id"]
storeProperty( $a_table_id, $a_user_id, $a_property, $a_value)
Store property in session or db.
getProperty($a_table_id, $a_user_id, $a_property)
Get property in session or db.

References $_GET, $ilUser, $user, getProperty(), and storeProperty().

+ Here is the call graph for this function:

◆ storeProperty()

ilAccordionPropertiesStorage::storeProperty (   $a_table_id,
  $a_user_id,
  $a_property,
  $a_value 
)

Store property in session or db.

Definition at line 129 of file class.ilAccordionPropertiesStorage.php.

134 {
136
137 switch ($this->properties[$a_property]["storage"]) {
138 case "session":
139 $_SESSION["accordion"][$a_table_id][$a_user_id][$a_property]
140 = $a_value;
141 break;
142
143 case "db":
144/*
145 $ilDB->replace("table_properties", array(
146 "table_id" => array("text", $a_table_id),
147 "user_id" => array("integer", $a_user_id),
148 "property" => array("text", $a_property)),
149 array(
150 "value" => array("text", $a_value)
151 ));
152*/
153 }
154 }

References $_SESSION, $db, and $ilDB.

Referenced by setOpenedTab().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilAccordionPropertiesStorage::$ctrl
protected

Definition at line 20 of file class.ilAccordionPropertiesStorage.php.

Referenced by executeCommand().

◆ $db

ilAccordionPropertiesStorage::$db
protected

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

Referenced by getProperty(), and storeProperty().

◆ $properties

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

Definition at line 40 of file class.ilAccordionPropertiesStorage.php.

◆ $user

ilAccordionPropertiesStorage::$user
protected

Definition at line 15 of file class.ilAccordionPropertiesStorage.php.

Referenced by executeCommand(), and setOpenedTab().


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