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';
110 $this->tpl->setContent($form->getHTML());
118 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
120 $form->setTitle($this->lng->txt($this->type.
'_agreement_header'));
121 $form->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
122 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
127 if($this->
getPrivacy()->confirmationRequired($this->type))
147 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
151 $tpl =
new ilTemplate(
'tpl.agreement_form.html',
true,
true,
'Services/Membership');
152 $tpl->setVariable(
'TXT_INFO_AGREEMENT',$lng->txt($a_type.
'_info_agreement'));
153 foreach($fields_info->getExportableFields() as $field)
155 $tpl->setCurrentBlock(
'field_item');
156 $tpl->setVariable(
'FIELD_NAME',$lng->txt($field));
157 $tpl->parseCurrentBlock();
160 $form->addItem($fields);
177 $agreement->setOptionTitle($lng->txt($a_type.
'_info_agree'));
194 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
195 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
202 if($a_mode ==
'user')
205 $cdf->
setValue($lng->txt($a_type.
'_ps_cdf_info'));
206 $cdf->setRequired(
true);
209 foreach($cdf_fields as $field_obj)
211 switch($field_obj->getType())
215 if($field_obj->getValueOptions())
219 if($field_obj->isRequired())
224 $open_answer_indexes = (array) $field_obj->getValueOptions();
225 foreach($field_obj->getValues() as $key => $val)
227 $option_radio =
new ilRadioOption($val,$field_obj->getId().
'_'.$key);
230 if(in_array($key, $open_answer_indexes))
232 $open_answer =
new ilTextInputGUI($lng->txt(
"form_open_answer"),
'cdf_oa_'.$field_obj->getId().
'_'.$key);
234 $option_radio->addSubItem($open_answer);
237 $option_radios->addOption($option_radio);
239 if($a_mode ==
'user')
241 $cdf->addSubItem($option_radios);
245 $form->addItem($option_radios);
250 $select =
new ilSelectInputGUI($field_obj->getName(),
'cdf_'.$field_obj->getId());
251 #$select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
252 $select->
setOptions($field_obj->prepareSelectBox());
253 if($field_obj->isRequired())
255 $select->setRequired(
true);
257 if($a_mode ==
'user')
259 $cdf->addSubItem($select);
263 $form->addItem($select);
269 $text =
new ilTextInputGUI($field_obj->getName(),
'cdf_'.$field_obj->getId());
270 #$text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
272 $text->setMaxLength(255);
273 if($field_obj->isRequired())
275 $text->setRequired(
true);
277 if($a_mode ==
'user')
279 $cdf->addSubItem($text);
283 $form->addItem($text);
288 if($a_mode ==
'user')
290 $form->addItem($cdf);
321 include_once
'./Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php';
327 $this->ctrl->returnToParent($this);
332 $form->setValuesByPost();
339 $form->setValuesByPost();
351 $a_usr_id = $ilUser->getId();
358 $current_value = $ud[$a_usr_id][$field_obj->getId()];
364 switch($field_obj->getType())
368 $id = $field_obj->getIdByValue($current_value);
373 $item->setValue($field_obj->getId().
'_'.$id);
378 $open_answer_indexes = $field_obj->getValueOptions();
379 $open_answer_index = end($open_answer_indexes);
381 $item->setValue($field_obj->getId().
'_'.$open_answer_index);
382 $item_txt = $form->
getItemByPostVar(
'cdf_oa_'.$field_obj->getId().
'_'.$open_answer_index);
385 $item_txt->setValue($current_value);
392 $item->setValue($current_value);
409 $a_usr_id = $ilUser->getId();
414 switch($field_obj->getType())
419 list($field_id,$option_id) = explode(
'_', $form->
getInput(
'cdf_'.$field_obj->getId()));
420 $open_answer_indexes = (array) $field_obj->getValueOptions();
421 if(in_array($option_id, $open_answer_indexes))
423 $value = $form->
getInput(
'cdf_oa_'.$field_obj->getId().
'_'.$option_id);
427 $value = $field_obj->getValueById($option_id);
432 $value = $form->
getInput(
'cdf_'.$field_obj->getId());
437 $course_user_data->
setValue($value);
438 $course_user_data->update();
457 if($this->privacy->confirmationRequired($this->type))
477 $this->agreement_required = $this->
getAgreement()->agreementRequired();
488 if($this->agreement_required)
490 $message = $this->lng->txt($this->type.
'_ps_agreement_req_info');
492 if(!$this->required_fullfilled)
496 $message .=
'<br />';
498 $message .= $this->lng->txt($this->type.
'_ps_required_info');