ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
13abstract class ilTestSettingsGUI
14{
18 protected $testOBJ = null;
19
25 protected $settingsTemplate = null;
26
28 {
29 $this->testOBJ = $testOBJ;
30
31 $templateId = $this->testOBJ->getTemplate();
32
33 if ($templateId) {
34 include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
35 $this->settingsTemplate = new ilSettingsTemplate($templateId, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
36 }
37 }
38
39 protected function getTemplateSettingValue($settingName)
40 {
41 if (!$this->settingsTemplate) {
42 return null;
43 }
44
45 $templateSettings = $this->settingsTemplate->getSettings();
46
47 if (!isset($templateSettings[$settingName])) {
48 return false;
49 }
50
51 return $templateSettings[$settingName]['value'];
52 }
53
54 protected function isHiddenFormItem($formFieldId)
55 {
56 if (!$this->settingsTemplate) {
57 return false;
58 }
59
60 $settings = $this->settingsTemplate->getSettings();
61
62 if (!isset($settings[$formFieldId])) {
63 return false;
64 }
65
66 if (!$settings[$formFieldId]['hide']) {
67 return false;
68 }
69
70 return true;
71 }
72
73 protected function isSectionHeaderRequired($fields)
74 {
75 foreach ($fields as $field) {
76 if (!$this->isHiddenFormItem($field)) {
77 return true;
78 }
79 }
80
81 return false;
82 }
83
84 protected function formPropertyExists(ilPropertyFormGUI $form, $propertyId)
85 {
86 return $form->getItemByPostVar($propertyId) instanceof ilFormPropertyGUI;
87 }
88
89 protected function removeHiddenItems(ilPropertyFormGUI $form)
90 {
91 if ($this->settingsTemplate) {
92 foreach ($this->settingsTemplate->getSettings() as $id => $item) {
93 if ($item["hide"]) {
94 $form->removeItemByPostVar($id);
95 }
96 }
97 }
98 }
99}
An exception for terminatinating execution or to throw for unit testing.
This class represents a property in a property form.
This class represents a property form user interface.
removeItemByPostVar($a_post_var, $a_remove_unused_headers=false)
Remove Item.
getItemByPostVar($a_post_var)
Get Item by POST variable.
Settings template application class.
formPropertyExists(ilPropertyFormGUI $form, $propertyId)
getTemplateSettingValue($settingName)
removeHiddenItems(ilPropertyFormGUI $form)
__construct(ilObjTest $testOBJ)