ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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$

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.

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()

& ilTablePropertiesStorage::executeCommand ( )

execute command

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

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

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

◆ 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.

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

145  {
146  $ilDB = $this->db;
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
Set document properties
+ Here is the call graph for this function:

◆ hideFilter()

ilTablePropertiesStorage::hideFilter ( )

Hide Filter.

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

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

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"]
$ilUser
Definition: imgupload.php:18
storeProperty( $a_table_id, $a_user_id, $a_property, $a_value)
Store property in session or db.
+ 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.

References properties.

Referenced by getProperty(), and storeProperty().

182  {
183  if (array_key_exists($a_property, $this->properties)) {
184  return true;
185  }
186  return false;
187  }
Set document properties
+ Here is the caller graph for this function:

◆ showFilter()

ilTablePropertiesStorage::showFilter ( )

Show Filter.

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

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

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  }
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18
storeProperty( $a_table_id, $a_user_id, $a_property, $a_value)
Store property in session or db.
+ 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.

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

Referenced by hideFilter(), and showFilter().

109  {
110  $ilDB = $this->db;
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  }
$_SESSION["AccountId"]
isValidProperty($a_property)
Check if given property id is valid.
Create styles array
The data for the language used.
global $ilDB
Set document properties
+ 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:
"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: