ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTablePropertiesStorage Class Reference

Saves (mostly asynchronously) user properties of tables (e.g. More...

+ Collaboration diagram for ilTablePropertiesStorage:

Public Member Functions

 __construct ()
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 showFilter ()
 Show Filter. More...
 
 hideFilter ()
 Hide 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...
 
 isValidProperty ($a_property)
 Check if given property id is valid. More...
 

Data Fields

 $properties
 

Protected Attributes

 $user
 
 $ctrl
 
 $db
 

Detailed Description

Saves (mostly asynchronously) user properties of tables (e.g.

filter on/off)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilTablePropertiesStorage:

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

Constructor & Destructor Documentation

◆ __construct()

ilTablePropertiesStorage::__construct ( )

Constructor.

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

34 {
35 global $DIC;
36
37 $this->user = $DIC->user();
38 $this->ctrl = $DIC->ctrl();
39 $this->db = $DIC->database();
40 }
user()
Definition: user.php:4
global $DIC
Definition: saml.php:7

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

& ilTablePropertiesStorage::executeCommand ( )

execute command

Definition at line 56 of file class.ilTablePropertiesStorage.php.

57 {
60
61 $cmd = $ilCtrl->getCmd();
62 // $next_class = $this->ctrl->getNextClass($this);
63
64 $this->$cmd();
65 }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

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

◆ getProperty()

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

Get property in session or db.

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

145 {
147
148 if ($a_table_id == "" || !$this->isValidProperty($a_property)) {
149 return;
150 }
151
152 $storage = $this->properties[$a_property]["storage"];
153 if ($a_user_id == ANONYMOUS_USER_ID) {
154 $storage = "session";
155 }
156
157 switch ($storage) {
158 case "session":
159 return $_SESSION["table"][$a_table_id][$a_user_id][$a_property];
160 break;
161
162 case "db":
163 $set = $ilDB->query(
164 $q = "SELECT value FROM table_properties " .
165 " WHERE table_id = " . $ilDB->quote($a_table_id, "text") .
166 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
167 " AND property = " . $ilDB->quote($a_property, "text")
168 );
169 $rec = $ilDB->fetchAssoc($set);
170 return $rec["value"];
171 break;
172 }
173 }
$_SESSION["AccountId"]
isValidProperty($a_property)
Check if given property id is valid.
global $ilDB

References $_SESSION, $db, $ilDB, and isValidProperty().

+ Here is the call graph for this function:

◆ hideFilter()

ilTablePropertiesStorage::hideFilter ( )

Hide Filter.

Definition at line 87 of file class.ilTablePropertiesStorage.php.

88 {
90
91 if ($_GET["user_id"] == $ilUser->getId()) {
92 $this->storeProperty(
93 $_GET["table_id"],
94 $_GET["user_id"],
95 "filter",
96 0
97 );
98 }
99 }
$_GET["client_id"]
storeProperty( $a_table_id, $a_user_id, $a_property, $a_value)
Store property in session or db.

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

+ Here is the call graph for this function:

◆ isValidProperty()

ilTablePropertiesStorage::isValidProperty (   $a_property)

Check if given property id is valid.

Parameters
string$a_property
Returns
bool

Definition at line 181 of file class.ilTablePropertiesStorage.php.

182 {
183 if (array_key_exists($a_property, $this->properties)) {
184 return true;
185 }
186 return false;
187 }

Referenced by getProperty(), and storeProperty().

+ Here is the caller graph for this function:

◆ showFilter()

ilTablePropertiesStorage::showFilter ( )

Show Filter.

Definition at line 70 of file class.ilTablePropertiesStorage.php.

71 {
73
74 if ($_GET["user_id"] == $ilUser->getId()) {
75 $this->storeProperty(
76 $_GET["table_id"],
77 $_GET["user_id"],
78 "filter",
79 1
80 );
81 }
82 }

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

+ Here is the call graph for this function:

◆ storeProperty()

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

Store property in session or db.

Definition at line 104 of file class.ilTablePropertiesStorage.php.

109 {
111
112 if ($a_table_id == "" || !$this->isValidProperty($a_property)) {
113 return;
114 }
115
116 $storage = $this->properties[$a_property]["storage"];
117 if ($a_user_id == ANONYMOUS_USER_ID) {
118 $storage = "session";
119 }
120
121 switch ($storage) {
122 case "session":
123 $_SESSION["table"][$a_table_id][$a_user_id][$a_property]
124 = $a_value;
125 break;
126
127 case "db":
128 $ilDB->replace(
129 "table_properties",
130 array(
131 "table_id" => array("text", $a_table_id),
132 "user_id" => array("integer", $a_user_id),
133 "property" => array("text", $a_property)),
134 array(
135 "value" => array("text", $a_value)
136 )
137 );
138 }
139 }

References $_SESSION, $db, $ilDB, and isValidProperty().

Referenced by hideFilter(), and showFilter().

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

Field Documentation

◆ $ctrl

ilTablePropertiesStorage::$ctrl
protected

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

Referenced by executeCommand().

◆ $db

ilTablePropertiesStorage::$db
protected

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

Referenced by getProperty(), and storeProperty().

◆ $properties

ilTablePropertiesStorage::$properties
Initial value:
= array(
"filter" => array("storage" => "db"),
"direction" => array("storage" => "db"),
"order" => array("storage" => "db"),
"rows" => array("storage" => "db"),
"offset" => array("storage" => "session"),
"selfields" => array("storage" => "db"),
"selfilters" => array("storage" => "db"),
"filter_values" => array("storage" => "db")
)

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

◆ $user

ilTablePropertiesStorage::$user
protected

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

Referenced by executeCommand(), hideFilter(), and showFilter().


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