ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDidacticTemplateSettings Class Reference
+ Collaboration diagram for ilDidacticTemplateSettings:

Public Member Functions

 getTemplates ()
 
 getObjectType ()
 
 readInactive ()
 Read disabled templates. More...
 

Static Public Member Functions

static getInstance ()
 
static getInstanceByObjectType (string $a_obj_type)
 
static lookupAssignedObjectTypes ()
 

Protected Member Functions

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

Private Member Functions

 __construct (string $a_obj_type='')
 

Private Attributes

array $templates = []
 
string $obj_type = ''
 
ilDBInterface $db
 

Static Private Attributes

static ilDidacticTemplateSettings $instance = null
 
static array $instances = []
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, and read().

23  {
24  global $DIC;
25 
26  $this->obj_type = $a_obj_type;
27  $this->db = $DIC->database();
28  $this->read();
29  }
global $DIC
Definition: feed.php:28
read()
Read active didactic templates.
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

static ilDidacticTemplateSettings::getInstance ( )
static

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

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

32  {
33  if (self::$instance) {
34  return self::$instance;
35  }
36 
37  return self::$instance = new ilDidacticTemplateSettings();
38  }
+ Here is the caller graph for this function:

◆ getInstanceByObjectType()

static ilDidacticTemplateSettings::getInstanceByObjectType ( string  $a_obj_type)
static

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

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

41  {
42  return self::$instances[$a_obj_type] ?? (self::$instances[$a_obj_type] = new ilDidacticTemplateSettings($a_obj_type));
43  }
+ Here is the caller graph for this function:

◆ getObjectType()

ilDidacticTemplateSettings::getObjectType ( )

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

References $obj_type.

Referenced by read(), and readInactive().

73  : string
74  {
75  return $this->obj_type;
76  }
+ Here is the caller graph for this function:

◆ getTemplates()

ilDidacticTemplateSettings::getTemplates ( )
Returns
ilDidacticTemplateSetting[]

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

References $templates.

68  : array
69  {
70  return $this->templates;
71  }

◆ lookupAssignedObjectTypes()

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

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

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

Referenced by ilDidacticTemplateSettingsTableFilter\init().

49  : array
50  {
51  global $DIC;
52 
53  $db = $DIC->database();
54  $query = 'select distinct (obj_type) from didactic_tpl_sa ' .
55  'group by obj_type';
56  $res = $db->query($query);
57  $types = [];
58  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
59  $types[] = $row->obj_type;
60  }
61 
62  return $types;
63  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilDidacticTemplateSettings::read ( )
protected

Read active didactic templates.

Returns
bool

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

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

Referenced by __construct().

106  : bool
107  {
108  $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
109  if ($this->getObjectType()) {
110  $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
111  }
112  $query .= 'WHERE enabled = ' . $this->db->quote(1, 'integer') . ' ';
113 
114  if ($this->getObjectType()) {
115  $query .= 'AND obj_type = ' . $this->db->quote($this->getObjectType(), 'text');
116  }
117 
118  $res = $this->db->query($query);
119  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
120  $this->templates[$row->id] = new ilDidacticTemplateSetting((int) $row->id);
121  }
122 
123  return true;
124  }
$res
Definition: ltiservices.php:69
$query
+ 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 81 of file class.ilDidacticTemplateSettings.php.

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

81  : bool
82  {
83  $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
84 
85  if ($this->getObjectType()) {
86  $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
87  }
88  $query .= 'WHERE enabled = ' . $this->db->quote(0, 'integer') . ' ';
89 
90  if ($this->getObjectType()) {
91  $query .= 'AND obj_type = ' . $this->db->quote($this->getObjectType(), 'text');
92  }
93 
94  $res = $this->db->query($query);
95  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
96  $this->templates[$row->id] = new ilDidacticTemplateSetting((int) $row->id);
97  }
98 
99  return true;
100  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilDidacticTemplateSettings::$db
private

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

◆ $instance

ilDidacticTemplateSettings ilDidacticTemplateSettings::$instance = null
staticprivate

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

◆ $instances

array ilDidacticTemplateSettings::$instances = []
staticprivate

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

◆ $obj_type

string ilDidacticTemplateSettings::$obj_type = ''
private

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

Referenced by getObjectType().

◆ $templates

array ilDidacticTemplateSettings::$templates = []
private

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

Referenced by getTemplates().


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