ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilTablePropertiesStorage: ilTablePropertiesStorage

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

Constructor & Destructor Documentation

◆ __construct()

ilTablePropertiesStorage::__construct ( )

Constructor.

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

References $DIC, and user().

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
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

& ilTablePropertiesStorage::executeCommand ( )

execute command

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

References $ctrl, $ilUser, and $user.

55  {
57  $ilCtrl = $this->ctrl;
58 
59  $cmd = $ilCtrl->getCmd();
60  // $next_class = $this->ctrl->getNextClass($this);
61 
62  $this->$cmd();
63  }
$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 142 of file class.ilTablePropertiesStorage.php.

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

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

◆ hideFilter()

ilTablePropertiesStorage::hideFilter ( )

Hide Filter.

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

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

86  {
88 
89  if ($_GET["user_id"] == $ilUser->getId()) {
90  $this->storeProperty(
91  $_GET["table_id"],
92  $_GET["user_id"],
93  "filter",
94  0
95  );
96  }
97  }
$_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
+ 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 179 of file class.ilTablePropertiesStorage.php.

Referenced by getProperty(), and storeProperty().

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

◆ showFilter()

ilTablePropertiesStorage::showFilter ( )

Show Filter.

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

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

69  {
71 
72  if ($_GET["user_id"] == $ilUser->getId()) {
73  $this->storeProperty(
74  $_GET["table_id"],
75  $_GET["user_id"],
76  "filter",
77  1
78  );
79  }
80  }
$_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
+ 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 102 of file class.ilTablePropertiesStorage.php.

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

Referenced by hideFilter(), and showFilter().

107  {
108  $ilDB = $this->db;
109 
110  if ($a_table_id == "" || !$this->isValidProperty($a_property)) {
111  return;
112  }
113 
114  $storage = $this->properties[$a_property]["storage"];
115  if ($a_user_id == ANONYMOUS_USER_ID) {
116  $storage = "session";
117  }
118 
119  switch ($storage) {
120  case "session":
121  $_SESSION["table"][$a_table_id][$a_user_id][$a_property]
122  = $a_value;
123  break;
124 
125  case "db":
126  $ilDB->replace(
127  "table_properties",
128  array(
129  "table_id" => array("text", $a_table_id),
130  "user_id" => array("integer", $a_user_id),
131  "property" => array("text", $a_property)),
132  array(
133  "value" => array("text", $a_value)
134  )
135  );
136  }
137  }
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
isValidProperty($a_property)
Check if given property id is valid.
global $ilDB
+ 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 20 of file class.ilTablePropertiesStorage.php.

Referenced by executeCommand().

◆ $db

ilTablePropertiesStorage::$db
protected

Definition at line 25 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 40 of file class.ilTablePropertiesStorage.php.

◆ $user

ilTablePropertiesStorage::$user
protected

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

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


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