ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTableTemplatesStorage Class Reference

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

+ Collaboration diagram for ilTableTemplatesStorage:

Public Member Functions

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

Protected Attributes

 $db
 

Detailed Description

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
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilTableTemplatesStorage::__construct ( )

Constructor.

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

23 {
24 global $DIC;
25
26 $this->db = $DIC->database();
27 }
global $DIC
Definition: goto.php:24

References $DIC.

Member Function Documentation

◆ delete()

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

Delete table template.

Parameters
string$a_context
int$a_user_id
string$a_name

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

91 {
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 }
global $ilDB

References $db, and $ilDB.

◆ getNames()

ilTableTemplatesStorage::getNames (   $a_context,
  $a_user_id 
)

List templates.

Parameters
string$a_context
int$a_user_id
Returns
array

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

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

References $db, $ilDB, and $result.

◆ load()

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

Get table template.

Parameters
string$a_context
int$a_user_id
string$a_name
Returns
array

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

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

References $db, and $ilDB.

◆ store()

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

Store table template.

Parameters
string$a_context
int$a_user_id
string$a_name
array$a_state

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

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

References $db, and $ilDB.

Field Documentation

◆ $db

ilTableTemplatesStorage::$db
protected

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

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


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