ILIAS  release_7 Revision v7.30-3-g800a261c036
ilDidacticTemplateSettings Class Reference
+ Collaboration diagram for ilDidacticTemplateSettings:

Public Member Functions

 getTemplates ()
 Get templates. More...
 
 getObjectType ()
 Get object type. More...
 
 readInactive ()
 Read disabled templates. More...
 

Static Public Member Functions

static getInstance ()
 Get singelton instance. More...
 
static getInstanceByObjectType ($a_obj_type)
 Get instance by obj type. More...
 
static lookupAssignedObjectTypes ()
 

Protected Member Functions

 read ()
 Read active didactic templates ilDB $ilDB. More...
 

Private Member Functions

 __construct ($a_obj_type='')
 Constructor. More...
 

Private Attributes

 $templates = array()
 
 $obj_type = ''
 

Static Private Attributes

static $instance = null
 
static $instances = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettings::__construct (   $a_obj_type = '')
private

Constructor.

Parameters
int$a_id

Definition at line 25 of file class.ilDidacticTemplateSettings.php.

References read().

26  {
27  $this->obj_type = $a_obj_type;
28  $this->read();
29  }
read()
Read active didactic templates ilDB $ilDB.
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

static ilDidacticTemplateSettings::getInstance ( )
static

Get singelton instance.

Returns
ilDidacticTemplateSettings

Definition at line 35 of file class.ilDidacticTemplateSettings.php.

Referenced by ilDidacticTemplateIconFactory\initTemplates(), and ilDidacticTemplateSettingsTableGUI\parse().

36  {
37  if (self::$instance) {
38  return self::$instance;
39  }
40  return self::$instance = new ilDidacticTemplateSettings();
41  }
+ Here is the caller graph for this function:

◆ getInstanceByObjectType()

static ilDidacticTemplateSettings::getInstanceByObjectType (   $a_obj_type)
static

Get instance by obj type.

Parameters
string$a_obj_type
Returns
ilDidacticTemplateSettings

Definition at line 48 of file class.ilDidacticTemplateSettings.php.

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch(), ilSessionDataSet\applyDidacticTemplate(), ilObjectGUI\initDidacticTemplate(), and ilObjGroup\updateGroupType().

49  {
50  if (self::$instances[$a_obj_type]) {
51  return self::$instances[$a_obj_type];
52  }
53  return self::$instances[$a_obj_type] = new ilDidacticTemplateSettings($a_obj_type);
54  }
+ Here is the caller graph for this function:

◆ getObjectType()

ilDidacticTemplateSettings::getObjectType ( )

Get object type.

Returns
string

Definition at line 88 of file class.ilDidacticTemplateSettings.php.

References $obj_type.

Referenced by read(), and readInactive().

+ Here is the caller graph for this function:

◆ getTemplates()

ilDidacticTemplateSettings::getTemplates ( )

Get templates.

Returns
ilDidacticTemplateSetting[]

Definition at line 79 of file class.ilDidacticTemplateSettings.php.

References $templates.

◆ lookupAssignedObjectTypes()

static ilDidacticTemplateSettings::lookupAssignedObjectTypes ( )
static
Returns
string[]
Exceptions
ilDatabaseException

Definition at line 60 of file class.ilDidacticTemplateSettings.php.

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

Referenced by ilDidacticTemplateSettingsTableFilter\init().

60  : array
61  {
62  global $DIC;
63 
64  $db = $DIC->database();
65  $query = 'select distinct (obj_type) from didactic_tpl_sa ' .
66  'group by obj_type';
67  $res = $db->query($query);
68  $types = [];
69  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
70  $types[] = $row->obj_type;
71  }
72  return $types;
73  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ read()

ilDidacticTemplateSettings::read ( )
protected

Read active didactic templates ilDB $ilDB.

Returns
bool

Definition at line 125 of file class.ilDidacticTemplateSettings.php.

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

Referenced by __construct().

126  {
127  global $DIC;
128 
129  $ilDB = $DIC['ilDB'];
130 
131  $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
132 
133  if ($this->getObjectType()) {
134  $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
135  }
136  $query .= 'WHERE enabled = ' . $ilDB->quote(1, 'integer') . ' ';
137 
138  if ($this->getObjectType()) {
139  $query .= 'AND obj_type = ' . $ilDB->quote($this->getObjectType(), 'text');
140  }
141 
142  $res = $ilDB->query($query);
143  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
144  $this->templates[$row->id] = new ilDidacticTemplateSetting($row->id);
145  }
146  return true;
147  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readInactive()

ilDidacticTemplateSettings::readInactive ( )

Read disabled templates.

Definition at line 96 of file class.ilDidacticTemplateSettings.php.

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

97  {
98  global $DIC;
99 
100  $ilDB = $DIC['ilDB'];
101 
102  $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
103 
104  if ($this->getObjectType()) {
105  $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
106  }
107  $query .= 'WHERE enabled = ' . $ilDB->quote(0, 'integer') . ' ';
108 
109  if ($this->getObjectType()) {
110  $query .= 'AND obj_type = ' . $ilDB->quote($this->getObjectType(), 'text');
111  }
112 
113  $res = $ilDB->query($query);
114  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
115  $this->templates[$row->id] = new ilDidacticTemplateSetting($row->id);
116  }
117  return true;
118  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilDidacticTemplateSettings::$instance = null
staticprivate

Definition at line 14 of file class.ilDidacticTemplateSettings.php.

◆ $instances

ilDidacticTemplateSettings::$instances = null
staticprivate

Definition at line 15 of file class.ilDidacticTemplateSettings.php.

◆ $obj_type

ilDidacticTemplateSettings::$obj_type = ''
private

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

Referenced by getObjectType().

◆ $templates

ilDidacticTemplateSettings::$templates = array()
private

Definition at line 18 of file class.ilDidacticTemplateSettings.php.

Referenced by getTemplates().


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