ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilIndividualAssessmentSettingsGUI.php
Go to the documentation of this file.
1<?php
2
4
5 const PROP_CONTENT = "content";
6 const PROP_RECORD_TEMPLATE = "record_template";
7 const PROP_TITLE = "title";
8 const PROP_DESCRIPTION = "description";
9
10 const PROP_INFO_CONTACT = "contact";
11 const PROP_INFO_RESPONSIBILITY = "responsibility";
12 const PROP_INFO_PHONE = "phone";
13 const PROP_INFO_MAILS = "mails";
14 const PROP_INFO_CONSULTATION = "consultatilon";
15
16 const TAB_EDIT = 'settings';
17 const TAB_EDIT_INFO = 'infoSettings';
18
19 public function __construct($a_parent_gui, $a_ref_id) {
20 global $DIC;
21 $this->ctrl = $DIC['ilCtrl'];
22 $this->parent_gui = $a_parent_gui;
23 $this->object = $a_parent_gui->object;
24 $this->ref_id = $a_ref_id;
25 $this->tpl = $DIC['tpl'];
26 $this->lng = $DIC['lng'];
27 $this->tabs_gui = $a_parent_gui->tabsGUI();
28 $this->getSubTabs($this->tabs_gui);
29 }
30
31 protected function getSubTabs(ilTabsGUI $tabs) {
32 $tabs->addSubTab(self::TAB_EDIT,
33 $this->lng->txt("edit"),
34 $this->ctrl->getLinkTarget($this,'edit'));
35 $tabs->addSubTab(self::TAB_EDIT_INFO,
36 $this->lng->txt("iass_edit_info"),
37 $this->ctrl->getLinkTarget($this,'editInfo'));
38 }
39
40 public function executeCommand() {
41 $cmd = $this->ctrl->getCmd();
42 switch($cmd) {
43 case 'edit':
44 case 'update':
45 case 'cancel':
46 case 'editInfo':
47 case 'updateInfo':
48 if(!$this->object->accessHandler()->checkAccessToObj($this->object,'write')) {
49 $this->parent_gui->handleAccessViolation();
50 }
51 $this->$cmd();
52 break;
53 }
54 }
55
56
57 protected function cancel() {
58 $this->ctrl->redirect($this->parent_gui);
59 }
60
61 protected function edit() {
62 $this->tabs_gui->setSubTabActive(self::TAB_EDIT);
63 $form = $this->fillForm($this->initSettingsForm()
64 ,$this->object
65 ,$this->object->getSettings());
66 $this->renderForm($form);
67 }
68
69 protected function editInfo() {
70 $this->tabs_gui->setSubTabActive(self::TAB_EDIT_INFO);
71 $form = $this->fillInfoForm($this->initInfoSettingsForm()
72 ,$this->object->getInfoSettings());
73 $this->renderForm($form);
74 }
75
76 protected function updateInfo() {
77 $this->tabs_gui->setSubTabActive(self::TAB_EDIT_INFO);
78 $form = $this->initInfoSettingsForm();
79 $form->setValuesByArray($_POST);
80 if($form->checkInput()) {
81 $this->object->getInfoSettings()
82 ->setContact($_POST[self::PROP_INFO_CONTACT])
83 ->setResponsibility($_POST[self::PROP_INFO_RESPONSIBILITY])
84 ->setPhone($_POST[self::PROP_INFO_PHONE])
85 ->setMails($_POST[self::PROP_INFO_MAILS])
86 ->setConsultationHours($_POST[self::PROP_INFO_CONSULTATION]);
87 $this->object->updateInfo();
88 ilUtil::sendSuccess($this->lng->txt('iass_settings_saved'));
89 }
90 $this->renderForm($form);
91 }
92
93 protected function renderForm(ilPropertyFormGUI $a_form) {
94 $this->tpl->setContent($a_form->getHTML());
95 }
96
97 protected function update() {
98 $this->tabs_gui->setSubTabActive(self::TAB_EDIT);
99 $form = $this->initSettingsForm();
100 $form->setValuesByArray($_POST);
101 if($form->checkInput()) {
102 $this->object->setTitle($_POST[self::PROP_TITLE]);
103 $this->object->setDescription($_POST[self::PROP_DESCRIPTION]);
104 $this->object->getSettings()->setContent($_POST[self::PROP_CONTENT])
105 ->setRecordTemplate($_POST[self::PROP_RECORD_TEMPLATE]);
106 $this->object->update();
107 ilUtil::sendSuccess($this->lng->txt('iass_settings_saved'));
108 }
109 $this->renderForm($form);
110 }
111
112
113 protected function initSettingsForm() {
114 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
115 $form = new ilPropertyFormGUI();
116 $form->setFormAction($this->ctrl->getFormAction($this));
117 $form->setTitle($this->lng->txt('iass_edit'));
118
119 // title
120 $ti = new ilTextInputGUI($this->lng->txt('title'), self::PROP_TITLE);
121 $ti->setSize(40);
122 $ti->setRequired(true);
123 $form->addItem($ti);
124
125 // description
126 $ta = new ilTextAreaInputGUI($this->lng->txt('description'), self::PROP_DESCRIPTION);
127 $ta->setCols(40);
128 $ta->setRows(2);
129 $form->addItem($ta);
130
131
132 $item = new ilTextAreaInputGUI($this->lng->txt('iass_content'), self::PROP_CONTENT);
133 $item->setInfo($this->lng->txt('iass_content_explanation'));
134 $form->addItem($item);
135
136 $item = new ilTextAreaInputGUI($this->lng->txt('iass_record_template'), self::PROP_RECORD_TEMPLATE);
137 $item->setInfo($this->lng->txt('iass_record_template_explanation'));
138 $form->addItem($item);
139
140 $form->addCommandButton('update', $this->lng->txt('save'));
141 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
142 return $form;
143 }
144
145 protected function initInfoSettingsForm() {
146 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
147 $form = new ilPropertyFormGUI();
148 $form->setFormAction($this->ctrl->getFormAction($this));
149 $form->setTitle($this->lng->txt('iass_edit_info'));
150
151 $ti = new ilTextInputGUI($this->lng->txt('iass_contact'), self::PROP_INFO_CONTACT);
152 $ti->setSize(40);
153 $form->addItem($ti);
154
155 $ti = new ilTextInputGUI($this->lng->txt('iass_responsibility'), self::PROP_INFO_RESPONSIBILITY);
156 $ti->setSize(40);
157 $form->addItem($ti);
158
159 $ti = new ilTextInputGUI($this->lng->txt('iass_phone'), self::PROP_INFO_PHONE);
160 $ti->setSize(40);
161 $form->addItem($ti);
162
163 $ti = new ilTextInputGUI($this->lng->txt('iass_mails'), self::PROP_INFO_MAILS);
164 $ti->setInfo($this->lng->txt('iass_info_emails_expl'));
165 $ti->setSize(300);
166 $form->addItem($ti);
167
168 $item = new ilTextAreaInputGUI($this->lng->txt('iass_consultation_hours'), self::PROP_INFO_CONSULTATION);
169 $form->addItem($item);
170
171 $form->addCommandButton('updateInfo', $this->lng->txt('save'));
172 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
173 return $form;
174 }
175
177 $a_form->setValuesByArray(array(
178 self::PROP_INFO_CONTACT => $settings->contact()
179 , self::PROP_INFO_RESPONSIBILITY => $settings->responsibility()
180 , self::PROP_INFO_PHONE => $settings->phone()
181 , self::PROP_INFO_MAILS => $settings->mails()
182 , self::PROP_INFO_CONSULTATION => $settings->consultationHours()
183 ));
184 return $a_form;
185 }
186
188 $a_form->setValuesByArray(array(
189 self::PROP_TITLE => $iass->getTitle()
190 , self::PROP_DESCRIPTION => $iass->getDescription()
191 , self::PROP_CONTENT => $settings->content()
192 , self::PROP_RECORD_TEMPLATE => $settings->recordTemplate()
193 ));
194 return $a_form;
195 }
196}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
fillInfoForm(ilPropertyFormGUI $a_form, ilIndividualAssessmentInfoSettings $settings)
fillForm(ilPropertyFormGUI $a_form, ilObjIndividualAssessment $iass, ilIndividualAssessmentSettings $settings)
An object carrying settings of an Individual Assessment obj beyond the standart information.
content()
Get the content of this assessment, e.g.
recordTemplate()
Get the record template to be used as default record with corresponding object.
For the purpose of streamlining the grading and learning-process status definition outside of tests,...
getDescription()
get object description
getTitle()
get object title @access public
This class represents a property form user interface.
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
Tabs GUI.
addSubTab($a_id, $a_text, $a_link, $a_frame="")
Add a Subtab.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$cmd
Definition: sahs_server.php:35
global $DIC