ILIAS  trunk Revision v11.0_alpha-2406-g7062992332c
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 25 of file class.ilDidacticTemplateSettings.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, and read().

37  {
38  global $DIC;
39 
40  $this->obj_type = $a_obj_type;
41  $this->db = $DIC->database();
42  $this->read();
43  }
read()
Read active didactic templates.
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

static ilDidacticTemplateSettings::getInstance ( )
static

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

Referenced by ilDidacticTemplateSettingsGUI\confirmDelete(), ilDidacticTemplateSettingsTableDataRetrieval\getTemplates(), and ilDidacticTemplateIconFactory\initTemplates().

46  {
47  if (self::$instance) {
48  return self::$instance;
49  }
50 
51  return self::$instance = new ilDidacticTemplateSettings();
52  }
+ Here is the caller graph for this function:

◆ getInstanceByObjectType()

static ilDidacticTemplateSettings::getInstanceByObjectType ( string  $a_obj_type)
static

◆ getObjectType()

ilDidacticTemplateSettings::getObjectType ( )

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

References $obj_type.

Referenced by read(), and readInactive().

87  : string
88  {
89  return $this->obj_type;
90  }
+ Here is the caller graph for this function:

◆ getTemplates()

ilDidacticTemplateSettings::getTemplates ( )
Returns
ilDidacticTemplateSetting[]

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

References $templates.

82  : array
83  {
84  return $this->templates;
85  }

◆ lookupAssignedObjectTypes()

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

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

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

Referenced by ilDidacticTemplateSettingsTableFilter\init().

63  : array
64  {
65  global $DIC;
66 
67  $db = $DIC->database();
68  $query = 'select distinct (obj_type) from didactic_tpl_sa ' .
69  'group by obj_type';
70  $res = $db->query($query);
71  $types = [];
72  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
73  $types[] = $row->obj_type;
74  }
75 
76  return $types;
77  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
query(string $query)
Run a (read-only) Query on the database.
+ 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 120 of file class.ilDidacticTemplateSettings.php.

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

Referenced by __construct().

120  : bool
121  {
122  $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
123  if ($this->getObjectType()) {
124  $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
125  }
126  $query .= 'WHERE enabled = ' . $this->db->quote(1, 'integer') . ' ';
127 
128  if ($this->getObjectType()) {
129  $query .= 'AND obj_type = ' . $this->db->quote($this->getObjectType(), 'text');
130  }
131  $res = $this->db->query($query);
132  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
133  $this->templates[$row->id] = new ilDidacticTemplateSetting((int) $row->id);
134  }
135 
136  return true;
137  }
$res
Definition: ltiservices.php:66
+ 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 95 of file class.ilDidacticTemplateSettings.php.

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

95  : bool
96  {
97  $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
98 
99  if ($this->getObjectType()) {
100  $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
101  }
102  $query .= 'WHERE enabled = ' . $this->db->quote(0, 'integer') . ' ';
103 
104  if ($this->getObjectType()) {
105  $query .= 'AND obj_type = ' . $this->db->quote($this->getObjectType(), 'text');
106  }
107 
108  $res = $this->db->query($query);
109  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
110  $this->templates[$row->id] = new ilDidacticTemplateSetting((int) $row->id);
111  }
112 
113  return true;
114  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilDidacticTemplateSettings::$db
private

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

◆ $instance

ilDidacticTemplateSettings ilDidacticTemplateSettings::$instance = null
staticprivate

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

◆ $instances

array ilDidacticTemplateSettings::$instances = []
staticprivate

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

◆ $obj_type

string ilDidacticTemplateSettings::$obj_type = ''
private

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

Referenced by getObjectType().

◆ $templates

array ilDidacticTemplateSettings::$templates = []
private

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

Referenced by getTemplates().


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