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

Stores the applied template id for objects. More...

+ Collaboration diagram for ilDidacticTemplateObjSettings:

Static Public Member Functions

static lookupTemplateId ($a_ref_id)
 Lookup template id ilDB $ilDB. More...
 
static deleteByObjId ($a_obj_id)
 Delete by obj id ilDB $ilDB. More...
 
static deleteByTemplateId ($a_tpl_id)
 Delete by template id ilDB $ilDB. More...
 
static deleteByRefId ($a_ref_id)
 Delete by ref_id ilDB $ilDB. More...
 
static assignTemplate ($a_ref_id, $a_obj_id, $a_tpl_id)
 Assign template to object ilDB $ilDB. More...
 
static getAssignmentsByTemplateID ($a_tpl_id)
 Lookup template id ilDB $ilDB. More...
 
static getAssignmentsForTemplates (array $template_ids)
 
static transferAutoGenerateStatus ($a_src, $a_dest)
 transfer auto generated flag if source is auto generated More...
 

Detailed Description

Stores the applied template id for objects.

Author
Stefan Meyer <meyer.de>

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

Member Function Documentation

◆ assignTemplate()

static ilDidacticTemplateObjSettings::assignTemplate (   $a_ref_id,
  $a_obj_id,
  $a_tpl_id 
)
static

Assign template to object ilDB $ilDB.

Parameters
int$a_obj_id
int$a_tpl_id
Returns
bool

Definition at line 94 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, and $query.

Referenced by ilObject\applyDidacticTemplate(), and ilDidacticTemplateSettingsGUI\editImport().

95  {
96  global $DIC;
97 
98  $ilDB = $DIC['ilDB'];
99 
100  self::deleteByRefId($a_ref_id);
101 
102  $query = 'INSERT INTO didactic_tpl_objs (ref_id,obj_id,tpl_id) ' .
103  'VALUES ( ' .
104  $ilDB->quote($a_ref_id, 'integer') . ', ' .
105  $ilDB->quote($a_obj_id, 'integer') . ', ' .
106  $ilDB->quote($a_tpl_id, 'integer') . ' ' .
107  ')';
108  $ilDB->manipulate($query);
109  return true;
110  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ deleteByObjId()

static ilDidacticTemplateObjSettings::deleteByObjId (   $a_obj_id)
static

Delete by obj id ilDB $ilDB.

Parameters
int$a_obj_id
Returns
bool

Definition at line 41 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, and $query.

Referenced by ilObject\delete().

42  {
43  global $DIC;
44 
45  $ilDB = $DIC['ilDB'];
46 
47  $query = 'DELETE FROM didactic_tpl_objs ' .
48  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
49  $ilDB->manipulate($query);
50  return true;
51  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ deleteByRefId()

static ilDidacticTemplateObjSettings::deleteByRefId (   $a_ref_id)
static

Delete by ref_id ilDB $ilDB.

Parameters
int$a_ref_id

Definition at line 76 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, and $query.

Referenced by ilObject\delete().

77  {
78  global $DIC;
79 
80  $ilDB = $DIC['ilDB'];
81 
82  $query = 'DELETE FROM didactic_tpl_objs ' .
83  'WHERE ref_id = ' . $ilDB->quote($a_ref_id, 'integer');
84  $ilDB->manipulate($query);
85  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ deleteByTemplateId()

static ilDidacticTemplateObjSettings::deleteByTemplateId (   $a_tpl_id)
static

Delete by template id ilDB $ilDB.

Parameters
int$a_tpl_id
Returns
bool

Definition at line 59 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, and $query.

Referenced by ilDidacticTemplateSetting\delete().

60  {
61  global $DIC;
62 
63  $ilDB = $DIC['ilDB'];
64 
65  $query = 'DELETE FROM didactic_tpl_objs ' .
66  'WHERE tpl_id = ' . $ilDB->quote($a_tpl_id, 'integer');
67  $ilDB->manipulate($query);
68  return true;
69  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getAssignmentsByTemplateID()

static ilDidacticTemplateObjSettings::getAssignmentsByTemplateID (   $a_tpl_id)
static

Lookup template id ilDB $ilDB.

Parameters
int$a_tpl_id
Returns
array[]

Definition at line 117 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilDidacticTemplateSettingsGUI\editImport().

118  {
119  global $DIC;
120 
121  $ilDB = $DIC['ilDB'];
122 
123  $query = 'SELECT * FROM didactic_tpl_objs ' .
124  'WHERE tpl_id = ' . $ilDB->quote($a_tpl_id, 'integer');
125  $res = $ilDB->query($query);
126  $assignments = array();
127 
128  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
129  $assignments[] = array("ref_id" => $row->ref_id, "obj_id" => $row->obj_id);
130  }
131  return $assignments;
132  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getAssignmentsForTemplates()

static ilDidacticTemplateObjSettings::getAssignmentsForTemplates ( array  $template_ids)
static
Parameters
int[]$template_ids
Returns
array

Definition at line 138 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_INTEGER.

Referenced by ilDidacticTemplateIconFactory\initTemplates().

138  : array
139  {
140  global $DIC;
141 
142  $db = $DIC->database();
143  $query = 'select * from didactic_tpl_objs ' .
144  'where ' . $db->in('tpl_id', $template_ids, false, ilDBConstants::T_INTEGER);
145  $res = $db->query($query);
146  $assignments = [];
147  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
148  $assignments[$row->tpl_id][] = $row->ref_id;
149  }
150  return $assignments;
151  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ lookupTemplateId()

static ilDidacticTemplateObjSettings::lookupTemplateId (   $a_ref_id)
static

Lookup template id ilDB $ilDB.

Parameters
int$a_ref_id
Returns
int

Definition at line 19 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilContainerGUI\afterUpdate(), ilDidacticTemplateGUI\appendToolbarSwitch(), ilRbacAdmin\applyMovedObjectDidacticTemplates(), ilObject\cloneDependencies(), ilDidacticTemplateGUI\confirmTemplateSwitch(), ilContainerGUI\getEditFormValues(), ilObjectGUI\initDidacticTemplate(), ilObjGroup\read(), ilSessionDataSet\readDidacticTemplateType(), ilObjGroup\readGroupStatus(), ilDidacticTemplateUtils\switchTemplate(), ilObjGroupGUI\updateObject(), ilObjSessionGUI\updateObject(), and ilObjSession\validate().

20  {
21  global $DIC;
22 
23  $ilDB = $DIC['ilDB'];
24 
25  $query = 'SELECT tpl_id FROM didactic_tpl_objs ' .
26  'WHERE ref_id = ' . $ilDB->quote($a_ref_id, 'integer');
27  $res = $ilDB->query($query);
28  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
29  return $row->tpl_id;
30  }
31  return 0;
32  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ transferAutoGenerateStatus()

static ilDidacticTemplateObjSettings::transferAutoGenerateStatus (   $a_src,
  $a_dest 
)
static

transfer auto generated flag if source is auto generated

Parameters
int$a_src
int$a_dest
Returns
bool

Definition at line 161 of file class.ilDidacticTemplateObjSettings.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilDidacticTemplateSettingsGUI\editImport().

162  {
163  global $DIC;
164 
165  $ilDB = $DIC['ilDB'];
166 
167  $query = 'SELECT auto_generated FROM didactic_tpl_settings ' .
168  'WHERE id = ' . $ilDB->quote($a_src, 'integer');
169  $res = $ilDB->query($query);
170 
171  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
172 
173  if ($row->auto_generated == 0) {
174  return false;
175  }
176 
177  $query = 'UPDATE didactic_tpl_settings ' .
178  'SET ' .
179  'auto_generated = ' . $ilDB->quote(1, 'integer') .
180  ' WHERE id = ' . $ilDB->quote($a_dest, 'integer');
181  $ilDB->manipulate($query);
182 
183  $query = 'UPDATE didactic_tpl_settings ' .
184  'SET ' .
185  'auto_generated = ' . $ilDB->quote(0, 'integer') .
186  ' WHERE id = ' . $ilDB->quote($a_src, 'integer');
187  $ilDB->manipulate($query);
188 
189  return true;
190  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

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