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';
108 self::setCourseDefinedFieldValues($form, $this->obj_id, $ilUser->getId());
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'));
124 $form = self::addExportFieldInfo($form, $this->obj_id, $this->type);
125 $form = self::addCustomFields($form, $this->obj_id, $this->type);
127 if($this->
getPrivacy()->confirmationRequired($this->type))
129 $form = self::addAgreement($form, $this->obj_id, $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();
162 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
165 $tpl->setCurrentBlock(
'field_item');
166 $tpl->setVariable(
'FIELD_NAME',$field[
'field_name']);
167 $tpl->parseCurrentBlock();
171 $form->addItem($fields);
188 $agreement->setOptionTitle($lng->txt($a_type.
'_info_agree'));
205 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
206 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
213 if($a_mode ==
'user')
216 $cdf->
setValue($lng->txt($a_type.
'_ps_cdf_info'));
217 $cdf->setRequired(
true);
220 foreach($cdf_fields as $field_obj)
222 switch($field_obj->getType())
226 if($field_obj->getValueOptions())
230 if($field_obj->isRequired())
235 $open_answer_indexes = (array) $field_obj->getValueOptions();
236 foreach($field_obj->getValues() as $key => $val)
238 $option_radio =
new ilRadioOption($val,$field_obj->getId().
'_'.$key);
241 if(in_array($key, $open_answer_indexes))
243 $open_answer =
new ilTextInputGUI($lng->txt(
"form_open_answer"),
'cdf_oa_'.$field_obj->getId().
'_'.$key);
245 $option_radio->addSubItem($open_answer);
248 $option_radios->addOption($option_radio);
250 if($a_mode ==
'user')
252 $cdf->addSubItem($option_radios);
256 $form->addItem($option_radios);
261 $select =
new ilSelectInputGUI($field_obj->getName(),
'cdf_'.$field_obj->getId());
262 #$select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()])); 263 $select->
setOptions($field_obj->prepareSelectBox());
264 if($field_obj->isRequired())
266 $select->setRequired(
true);
268 if($a_mode ==
'user')
270 $cdf->addSubItem($select);
274 $form->addItem($select);
281 #$text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()])); 283 $text->setMaxLength(255);
284 if($field_obj->isRequired())
286 $text->setRequired(
true);
288 if($a_mode ==
'user')
290 $cdf->addSubItem(
$text);
294 $form->addItem(
$text);
299 if($a_mode ==
'user')
301 $form->addItem($cdf);
326 self::saveCourseDefinedFields($form, $this->obj_id);
332 include_once
'./Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php';
338 $this->ctrl->returnToParent($this);
343 $form->setValuesByPost();
350 $form->setValuesByPost();
362 $a_usr_id = $ilUser->getId();
369 $current_value = $ud[$a_usr_id][$field_obj->getId()];
375 switch($field_obj->getType())
379 $id = $field_obj->getIdByValue($current_value);
384 $item->setValue($field_obj->getId().
'_'.$id);
389 $open_answer_indexes = $field_obj->getValueOptions();
390 $open_answer_index = end($open_answer_indexes);
392 $item->setValue($field_obj->getId().
'_'.$open_answer_index);
393 $item_txt = $form->
getItemByPostVar(
'cdf_oa_'.$field_obj->getId().
'_'.$open_answer_index);
396 $item_txt->setValue($current_value);
403 $item->setValue($current_value);
420 $a_usr_id = $ilUser->getId();
425 switch($field_obj->getType())
430 list($field_id,$option_id) = explode(
'_', $form->
getInput(
'cdf_'.$field_obj->getId()));
431 $open_answer_indexes = (array) $field_obj->getValueOptions();
432 if(in_array($option_id, $open_answer_indexes))
434 $value = $form->
getInput(
'cdf_oa_'.$field_obj->getId().
'_'.$option_id);
438 $value = $field_obj->getValueById($option_id);
443 $value = $form->
getInput(
'cdf_'.$field_obj->getId());
448 $course_user_data->
setValue($value);
449 $course_user_data->update();
468 if($this->privacy->confirmationRequired($this->type))
488 $this->agreement_required = $this->
getAgreement()->agreementRequired();
499 if($this->agreement_required)
501 $message = $this->lng->txt($this->type.
'_ps_agreement_req_info');
503 if(!$this->required_fullfilled)
507 $message .=
'<br />';
509 $message .= $this->lng->txt($this->type.
'_ps_required_info');
This class represents an option in a radio group.
setValue($a_value)
Set Value.
static _getInstance()
Get instance.
static addExportFieldInfo($form, $a_obj_id, $a_type)
Add export field info to form type $lng.
sendInfoMessage()
Send info message.
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
__construct($a_ref_id)
Constructor.
Editing history for object custom user fields.
static addCustomFields($form, $a_obj_id, $a_type, $a_mode='user')
Add custom course fields.
executeCommand()
Execute Command.
setUpdateUser($a_id)
Set update user.
static _getInstanceByType($a_type)
Get Singleton Instance.
special template class to simplify handling of ITX/PEAR
static addAgreement($form, $a_obj_id, $a_type)
Add agreement to form.
This class represents a text property in a property form.
getPrivacy()
Get privycy settings.
static _checkRequired($a_usr_id, $a_obj_id)
Check required fields.
static _lookupType($a_id, $a_reference=false)
lookup object type
showAgreement(ilPropertyFormGUI $form=null)
Show agreement form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static saveCourseDefinedFields(ilPropertyFormGUI $form, $a_obj_id, $a_usr_id=0)
Save course defined fields.
This class represents a non editable value in a property form.
checkAgreement()
Check Agreement.
static _getInstance()
Get instance of ilPrivacySettings.
static setCourseDefinedFieldValues(ilPropertyFormGUI $form, $a_obj_id, $a_usr_id=0)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.