ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTablePropertiesStorage Class Reference

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

+ Collaboration diagram for ilTablePropertiesStorage:

Public Member Functions

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
 

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.

Member Function Documentation

◆ executeCommand()

& ilTablePropertiesStorage::executeCommand ( )

execute command

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

29 {
30 global $ilUser, $ilCtrl;
31
32 $cmd = $ilCtrl->getCmd();
33// $next_class = $this->ctrl->getNextClass($this);
34
35 $this->$cmd();
36 }
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15

References $cmd, $ilCtrl, and $ilUser.

◆ getProperty()

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

Get property in session or db.

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

107 {
108 global $ilDB;
109
110 if ($a_table_id == "" || !$this->isValidProperty($a_property))
111 {
112 return;
113 }
114
115 $storage = $this->properties[$a_property]["storage"];
116 if ($a_user_id == ANONYMOUS_USER_ID)
117 {
118 $storage = "session";
119 }
120
121 switch ($storage)
122 {
123 case "session":
124 return $_SESSION["table"][$a_table_id][$a_user_id][$a_property];
125 break;
126
127 case "db":
128 $set = $ilDB->query($q = "SELECT value FROM table_properties ".
129 " WHERE table_id = ".$ilDB->quote($a_table_id, "text").
130 " AND user_id = ".$ilDB->quote($a_user_id, "integer").
131 " AND property = ".$ilDB->quote($a_property, "text")
132 );
133 $rec = $ilDB->fetchAssoc($set);
134 return $rec["value"];
135 break;
136 }
137 }
$_SESSION["AccountId"]
isValidProperty($a_property)
Check if given property id is valid.
global $ilDB

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

+ Here is the call graph for this function:

◆ hideFilter()

ilTablePropertiesStorage::hideFilter ( )

Hide Filter.

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

56 {
57 global $ilUser;
58
59 if ($_GET["user_id"] == $ilUser->getId())
60 {
61 $this->storeProperty($_GET["table_id"], $_GET["user_id"],
62 "filter", 0);
63 }
64 }
$_GET["client_id"]
storeProperty($a_table_id, $a_user_id, $a_property, $a_value)
Store property in session or db.

References $_GET, $ilUser, 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 145 of file class.ilTablePropertiesStorage.php.

146 {
147 if(array_key_exists($a_property, $this->properties))
148 {
149 return true;
150 }
151 return false;
152 }

Referenced by getProperty(), and storeProperty().

+ Here is the caller graph for this function:

◆ showFilter()

ilTablePropertiesStorage::showFilter ( )

Show Filter.

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

42 {
43 global $ilUser;
44
45 if ($_GET["user_id"] == $ilUser->getId())
46 {
47 $this->storeProperty($_GET["table_id"], $_GET["user_id"],
48 "filter", 1);
49 }
50 }

References $_GET, $ilUser, 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 69 of file class.ilTablePropertiesStorage.php.

71 {
72 global $ilDB;
73
74 if ($a_table_id == "" || !$this->isValidProperty($a_property))
75 {
76 return;
77 }
78
79 $storage = $this->properties[$a_property]["storage"];
80 if ($a_user_id == ANONYMOUS_USER_ID)
81 {
82 $storage = "session";
83 }
84
85 switch ($storage)
86 {
87 case "session":
88 $_SESSION["table"][$a_table_id][$a_user_id][$a_property]
89 = $a_value;
90 break;
91
92 case "db":
93 $ilDB->replace("table_properties", array(
94 "table_id" => array("text", $a_table_id),
95 "user_id" => array("integer", $a_user_id),
96 "property" => array("text", $a_property)),
97 array(
98 "value" => array("text", $a_value)
99 ));
100 }
101 }

References $_SESSION, $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

◆ $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 14 of file class.ilTablePropertiesStorage.php.


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