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 self::setCourseDefinedFieldValues($form, $this->obj_id, $ilUser->getId());
113 $this->tpl->setContent($form->getHTML());
121 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
123 $form->setTitle($this->lng->txt($this->type.
'_agreement_header'));
124 $form->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
125 $form->addCommandButton(
'save', $this->lng->txt(
'save'));
127 $form = self::addExportFieldInfo($form, $this->obj_id, $this->type);
128 $form = self::addCustomFields($form, $this->obj_id, $this->type);
130 if($this->
getPrivacy()->confirmationRequired($this->type))
132 $form = self::addAgreement($form, $this->obj_id, $this->type);
150 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
154 $tpl =
new ilTemplate(
'tpl.agreement_form.html',
true,
true,
'Services/Membership');
155 $tpl->setVariable(
'TXT_INFO_AGREEMENT',$lng->txt(
$a_type.
'_info_agreement'));
156 foreach($fields_info->getExportableFields() as $field)
158 $tpl->setCurrentBlock(
'field_item');
159 $tpl->setVariable(
'FIELD_NAME',$lng->txt($field));
160 $tpl->parseCurrentBlock();
165 include_once(
'Services/User/classes/class.ilUserDefinedFields.php');
168 $tpl->setCurrentBlock(
'field_item');
169 $tpl->setVariable(
'FIELD_NAME',$field[
'field_name']);
170 $tpl->parseCurrentBlock();
174 $form->addItem($fields);
208 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
209 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
216 if($a_mode ==
'user')
220 $cdf->setRequired(
true);
223 foreach($cdf_fields as $field_obj)
225 switch($field_obj->getType())
229 if($field_obj->getValueOptions())
233 if($field_obj->isRequired())
238 $open_answer_indexes = (
array) $field_obj->getValueOptions();
239 foreach($field_obj->getValues() as $key => $val)
241 $option_radio =
new ilRadioOption($val,$field_obj->getId().
'_'.$key);
244 if(in_array($key, $open_answer_indexes))
246 $open_answer =
new ilTextInputGUI($lng->txt(
"form_open_answer"),
'cdf_oa_'.$field_obj->getId().
'_'.$key);
248 $option_radio->addSubItem($open_answer);
251 $option_radios->addOption($option_radio);
253 if($a_mode ==
'user')
255 $cdf->addSubItem($option_radios);
259 $form->addItem($option_radios);
264 $select =
new ilSelectInputGUI($field_obj->getName(),
'cdf_'.$field_obj->getId());
265 #$select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()])); 266 $select->
setOptions($field_obj->prepareSelectBox());
267 if($field_obj->isRequired())
269 $select->setRequired(
true);
271 if($a_mode ==
'user')
273 $cdf->addSubItem($select);
277 $form->addItem($select);
284 #$text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()])); 286 $text->setMaxLength(255);
287 if($field_obj->isRequired())
289 $text->setRequired(
true);
291 if($a_mode ==
'user')
293 $cdf->addSubItem(
$text);
297 $form->addItem(
$text);
302 if($a_mode ==
'user')
304 $form->addItem($cdf);
328 self::saveCourseDefinedFields($form, $this->obj_id);
334 include_once
'./Services/Membership/classes/class.ilObjectCustomUserFieldHistory.php';
340 $this->ctrl->returnToParent($this);
345 $form->setValuesByPost();
352 $form->setValuesByPost();
364 $a_usr_id = $ilUser->getId();
371 $current_value = $ud[$a_usr_id][$field_obj->getId()];
377 switch($field_obj->getType())
381 $id = $field_obj->getIdByValue($current_value);
386 $item->setValue($field_obj->getId().
'_'.$id);
391 $open_answer_indexes = $field_obj->getValueOptions();
392 $open_answer_index = end($open_answer_indexes);
394 $item->setValue($field_obj->getId().
'_'.$open_answer_index);
395 $item_txt = $form->
getItemByPostVar(
'cdf_oa_'.$field_obj->getId().
'_'.$open_answer_index);
398 $item_txt->setValue($current_value);
405 $item->setValue($current_value);
422 $a_usr_id = $ilUser->getId();
427 switch($field_obj->getType())
432 list($field_id,$option_id) = explode(
'_', $form->
getInput(
'cdf_'.$field_obj->getId()));
433 $open_answer_indexes = (
array) $field_obj->getValueOptions();
434 if(in_array($option_id, $open_answer_indexes))
436 $value = $form->
getInput(
'cdf_oa_'.$field_obj->getId().
'_'.$option_id);
440 $value = $field_obj->getValueById($option_id);
445 $value = $form->
getInput(
'cdf_'.$field_obj->getId());
450 $course_user_data->
setValue($value);
451 $course_user_data->update();
470 if($this->privacy->confirmationRequired($this->type))
490 $this->agreement_required = $this->
getAgreement()->agreementRequired();
501 if($this->agreement_required)
503 $message = $this->lng->txt($this->type.
'_ps_agreement_req_info');
505 if(!$this->required_fullfilled)
509 $message .=
'<br />';
511 $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)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
__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.
Create styles array
The data for the language used.
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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static setCourseDefinedFieldValues(ilPropertyFormGUI $form, $a_obj_id, $a_usr_id=0)
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.