ILIAS  release_8 Revision v8.24
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

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

Constructor & Destructor Documentation

◆ __construct()

ilTableTemplatesStorage::__construct ( )

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

28 {
29 global $DIC;
30 $this->db = $DIC->database();
31 }
global $DIC
Definition: feed.php:28

References $DIC.

Member Function Documentation

◆ delete()

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

Delete table template.

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

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

References $ilDB.

◆ getNames()

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

List templates.

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

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

◆ load()

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

Get table template.

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

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

◆ store()

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

Store table template.

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

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

Field Documentation

◆ $db

ilDBInterface ilTableTemplatesStorage::$db
protected

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


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