ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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$

@ilCtrl_Calls ilTableTemplatesStorage:

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

Constructor & Destructor Documentation

◆ __construct()

ilTableTemplatesStorage::__construct ( )

Constructor.

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

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

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 91 of file class.ilTableTemplatesStorage.php.

92 {
94
95 if ($a_context == "" || $a_name == "") {
96 return;
97 }
98
99 $ilDB->query(
100 "DELETE FROM table_templates " .
101 " WHERE name = " . $ilDB->quote($a_name, "text") .
102 " AND user_id = " . $ilDB->quote($a_user_id, "integer") .
103 " AND context = " . $ilDB->quote($a_context, "text")
104 );
105 }
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 114 of file class.ilTableTemplatesStorage.php.

115 {
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 }
$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 66 of file class.ilTableTemplatesStorage.php.

67 {
69
70 if ($a_context == "" || $a_name == "") {
71 return;
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 }

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 38 of file class.ilTableTemplatesStorage.php.

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

References $db, and $ilDB.

Field Documentation

◆ $db

ilTableTemplatesStorage::$db
protected

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

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


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