ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 87 of file class.ilDidacticTemplateObjSettings.php.

References $ilDB, and $query.

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

88  {
89  global $ilDB;
90 
91  self::deleteByRefId($a_ref_id);
92 
93  $query = 'INSERT INTO didactic_tpl_objs (ref_id,obj_id,tpl_id) '.
94  'VALUES ( '.
95  $ilDB->quote($a_ref_id,'integer').', '.
96  $ilDB->quote($a_obj_id,'integer').', '.
97  $ilDB->quote($a_tpl_id,'integer').' '.
98  ')';
99  $ilDB->manipulate($query);
100  return true;
101  }
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 40 of file class.ilDidacticTemplateObjSettings.php.

References $ilDB, and $query.

Referenced by ilObject\delete().

41  {
42  global $ilDB;
43 
44  $query = 'DELETE FROM didactic_tpl_objs '.
45  'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
46  $ilDB->manipulate($query);
47  return true;
48  }
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 71 of file class.ilDidacticTemplateObjSettings.php.

References $ilDB, and $query.

Referenced by ilObject\delete().

72  {
73  global $ilDB;
74 
75  $query = 'DELETE FROM didactic_tpl_objs '.
76  'WHERE ref_id = '.$ilDB->quote($a_ref_id,'integer');
77  $ilDB->manipulate($query);
78  }
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 56 of file class.ilDidacticTemplateObjSettings.php.

References $ilDB, and $query.

Referenced by ilDidacticTemplateSetting\delete().

57  {
58  global $ilDB;
59 
60  $query = 'DELETE FROM didactic_tpl_objs '.
61  'WHERE tpl_id = '.$ilDB->quote($a_tpl_id,'integer');
62  $ilDB->manipulate($query);
63  return true;
64  }
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 108 of file class.ilDidacticTemplateObjSettings.php.

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilDidacticTemplateSettingsGUI\editImport().

109  {
110  global $ilDB;
111 
112  $query = 'SELECT * FROM didactic_tpl_objs '.
113  'WHERE tpl_id = '.$ilDB->quote($a_tpl_id, 'integer');
114  $res = $ilDB->query($query);
115  $assignments = array();
116 
117  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
118  {
119  $assignments[] = array("ref_id" => $row->ref_id, "obj_id" => $row->obj_id);
120  }
121  return $assignments;
122  }
Create styles array
The data for the language used.
global $ilDB
+ 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 $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilContainerGUI\afterUpdate(), ilDidacticTemplateGUI\appendToolbarSwitch(), ilRbacAdmin\applyMovedObjectDidacticTemplates(), ilObject\cloneDependencies(), ilDidacticTemplateGUI\confirmTemplateSwitch(), ilDidacticTemplateUtils\switchTemplate(), and ilObjGroupGUI\updateObject().

20  {
21  global $ilDB;
22 
23  $query = 'SELECT tpl_id FROM didactic_tpl_objs '.
24  'WHERE ref_id = '.$ilDB->quote($a_ref_id,'integer');
25  $res = $ilDB->query($query);
26  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
27  {
28  return $row->tpl_id;
29  }
30  return 0;
31  }
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 132 of file class.ilDidacticTemplateObjSettings.php.

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

Referenced by ilDidacticTemplateSettingsGUI\editImport().

133  {
134  global $ilDB;
135 
136  $query = 'SELECT auto_generated FROM didactic_tpl_settings '.
137  'WHERE id = '.$ilDB->quote($a_src, 'integer');
138  $res = $ilDB->query($query);
139 
141 
142  if($row->auto_generated == 0)
143  {
144  return false;
145  }
146 
147  $query = 'UPDATE didactic_tpl_settings '.
148  'SET '.
149  'auto_generated = '.$ilDB->quote(1,'integer').
150  ' WHERE id = '.$ilDB->quote($a_dest,'integer');
151  $ilDB->manipulate($query);
152 
153  $query = 'UPDATE didactic_tpl_settings '.
154  'SET '.
155  'auto_generated = '.$ilDB->quote(0,'integer').
156  ' WHERE id = '.$ilDB->quote($a_src,'integer');
157  $ilDB->manipulate($query);
158 
159  return true;
160  }
global $ilDB
+ Here is the caller graph for this function:

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