44 $this->db = $DIC->database();
81 $this->auto_generated = $a_status;
101 $this->title = $a_val;
121 $this->type = $a_val;
141 $this->description = $a_val;
161 public function setSetting($a_setting, $a_value, $a_hide =
false)
164 $settings = $this->
getConfig()->getSettings();
167 if (is_array($a_value)) {
168 $a_value = serialize($a_value);
170 $a_value = unserialize($a_value);
175 $this->setting[$a_setting] = array(
188 unset($this->setting[$a_setting]);
196 $this->setting = array();
215 $this->hidden_tab[$a_tab_id] = $a_tab_id;
223 $this->hidden_tab = array();
268 "SELECT * FROM adm_settings_template WHERE " .
269 " id = " .
$ilDB->quote($this->getId(),
"integer")
271 $rec =
$ilDB->fetchAssoc($set);
281 "SELECT * FROM adm_set_templ_value WHERE " .
282 " template_id = " .
$ilDB->quote($this->getId(),
"integer")
284 while ($rec =
$ilDB->fetchAssoc($set)) {
294 "SELECT * FROM adm_set_templ_hide_tab WHERE " .
295 " template_id = " .
$ilDB->quote($this->getId(),
"integer")
297 while ($rec =
$ilDB->fetchAssoc($set)) {
309 $this->
setId(
$ilDB->nextId(
"adm_settings_template"));
312 $ilDB->insert(
"adm_settings_template", array(
313 "id" => array(
"integer", $this->
getId()),
314 "title" => array(
"text", $this->
getTitle()),
315 "type" => array(
"text", $this->
getType()),
337 $ilDB->update(
"adm_settings_template", array(
338 "title" => array(
"text", $this->
getTitle()),
339 "type" => array(
"text", $this->
getType()),
344 "id" => array(
"integer", $this->
getId()),
349 "DELETE FROM adm_set_templ_value WHERE " 350 .
" template_id = " .
$ilDB->quote($this->getId(),
"integer")
353 "DELETE FROM adm_set_templ_hide_tab WHERE " 354 .
" template_id = " .
$ilDB->quote($this->getId(),
"integer")
370 $ilDB->manipulate(
"INSERT INTO adm_set_templ_value " .
371 "(template_id, setting, value, hide) VALUES (" .
372 $ilDB->quote($this->getId(),
"integer") .
"," .
373 $ilDB->quote(
$s,
"text") .
"," .
374 $ilDB->quote($set[
"value"],
"text") .
"," .
375 $ilDB->quote($set[
"hide"],
"integer") .
388 $ilDB->manipulate(
"INSERT INTO adm_set_templ_hide_tab " .
389 "(template_id, tab_id) VALUES (" .
390 $ilDB->quote($this->getId(),
"integer") .
"," .
391 $ilDB->quote($tab_id,
"text") .
399 public function delete()
404 "DELETE FROM adm_settings_template WHERE " 405 .
" id = " .
$ilDB->quote($this->getId(),
"integer")
408 "DELETE FROM adm_set_templ_value WHERE " 409 .
" template_id = " .
$ilDB->quote($this->getId(),
"integer")
412 "DELETE FROM adm_set_templ_hide_tab WHERE " 413 .
" template_id = " .
$ilDB->quote($this->getId(),
"integer")
426 $ilDB = $DIC->database();
429 if ($a_include_auto_generated) {
430 $set =
$ilDB->query(
"SELECT * FROM adm_settings_template " .
434 $set =
$ilDB->query(
"SELECT * FROM adm_settings_template " .
436 'AND auto_generated = ' .
$ilDB->quote(0,
'integer') .
' ' .
442 $settings_template = array();
443 while ($rec =
$ilDB->fetchAssoc($set)) {
444 $settings_template[] = $rec;
446 return $settings_template;
459 $ilDB = $DIC->database();
462 "SELECT $a_prop FROM adm_settings_template WHERE " .
463 " id = " .
$ilDB->quote($a_id,
"integer")
465 $rec =
$ilDB->fetchAssoc($set);
466 return $rec[$a_prop];
478 return self::lookupProperty($a_id,
'title');
488 return self::lookupProperty($a_id,
'description');
494 if (substr($a_title_desc, 0, 3) ==
'il_') {
495 return $GLOBALS[
'lng']->txt($a_title_desc);
497 return $a_title_desc;
setDescription($a_val)
Set description.
static getAllSettingsTemplates($a_type, $a_include_auto_generated=false)
Get all settings templates of type.
setTitle($a_val)
Set title.
getSettings()
Get settings.
getDescription()
Get description.
setAutoGenerated($a_status)
Set auto generated status.
removeAllHiddenTabs()
Remove all hidden tabs.
setConfig(ilSettingsTemplateConfig $config)
Sets the template config for this template.
getHiddenTabs()
Get hidden tabs.
static translate($a_title_desc)
insertHiddenTabs()
Insert hidden tabs.
update()
Update settings template.
__construct($a_id=0, $config=null)
Constructor.
removeAllSettings()
Remove all settings.
static lookupTitle($a_id)
Lookup title.
addHiddenTab($a_tab_id)
Add hidden tab.
Settings template config class.
setSetting($a_setting, $a_value, $a_hide=false)
Set setting.
create()
Create settings template.
removeSetting($a_setting)
Remove setting.
getAutoGenerated()
Get auto generated status.
insertSettings()
Insert settings to db.
getConfig()
Returns the template config associated with this template or NULL if none is given.
Settings template application class.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static lookupProperty($a_id, $a_prop)
Lookup property.
static lookupDescription($a_id)
Lookup title.