ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilAccordionPropertiesStorage:

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

Constructor & Destructor Documentation

◆ __construct()

ilAccordionPropertiesStorage::__construct ( )

Constructor.

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

References $DIC, and user().

34  {
35  global $DIC;
36 
37  $this->user = $DIC->user();
38  $this->ctrl = $DIC->ctrl();
39  $this->db = $DIC->database();
40  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

& ilAccordionPropertiesStorage::executeCommand ( )

execute command

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

References $ctrl, $ilCtrl, $ilUser, and $user.

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

◆ getProperty()

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

Get property in session or db.

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

References $_SESSION, $db, $ilDB, $r, and properties.

Referenced by setOpenedTab().

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

◆ setOpenedTab()

ilAccordionPropertiesStorage::setOpenedTab ( )

Show Filter.

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

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

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

References $_SESSION, $db, $ilDB, and properties.

Referenced by setOpenedTab().

136  {
137  $ilDB = $this->db;
138 
139  switch ($this->properties[$a_property]["storage"]) {
140  case "session":
141  $_SESSION["accordion"][$a_table_id][$a_user_id][$a_property]
142  = $a_value;
143  break;
144 
145  case "db":
146 /*
147  $ilDB->replace("table_properties", array(
148  "table_id" => array("text", $a_table_id),
149  "user_id" => array("integer", $a_user_id),
150  "property" => array("text", $a_property)),
151  array(
152  "value" => array("text", $a_value)
153  ));
154 */
155  }
156  }
$_SESSION["AccountId"]
global $ilDB
Set document properties
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilAccordionPropertiesStorage::$ctrl
protected

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

Referenced by executeCommand().

◆ $db

ilAccordionPropertiesStorage::$db
protected

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

Referenced by getProperty(), and storeProperty().

◆ $properties

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

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

◆ $user

ilAccordionPropertiesStorage::$user
protected

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

Referenced by executeCommand(), and setOpenedTab().


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