4 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
5 include_once(
'Services/Membership/classes/class.ilMemberAgreement.php');
6 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
7 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
45 $this->ref_id = $a_ref_id;
46 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
51 $this->lng->loadLanguageModule(
'ps');
66 $next_class = $this->ctrl->getNextClass($this);
67 $cmd = $this->ctrl->getCmd();
74 $cmd =
'showAgreement';
107 $this->tpl->setContent($form->getHTML());
115 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
117 $form->setTitle($this->lng->txt($this->type.
'_agreement_header'));
118 $form->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
119 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
124 if($this->
getPrivacy()->confirmationRequired($this->type))
144 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
148 $tpl =
new ilTemplate(
'tpl.agreement_form.html',
true,
true,
'Services/Membership');
149 $tpl->setVariable(
'TXT_INFO_AGREEMENT',$lng->txt($a_type.
'_info_agreement'));
150 foreach($fields_info->getExportableFields() as $field)
152 $tpl->setCurrentBlock(
'field_item');
153 $tpl->setVariable(
'FIELD_NAME',$lng->txt($field));
154 $tpl->parseCurrentBlock();
157 $form->addItem($fields);
174 $agreement->setOptionTitle($lng->txt($a_type.
'_info_agree'));
191 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
192 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
200 $cdf->
setValue($lng->txt($a_type.
'_ps_cdf_info'));
201 $cdf->setRequired(
true);
203 foreach($cdf_fields as $field_obj)
205 switch($field_obj->getType())
209 if($field_obj->getValueOptions())
213 if($field_obj->isRequired())
218 $open_answer_indexes = (array) $field_obj->getValueOptions();
219 foreach($field_obj->getValues() as $key => $val)
221 $option_radio =
new ilRadioOption($val,$field_obj->getId().
'_'.$key);
224 if(in_array($key, $open_answer_indexes))
226 $open_answer =
new ilTextInputGUI(
'Sonstiges',
'cdf_oa_'.$field_obj->getId());
228 $option_radio->addSubItem($open_answer);
231 $option_radios->addOption($option_radio);
233 $cdf->addSubItem($option_radios);
237 $select =
new ilSelectInputGUI($field_obj->getName(),
'cdf_'.$field_obj->getId());
238 #$select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
239 $select->
setOptions($field_obj->prepareSelectBox());
240 if($field_obj->isRequired())
242 $select->setRequired(
true);
244 $cdf->addSubItem($select);
249 $text =
new ilTextInputGUI($field_obj->getName(),
'cdf_'.$field_obj->getId());
250 #$text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
252 $text->setMaxLength(255);
253 if($field_obj->isRequired())
255 $text->setRequired(
true);
257 $cdf->addSubItem($text);
261 $form->addItem($cdf);
288 $this->ctrl->returnToParent($this);
293 $form->setValuesByPost();
300 $form->setValuesByPost();
317 switch($field_obj->getType())
322 list($field_id,$option_id) = explode(
'_', $form->
getInput(
'cdf_'.$field_obj->getId()));
323 $open_answer_indexes = (array) $field_obj->getValueOptions();
324 if(in_array($option_id, $open_answer_indexes))
326 $value = $form->
getInput(
'cdf_oa_'.$field_obj->getId());
330 $value = $field_obj->getValueById($option_id);
335 $value = $form->
getInput(
'cdf_'.$field_obj->getId());
339 $course_user_data =
new ilCourseUserData($ilUser->getId(),$field_obj->getId());
340 $course_user_data->
setValue($value);
341 $course_user_data->update();
360 if($this->privacy->confirmationRequired($this->type))
380 $this->agreement_required = $this->
getAgreement()->agreementRequired();
391 if($this->agreement_required)
393 $message = $this->lng->txt($this->type.
'_ps_agreement_req_info');
395 if(!$this->required_fullfilled)
399 $message .=
'<br />';
401 $message .= $this->lng->txt($this->type.
'_ps_required_info');