ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 

Protected Member Functions

 read ()
 Read active didactic templates @global 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.

26 {
27 $this->obj_type = $a_obj_type;
28 $this->read();
29 }
read()
Read active didactic templates @global ilDB $ilDB.

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getInstance()

static ilDidacticTemplateSettings::getInstance ( )
static

Get singelton instance.

Returns
ilDidacticTemplateSetting

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

36 {
37 if(self::$instance)
38 {
39 return self::$instance;
40 }
41 return self::$instance = new ilDidacticTemplateSettings();
42 }

References $instance.

Referenced by ilDidacticTemplateSettingsTableGUI\parse().

+ 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 49 of file class.ilDidacticTemplateSettings.php.

50 {
51 if(self::$instances[$a_obj_type])
52 {
53 return self::$instances[$a_obj_type];
54 }
55 return self::$instances[$a_obj_type] = new ilDidacticTemplateSettings($a_obj_type);
56 }

Referenced by ilDidacticTemplateGUI\appendToolbarSwitch(), and ilObjectGUI\initDidacticTemplate().

+ Here is the caller graph for this function:

◆ getObjectType()

ilDidacticTemplateSettings::getObjectType ( )

Get object type.

Returns
string

Definition at line 71 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
array ilDidacticTemplateSetting

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

References $templates.

◆ read()

ilDidacticTemplateSettings::read ( )
protected

Read active didactic templates @global ilDB $ilDB.

Returns
bool

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

111 {
112 global $ilDB;
113
114 $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
115
116 if($this->getObjectType())
117 {
118 $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
119 }
120 $query .= 'WHERE enabled = '.$ilDB->quote(1,'integer').' ';
121
122 if($this->getObjectType())
123 {
124 $query .= 'AND obj_type = '.$ilDB->quote($this->getObjectType(),'text');
125 }
126
127 $res = $ilDB->query($query);
128 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
129 {
130 $this->templates[$row->id] = new ilDidacticTemplateSetting($row->id);
131 }
132 return true;
133 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getObjectType().

Referenced by __construct().

+ 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 79 of file class.ilDidacticTemplateSettings.php.

80 {
81
82 global $ilDB;
83
84 $query = 'SELECT dtpl.id FROM didactic_tpl_settings dtpl ';
85
86 if($this->getObjectType())
87 {
88 $query .= 'JOIN didactic_tpl_sa tplsa ON dtpl.id = tplsa.id ';
89 }
90 $query .= 'WHERE enabled = '.$ilDB->quote(0,'integer').' ';
91
92 if($this->getObjectType())
93 {
94 $query .= 'AND obj_type = '.$ilDB->quote($this->getObjectType(),'text');
95 }
96
97 $res = $ilDB->query($query);
98 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
99 {
100 $this->templates[$row->id] = new ilDidacticTemplateSetting($row->id);
101 }
102 return true;
103 }

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getObjectType().

+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilDidacticTemplateSettings::$instance = null
staticprivate

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

Referenced by getInstance().

◆ $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: