ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  const PROP_EVENT_TIME_PLACE_REQUIRED = "event_time_place_required";
10  const PROP_FILE_REQUIRED = "file_required";
11 
12  const PROP_INFO_CONTACT = "contact";
13  const PROP_INFO_RESPONSIBILITY = "responsibility";
14  const PROP_INFO_PHONE = "phone";
15  const PROP_INFO_MAILS = "mails";
16  const PROP_INFO_CONSULTATION = "consultation";
17 
18  const TAB_EDIT = 'settings';
19  const TAB_EDIT_INFO = 'infoSettings';
20 
21  public function __construct($a_parent_gui, $a_ref_id)
22  {
23  global $DIC;
24  $this->ctrl = $DIC['ilCtrl'];
25  $this->parent_gui = $a_parent_gui;
27  $this->object = $a_parent_gui->object;
28  $this->ref_id = $a_ref_id;
29  $this->tpl = $DIC['tpl'];
30  $this->lng = $DIC['lng'];
31  $this->tabs_gui = $a_parent_gui->tabsGUI();
32  $this->getSubTabs($this->tabs_gui);
33  $this->iass_access = $this->object->accessHandler();
34  $this->obj_service = $DIC->object();
35 
36  $this->lng->loadLanguageModule('content');
37  $this->lng->loadLanguageModule('obj');
38  $this->lng->loadLanguageModule('cntr');
39  }
40 
41  protected function getSubTabs(ilTabsGUI $tabs)
42  {
43  $tabs->addSubTab(
44  self::TAB_EDIT,
45  $this->lng->txt("edit"),
46  $this->ctrl->getLinkTarget($this, 'edit')
47  );
48  $tabs->addSubTab(
49  self::TAB_EDIT_INFO,
50  $this->lng->txt("iass_edit_info"),
51  $this->ctrl->getLinkTarget($this, 'editInfo')
52  );
53  }
54 
55  public function executeCommand()
56  {
57  $cmd = $this->ctrl->getCmd();
58  switch ($cmd) {
59  case 'edit':
60  case 'update':
61  case 'cancel':
62  case 'editInfo':
63  case 'updateInfo':
64  if (!$this->iass_access->mayEditObject()) {
65  $this->parent_gui->handleAccessViolation();
66  }
67  $this->$cmd();
68  break;
69  }
70  }
71 
72 
73  protected function cancel()
74  {
75  $this->ctrl->redirect($this->parent_gui);
76  }
77 
78  protected function edit()
79  {
80  $this->tabs_gui->setSubTabActive(self::TAB_EDIT);
81  $form = $this->fillForm($this->initSettingsForm(), $this->object, $this->object->getSettings());
83  $this->renderForm($form);
84  }
85 
86  protected function editInfo()
87  {
88  $this->tabs_gui->setSubTabActive(self::TAB_EDIT_INFO);
89  $form = $this->fillInfoForm($this->initInfoSettingsForm(), $this->object->getInfoSettings());
90  $this->renderForm($form);
91  }
92 
93  protected function updateInfo()
94  {
95  $this->tabs_gui->setSubTabActive(self::TAB_EDIT_INFO);
96  $form = $this->initInfoSettingsForm();
97  $form->setValuesByArray($_POST);
98  if ($form->checkInput()) {
99  $this->object->getInfoSettings()
100  ->setContact($_POST[self::PROP_INFO_CONTACT])
101  ->setResponsibility($_POST[self::PROP_INFO_RESPONSIBILITY])
102  ->setPhone($_POST[self::PROP_INFO_PHONE])
103  ->setMails($_POST[self::PROP_INFO_MAILS])
104  ->setConsultationHours($_POST[self::PROP_INFO_CONSULTATION]);
105  $this->object->updateInfo();
106  ilUtil::sendSuccess($this->lng->txt('iass_settings_saved'), true);
107  }
108  $this->ctrl->redirect($this, "editInfo");
109  }
110 
111  protected function renderForm(ilPropertyFormGUI $a_form)
112  {
113  $this->tpl->setContent($a_form->getHTML());
114  }
115 
116  protected function update()
117  {
118  $this->tabs_gui->setSubTabActive(self::TAB_EDIT);
119  $form = $this->initSettingsForm();
120  $form->setValuesByArray($_POST);
122  if ($form->checkInput()) {
123  $this->object->setTitle($_POST[self::PROP_TITLE]);
124  $this->object->setDescription($_POST[self::PROP_DESCRIPTION]);
125  $this->object->getSettings()->setContent($_POST[self::PROP_CONTENT])
126  ->setRecordTemplate($_POST[self::PROP_RECORD_TEMPLATE])
127  ->setEventTimePlaceRequired((bool) $_POST[self::PROP_EVENT_TIME_PLACE_REQUIRED])
128  ->setFileRequired((bool) $_POST[self::PROP_FILE_REQUIRED]);
129  $this->object->update();
131  $this->object->getId(),
132  $form,
133  [
136  ]
137  );
138  $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->object);
139  $form_service->saveTitleIconVisibility();
140  $form_service->saveTopActionsVisibility();
141  $form_service->saveIcon();
142  $form_service->saveTileImage();
143  ilUtil::sendSuccess($this->lng->txt('iass_settings_saved'), true);
144  }
145  $this->ctrl->redirect($this, "edit");
146  }
147 
148 
149  protected function initSettingsForm()
150  {
151  $form = new ilPropertyFormGUI();
152  $form->setFormAction($this->ctrl->getFormAction($this));
153  $form->setTitle($this->lng->txt('iass_edit'));
154 
155  // title
156  $ti = new ilTextInputGUI($this->lng->txt('title'), self::PROP_TITLE);
157  $ti->setSize(40);
158  $ti->setRequired(true);
159  $form->addItem($ti);
160 
161  // description
162  $ta = new ilTextAreaInputGUI($this->lng->txt('description'), self::PROP_DESCRIPTION);
163  $ta->setCols(40);
164  $ta->setRows(2);
165  $form->addItem($ta);
166 
167 
168  $item = new ilTextAreaInputGUI($this->lng->txt('iass_content'), self::PROP_CONTENT);
169  $item->setInfo($this->lng->txt('iass_content_explanation'));
170  $form->addItem($item);
171 
172  $item = new ilTextAreaInputGUI($this->lng->txt('iass_record_template'), self::PROP_RECORD_TEMPLATE);
173  $item->setInfo($this->lng->txt('iass_record_template_explanation'));
174  $form->addItem($item);
175 
176  $option = new ilCheckboxInputGUI($this->lng->txt('iass_event_time_place_required'), self::PROP_EVENT_TIME_PLACE_REQUIRED);
177  $option->setInfo($this->lng->txt('iass_event_time_place_required_info'));
178  $form->addItem($option);
179 
180  $option = new ilCheckboxInputGUI($this->lng->txt('iass_file_required'), self::PROP_FILE_REQUIRED);
181  $option->setInfo($this->lng->txt('iass_file_required_info'));
182  $form->addItem($option);
183 
184  $form->addCommandButton('update', $this->lng->txt('save'));
185  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
186 
187  $sh = new ilFormSectionHeaderGUI();
188  $sh->setTitle($this->lng->txt("obj_features"));
189  $form->addItem($sh);
190 
192  $this->object->getId(),
193  $form,
194  [
197  ]
198  );
199 
200  return $form;
201  }
202 
204  {
205  $section_appearance = new ilFormSectionHeaderGUI();
206  $section_appearance->setTitle($this->lng->txt('cont_presentation'));
207  $form->addItem($section_appearance);
208  $form_service = $this->obj_service->commonSettings()->legacyForm($form, $this->object);
209  $form = $form_service->addTitleIconVisibility();
210  $form = $form_service->addTopActionsVisibility();
211  $form = $form_service->addIcon();
212  $form = $form_service->addTileImage();
213  }
214 
215  protected function initInfoSettingsForm()
216  {
217  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
218  $form = new ilPropertyFormGUI();
219  $form->setFormAction($this->ctrl->getFormAction($this));
220  $form->setTitle($this->lng->txt('iass_edit_info'));
221 
222  $ti = new ilTextInputGUI($this->lng->txt('iass_contact'), self::PROP_INFO_CONTACT);
223  $ti->setSize(40);
224  $form->addItem($ti);
225 
226  $ti = new ilTextInputGUI($this->lng->txt('iass_responsibility'), self::PROP_INFO_RESPONSIBILITY);
227  $ti->setSize(40);
228  $form->addItem($ti);
229 
230  $ti = new ilTextInputGUI($this->lng->txt('iass_phone'), self::PROP_INFO_PHONE);
231  $ti->setSize(40);
232  $form->addItem($ti);
233 
234  $ti = new ilTextInputGUI($this->lng->txt('iass_mails'), self::PROP_INFO_MAILS);
235  $ti->setInfo($this->lng->txt('iass_info_emails_expl'));
236  $ti->setSize(300);
237  $form->addItem($ti);
238 
239  $item = new ilTextAreaInputGUI($this->lng->txt('iass_consultation_hours'), self::PROP_INFO_CONSULTATION);
240  $form->addItem($item);
241 
242  $form->addCommandButton('updateInfo', $this->lng->txt('save'));
243  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
244  return $form;
245  }
246 
248  {
249  $a_form->setValuesByArray(array(
250  self::PROP_INFO_CONTACT => $settings->contact()
251  , self::PROP_INFO_RESPONSIBILITY => $settings->responsibility()
252  , self::PROP_INFO_PHONE => $settings->phone()
253  , self::PROP_INFO_MAILS => $settings->mails()
254  , self::PROP_INFO_CONSULTATION => $settings->consultationHours()
255  ));
256  return $a_form;
257  }
258 
260  {
261  $a_form->setValuesByArray(array(
262  self::PROP_TITLE => $iass->getTitle()
263  , self::PROP_DESCRIPTION => $iass->getDescription()
264  , self::PROP_CONTENT => $settings->content()
265  , self::PROP_RECORD_TEMPLATE => $settings->recordTemplate()
266  , self::PROP_EVENT_TIME_PLACE_REQUIRED => $settings->eventTimePlaceRequired()
267  , self::PROP_FILE_REQUIRED => $settings->fileRequired()
268  , ilObjectServiceSettingsGUI::ORGU_POSITION_ACCESS => (bool) ilOrgUnitGlobalSettings::getInstance()->isPositionAccessActiveForObject($iass->getId())
270  $this->object->getId(),
272  false
273  )
274  ));
275  return $a_form;
276  }
277 }
For the purpose of streamlining the grading and learning-process status definition outside of tests...
Tabs GUI.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
This class represents a section header in a property form.
fillForm(ilPropertyFormGUI $a_form, ilObjIndividualAssessment $iass, ilIndividualAssessmentSettings $settings)
An object carrying settings of an Individual Assessment obj beyond the standart information.
eventTimePlaceRequired()
Get the value of the checkbox event_time_place_require.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
fillInfoForm(ilPropertyFormGUI $a_form, ilIndividualAssessmentInfoSettings $settings)
setInfo($a_info)
Set Information Text.
recordTemplate()
Get the record template to be used as default record with corresponding object.
if(isset($_POST['submit'])) $form
getId()
get object id public
content()
Get the content of this assessment, e.g.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
getTitle()
get object title public
getDescription()
get object description
addSubTab($a_id, $a_text, $a_link, $a_frame="")
Add a Subtab.
fileRequired()
Get the value of the checkbox file_required.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
This class represents a text area property in a property form.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
$_POST["username"]
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.