ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 = "consultatilon";
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  }
35 
36  protected function getSubTabs(ilTabsGUI $tabs)
37  {
38  $tabs->addSubTab(
39  self::TAB_EDIT,
40  $this->lng->txt("edit"),
41  $this->ctrl->getLinkTarget($this, 'edit')
42  );
43  $tabs->addSubTab(
44  self::TAB_EDIT_INFO,
45  $this->lng->txt("iass_edit_info"),
46  $this->ctrl->getLinkTarget($this, 'editInfo')
47  );
48  }
49 
50  public function executeCommand()
51  {
52  $cmd = $this->ctrl->getCmd();
53  switch ($cmd) {
54  case 'edit':
55  case 'update':
56  case 'cancel':
57  case 'editInfo':
58  case 'updateInfo':
59  if (!$this->iass_access->mayEditObject()) {
60  $this->parent_gui->handleAccessViolation();
61  }
62  $this->$cmd();
63  break;
64  }
65  }
66 
67 
68  protected function cancel()
69  {
70  $this->ctrl->redirect($this->parent_gui);
71  }
72 
73  protected function edit()
74  {
75  $this->tabs_gui->setSubTabActive(self::TAB_EDIT);
76  $form = $this->fillForm($this->initSettingsForm(), $this->object, $this->object->getSettings());
77  $this->renderForm($form);
78  }
79 
80  protected function editInfo()
81  {
82  $this->tabs_gui->setSubTabActive(self::TAB_EDIT_INFO);
83  $form = $this->fillInfoForm($this->initInfoSettingsForm(), $this->object->getInfoSettings());
84  $this->renderForm($form);
85  }
86 
87  protected function updateInfo()
88  {
89  $this->tabs_gui->setSubTabActive(self::TAB_EDIT_INFO);
90  $form = $this->initInfoSettingsForm();
91  $form->setValuesByArray($_POST);
92  if ($form->checkInput()) {
93  $this->object->getInfoSettings()
94  ->setContact($_POST[self::PROP_INFO_CONTACT])
95  ->setResponsibility($_POST[self::PROP_INFO_RESPONSIBILITY])
96  ->setPhone($_POST[self::PROP_INFO_PHONE])
97  ->setMails($_POST[self::PROP_INFO_MAILS])
98  ->setConsultationHours($_POST[self::PROP_INFO_CONSULTATION]);
99  $this->object->updateInfo();
100  ilUtil::sendSuccess($this->lng->txt('iass_settings_saved'));
101  }
102  $this->renderForm($form);
103  }
104 
105  protected function renderForm(ilPropertyFormGUI $a_form)
106  {
107  $this->tpl->setContent($a_form->getHTML());
108  }
109 
110  protected function update()
111  {
112  $this->tabs_gui->setSubTabActive(self::TAB_EDIT);
113  $form = $this->initSettingsForm();
114  $form->setValuesByArray($_POST);
115  if ($form->checkInput()) {
116  $this->object->setTitle($_POST[self::PROP_TITLE]);
117  $this->object->setDescription($_POST[self::PROP_DESCRIPTION]);
118  $this->object->getSettings()->setContent($_POST[self::PROP_CONTENT])
119  ->setRecordTemplate($_POST[self::PROP_RECORD_TEMPLATE])
120  ->setEventTimePlaceRequired((bool) $_POST[self::PROP_EVENT_TIME_PLACE_REQUIRED])
121  ->setFileRequired((bool) $_POST[self::PROP_FILE_REQUIRED]);
122  $this->object->update();
124  $this->object->getId(),
125  $form,
127  );
128  ilUtil::sendSuccess($this->lng->txt('iass_settings_saved'));
129  }
130  $this->renderForm($form);
131  }
132 
133 
134  protected function initSettingsForm()
135  {
136  $form = new ilPropertyFormGUI();
137  $form->setFormAction($this->ctrl->getFormAction($this));
138  $form->setTitle($this->lng->txt('iass_edit'));
139 
140  // title
141  $ti = new ilTextInputGUI($this->lng->txt('title'), self::PROP_TITLE);
142  $ti->setSize(40);
143  $ti->setRequired(true);
144  $form->addItem($ti);
145 
146  // description
147  $ta = new ilTextAreaInputGUI($this->lng->txt('description'), self::PROP_DESCRIPTION);
148  $ta->setCols(40);
149  $ta->setRows(2);
150  $form->addItem($ta);
151 
152 
153  $item = new ilTextAreaInputGUI($this->lng->txt('iass_content'), self::PROP_CONTENT);
154  $item->setInfo($this->lng->txt('iass_content_explanation'));
155  $form->addItem($item);
156 
157  $item = new ilTextAreaInputGUI($this->lng->txt('iass_record_template'), self::PROP_RECORD_TEMPLATE);
158  $item->setInfo($this->lng->txt('iass_record_template_explanation'));
159  $form->addItem($item);
160 
161  $option = new ilCheckboxInputGUI($this->lng->txt('iass_event_time_place_required'), self::PROP_EVENT_TIME_PLACE_REQUIRED);
162  $option->setInfo($this->lng->txt('iass_event_time_place_required_info'));
163  $form->addItem($option);
164 
165  $option = new ilCheckboxInputGUI($this->lng->txt('iass_file_required'), self::PROP_FILE_REQUIRED);
166  $option->setInfo($this->lng->txt('iass_file_required_info'));
167  $form->addItem($option);
168 
169  $form->addCommandButton('update', $this->lng->txt('save'));
170  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
171 
172  $sh = new ilFormSectionHeaderGUI();
173  $sh->setTitle($this->lng->txt("obj_features"));
174  $form->addItem($sh);
175 
177  $this->object->getId(),
178  $form,
180  );
181 
182  return $form;
183  }
184 
185  protected function initInfoSettingsForm()
186  {
187  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
188  $form = new ilPropertyFormGUI();
189  $form->setFormAction($this->ctrl->getFormAction($this));
190  $form->setTitle($this->lng->txt('iass_edit_info'));
191 
192  $ti = new ilTextInputGUI($this->lng->txt('iass_contact'), self::PROP_INFO_CONTACT);
193  $ti->setSize(40);
194  $form->addItem($ti);
195 
196  $ti = new ilTextInputGUI($this->lng->txt('iass_responsibility'), self::PROP_INFO_RESPONSIBILITY);
197  $ti->setSize(40);
198  $form->addItem($ti);
199 
200  $ti = new ilTextInputGUI($this->lng->txt('iass_phone'), self::PROP_INFO_PHONE);
201  $ti->setSize(40);
202  $form->addItem($ti);
203 
204  $ti = new ilTextInputGUI($this->lng->txt('iass_mails'), self::PROP_INFO_MAILS);
205  $ti->setInfo($this->lng->txt('iass_info_emails_expl'));
206  $ti->setSize(300);
207  $form->addItem($ti);
208 
209  $item = new ilTextAreaInputGUI($this->lng->txt('iass_consultation_hours'), self::PROP_INFO_CONSULTATION);
210  $form->addItem($item);
211 
212  $form->addCommandButton('updateInfo', $this->lng->txt('save'));
213  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
214  return $form;
215  }
216 
218  {
219  $a_form->setValuesByArray(array(
220  self::PROP_INFO_CONTACT => $settings->contact()
221  , self::PROP_INFO_RESPONSIBILITY => $settings->responsibility()
222  , self::PROP_INFO_PHONE => $settings->phone()
223  , self::PROP_INFO_MAILS => $settings->mails()
224  , self::PROP_INFO_CONSULTATION => $settings->consultationHours()
225  ));
226  return $a_form;
227  }
228 
230  {
231  $a_form->setValuesByArray(array(
232  self::PROP_TITLE => $iass->getTitle()
233  , self::PROP_DESCRIPTION => $iass->getDescription()
234  , self::PROP_CONTENT => $settings->content()
235  , self::PROP_RECORD_TEMPLATE => $settings->recordTemplate()
236  , self::PROP_EVENT_TIME_PLACE_REQUIRED => $settings->eventTimePlaceRequired()
237  , self::PROP_FILE_REQUIRED => $settings->fileRequired()
238  , ilObjectServiceSettingsGUI::ORGU_POSITION_ACCESS => (bool) ilOrgUnitGlobalSettings::getInstance()->isPositionAccessActiveForObject($iass->getId())
239  ));
240  return $a_form;
241  }
242 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
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.
Create styles array
The data for the language used.
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
Create new PHPExcel object
obj_idprivate
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.