ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 @global ilDB $ilDB. More...
 
static deleteByObjId ($a_obj_id)
 Delete by obj id @global ilDB $ilDB. More...
 
static deleteByTemplateId ($a_tpl_id)
 Delete by template id @global ilDB $ilDB. More...
 
static deleteByRefId ($a_ref_id)
 Delete by ref_id @global ilDB $ilDB. More...
 
static assignTemplate ($a_ref_id, $a_obj_id, $a_tpl_id)
 Assign template to object @global ilDB $ilDB. More...
 
static getAssignmentsByTemplateID ($a_tpl_id)
 Lookup template id @global 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@ilias@gmx.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 @global ilDB $ilDB.

Parameters
int$a_obj_id
int$a_tpl_id
Returns
bool

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

87 {
88 global $ilDB;
89
90 self::deleteByRefId($a_ref_id);
91
92 $query = 'INSERT INTO didactic_tpl_objs (ref_id,obj_id,tpl_id) ' .
93 'VALUES ( ' .
94 $ilDB->quote($a_ref_id, 'integer') . ', ' .
95 $ilDB->quote($a_obj_id, 'integer') . ', ' .
96 $ilDB->quote($a_tpl_id, 'integer') . ' ' .
97 ')';
98 $ilDB->manipulate($query);
99 return true;
100 }
static deleteByRefId($a_ref_id)
Delete by ref_id @global ilDB $ilDB.
$query
global $ilDB

References $ilDB, $query, and deleteByRefId().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteByObjId()

static ilDidacticTemplateObjSettings::deleteByObjId (   $a_obj_id)
static

Delete by obj id @global ilDB $ilDB.

Parameters
int$a_obj_id
Returns
bool

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

40 {
41 global $ilDB;
42
43 $query = 'DELETE FROM didactic_tpl_objs ' .
44 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
45 $ilDB->manipulate($query);
46 return true;
47 }

References $ilDB, and $query.

◆ deleteByRefId()

static ilDidacticTemplateObjSettings::deleteByRefId (   $a_ref_id)
static

Delete by ref_id @global ilDB $ilDB.

Parameters
int$a_ref_id

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

71 {
72 global $ilDB;
73
74 $query = 'DELETE FROM didactic_tpl_objs ' .
75 'WHERE ref_id = ' . $ilDB->quote($a_ref_id, 'integer');
76 $ilDB->manipulate($query);
77 }

References $ilDB, and $query.

Referenced by assignTemplate().

+ Here is the caller graph for this function:

◆ deleteByTemplateId()

static ilDidacticTemplateObjSettings::deleteByTemplateId (   $a_tpl_id)
static

Delete by template id @global ilDB $ilDB.

Parameters
int$a_tpl_id
Returns
bool

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

56 {
57 global $ilDB;
58
59 $query = 'DELETE FROM didactic_tpl_objs ' .
60 'WHERE tpl_id = ' . $ilDB->quote($a_tpl_id, 'integer');
61 $ilDB->manipulate($query);
62 return true;
63 }

References $ilDB, and $query.

Referenced by ilDidacticTemplateSetting\delete().

+ Here is the caller graph for this function:

◆ getAssignmentsByTemplateID()

static ilDidacticTemplateObjSettings::getAssignmentsByTemplateID (   $a_tpl_id)
static

Lookup template id @global ilDB $ilDB.

Parameters
int$a_tpl_id
Returns
array[]

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

108 {
109 global $ilDB;
110
111 $query = 'SELECT * FROM didactic_tpl_objs ' .
112 'WHERE tpl_id = ' . $ilDB->quote($a_tpl_id, 'integer');
113 $res = $ilDB->query($query);
114 $assignments = array();
115
116 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
117 $assignments[] = array("ref_id" => $row->ref_id, "obj_id" => $row->obj_id);
118 }
119 return $assignments;
120 }
foreach($_POST as $key=> $value) $res

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

Referenced by ilDidacticTemplateSettingsGUI\editImport().

+ Here is the caller graph for this function:

◆ lookupTemplateId()

static ilDidacticTemplateObjSettings::lookupTemplateId (   $a_ref_id)
static

Lookup template id @global ilDB $ilDB.

Parameters
int$a_ref_id
Returns
int

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

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 return $row->tpl_id;
28 }
29 return 0;
30 }

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

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

+ 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 130 of file class.ilDidacticTemplateObjSettings.php.

131 {
132 global $ilDB;
133
134 $query = 'SELECT auto_generated FROM didactic_tpl_settings ' .
135 'WHERE id = ' . $ilDB->quote($a_src, 'integer');
136 $res = $ilDB->query($query);
137
139
140 if ($row->auto_generated == 0) {
141 return false;
142 }
143
144 $query = 'UPDATE didactic_tpl_settings ' .
145 'SET ' .
146 'auto_generated = ' . $ilDB->quote(1, 'integer') .
147 ' WHERE id = ' . $ilDB->quote($a_dest, 'integer');
148 $ilDB->manipulate($query);
149
150 $query = 'UPDATE didactic_tpl_settings ' .
151 'SET ' .
152 'auto_generated = ' . $ilDB->quote(0, 'integer') .
153 ' WHERE id = ' . $ilDB->quote($a_src, 'integer');
154 $ilDB->manipulate($query);
155
156 return true;
157 }

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

Referenced by ilDidacticTemplateSettingsGUI\editImport().

+ Here is the caller graph for this function:

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