ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 94 of file class.ilDidacticTemplateObjSettings.php.

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 }
static deleteByRefId($a_ref_id)
Delete by ref_id @global ilDB $ilDB.
$query
global $DIC
Definition: saml.php:7
global $ilDB

References $DIC, $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 41 of file class.ilDidacticTemplateObjSettings.php.

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 }

References $DIC, $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 76 of file class.ilDidacticTemplateObjSettings.php.

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 }

References $DIC, $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 59 of file class.ilDidacticTemplateObjSettings.php.

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 }

References $DIC, $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 117 of file class.ilDidacticTemplateObjSettings.php.

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 }
$row
foreach($_POST as $key=> $value) $res

References $DIC, $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 $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 }

References $DIC, $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(), ilSessionDataSet\readDidacticTemplateType(), 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 142 of file class.ilDidacticTemplateObjSettings.php.

143 {
144 global $DIC;
145
146 $ilDB = $DIC['ilDB'];
147
148 $query = 'SELECT auto_generated FROM didactic_tpl_settings ' .
149 'WHERE id = ' . $ilDB->quote($a_src, 'integer');
150 $res = $ilDB->query($query);
151
153
154 if ($row->auto_generated == 0) {
155 return false;
156 }
157
158 $query = 'UPDATE didactic_tpl_settings ' .
159 'SET ' .
160 'auto_generated = ' . $ilDB->quote(1, 'integer') .
161 ' WHERE id = ' . $ilDB->quote($a_dest, 'integer');
162 $ilDB->manipulate($query);
163
164 $query = 'UPDATE didactic_tpl_settings ' .
165 'SET ' .
166 'auto_generated = ' . $ilDB->quote(0, 'integer') .
167 ' WHERE id = ' . $ilDB->quote($a_src, 'integer');
168 $ilDB->manipulate($query);
169
170 return true;
171 }

References $DIC, $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: