ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilTableTemplatesStorage Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilTableTemplatesStorage:

Public Member Functions

 __construct ()
 
 store (string $a_context, int $a_user_id, string $a_name, array $a_state)
 Store table template. More...
 
 load (string $a_context, int $a_user_id, string $a_name)
 Get table template. More...
 
 delete (string $a_context, int $a_user_id, string $a_name)
 Delete table template. More...
 
 getNames (string $a_context, int $a_user_id)
 List templates. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Saves (mostly asynchronously) user properties of tables (e.g. filter on/off)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Deprecated:
10

Definition at line 26 of file class.ilTableTemplatesStorage.php.

Constructor & Destructor Documentation

◆ __construct()

ilTableTemplatesStorage::__construct ( )

Definition at line 30 of file class.ilTableTemplatesStorage.php.

References $DIC.

31  {
32  global $DIC;
33  $this->db = $DIC->database();
34  }
global $DIC
Definition: shib_login.php:25

Member Function Documentation

◆ delete()

ilTableTemplatesStorage::delete ( string  $a_context,
int  $a_user_id,
string  $a_name 
)

Delete table template.

Definition at line 90 of file class.ilTableTemplatesStorage.php.

References $db, and $ilDB.

94  : void {
95  $ilDB = $this->db;
96 
97  if ($a_context == "" || $a_name == "") {
98  return;
99  }
100 
101  $ilDB->query(
102  "DELETE FROM table_templates " .
103  " WHERE name = " . $ilDB->quote($a_name, "text") .
104  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
105  " AND context = " . $ilDB->quote($a_context, "text")
106  );
107  }

◆ getNames()

ilTableTemplatesStorage::getNames ( string  $a_context,
int  $a_user_id 
)

List templates.

Definition at line 112 of file class.ilTableTemplatesStorage.php.

References $db, and $ilDB.

115  : array {
116  $ilDB = $this->db;
117 
118  if ($a_context == "") {
119  return [];
120  }
121 
122  $set = $ilDB->query(
123  "SELECT name FROM table_templates " .
124  " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") .
125  " AND context = " . $ilDB->quote($a_context, "text") .
126  " ORDER BY name"
127  );
128  $result = array();
129  while ($rec = $ilDB->fetchAssoc($set)) {
130  $result[] = $rec["name"];
131  }
132  return $result;
133  }

◆ load()

ilTableTemplatesStorage::load ( string  $a_context,
int  $a_user_id,
string  $a_name 
)

Get table template.

Definition at line 66 of file class.ilTableTemplatesStorage.php.

References $db, and $ilDB.

70  : ?array {
71  $ilDB = $this->db;
72 
73  if ($a_context == "" || $a_name == "") {
74  return null;
75  }
76 
77  $set = $ilDB->query(
78  "SELECT value FROM table_templates " .
79  " WHERE name = " . $ilDB->quote($a_name, "text") .
80  " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
81  " AND context = " . $ilDB->quote($a_context, "text")
82  );
83  $rec = $ilDB->fetchAssoc($set);
84  return unserialize((string) $rec["value"]);
85  }

◆ store()

ilTableTemplatesStorage::store ( string  $a_context,
int  $a_user_id,
string  $a_name,
array  $a_state 
)

Store table template.

Definition at line 39 of file class.ilTableTemplatesStorage.php.

References $db, and $ilDB.

44  : void {
45  $ilDB = $this->db;
46 
47  if ($a_context == "" || $a_name == "") {
48  return;
49  }
50 
51  $ilDB->replace(
52  "table_templates",
53  array(
54  "name" => array("text", $a_name),
55  "user_id" => array("integer", $a_user_id),
56  "context" => array("text", $a_context)),
57  array(
58  "value" => array("text", serialize($a_state))
59  )
60  );
61  }

Field Documentation

◆ $db

ilDBInterface ilTableTemplatesStorage::$db
protected

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

Referenced by delete(), getNames(), load(), and store().


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