/** * Save Field settings (currently only required status) * @return */ protected function saveFields() { $fields = ilCourseDefinedFieldDefinition::_getFields($this->getObjId()); foreach ($fields as $field_obj) { $field_obj->enableRequired((bool) isset($_POST['required'][$field_obj->getId()])); $field_obj->update(); } ilMemberAgreement::_deleteByObjId($this->getObjId()); ilUtil::sendSuccess($this->lng->txt('settings_saved')); $this->listFields(); return true; }
/** * Check required course fields * * @access protected * */ protected function validateCustomFields() { global $ilUser; $required_fullfilled = true; foreach (ilCourseDefinedFieldDefinition::_getFields($this->container->getId()) as $field_obj) { switch ($field_obj->getType()) { case IL_CDF_TYPE_SELECT: // Split value id from post list($field_id, $option_id) = explode('_', $_POST['cdf_' . $field_obj->getId()]); #$GLOBALS['ilLog']->write(__METHOD__.': '.print_r($field_id,TRUE).' '.print_r($option_id,TRUE).' '.print_r($_POST,TRUE)); $open_answer_indexes = (array) $field_obj->getValueOptions(); if (in_array($option_id, $open_answer_indexes)) { $value = $_POST['cdf_oa_' . $field_obj->getId() . '_' . $option_id]; } else { $value = $field_obj->getValueById($option_id); } break; case IL_CDF_TYPE_TEXT: $value = $_POST['cdf_' . $field_obj->getId()]; break; } $GLOBALS['ilLog']->write(__METHOD__ . ': new value ' . $value); $course_user_data = new ilCourseUserData($ilUser->getId(), $field_obj->getId()); $course_user_data->setValue($value); $course_user_data->update(); if ($field_obj->isRequired() and !$value) { $required_fullfilled = false; } } return $required_fullfilled; }
/** * Check required course fields * * @access private * */ private function checkCourseDefinedFields() { global $ilUser; include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php'; $all_required = true; foreach (ilCourseDefinedFieldDefinition::_getFields($this->obj_id) as $field_obj) { $required_given = false; switch ($field_obj->getType()) { case IL_CDF_TYPE_SELECT: $tmp_values = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]); $tmp_values = explode('_', $tmp_values, 2); if (isset($tmp_values[1])) { $tmp_value = isset($tmp_values[1]) ? $tmp_values[1] : ''; $value = ''; foreach ((array) $field_obj->getValues() as $v) { if ($v == $tmp_value) { $value = $tmp_value; $required_given = true; break; } } } break; case IL_CDF_TYPE_TEXT: $value = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]); if ($value) { $required_given = true; } break; } $course_user_data = new ilCourseUserData($ilUser->getId(), $field_obj->getId()); $course_user_data->setValue($value); $course_user_data->update(); if ($field_obj->isRequired() and !$required_given) { $all_required = false; } } return $all_required; }
/** * fill course specific fields * * @access private * @param int usr_id * @param string field * @return bool * */ private function addCourseField($a_usr_id, $a_field, $row, $col) { if (substr($a_field, 0, 4) != 'cdf_') { return false; } if (!$this->privacy->courseConfirmationRequired() and ilCourseDefinedFieldDefinition::_getFields($this->obj_id) or $this->agreement[$a_usr_id]['accepted']) { $field_info = explode('_', $a_field); $field_id = $field_info[1]; $value = $this->user_course_fields[$a_usr_id][$field_id]; #$this->csv->addColumn($value); $this->addCol($value, $row, $col); return true; } #$this->csv->addColumn(''); $this->addCol('', $row, $col); return true; }
/** * Show list of export files * * @access public * */ public function show($a_deliver_file = false) { $this->showFileList(); $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.member_export.html', 'Modules/Course'); $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this)); $this->tpl->setVariable('TXT_EXPORT_SETTINGS', $this->lng->txt('ps_export_settings')); $this->tpl->setVariable('TXT_USER_SELECTION', $this->lng->txt('ps_user_selection')); $this->tpl->setVariable('TXT_EXPORT_ADMIN', $this->lng->txt('ps_export_admin')); $this->tpl->setVariable('TXT_EXPORT_MEMBER', $this->lng->txt('ps_export_member')); $this->tpl->setVariable('TXT_EXPORT_WAIT', $this->lng->txt('ps_export_wait')); $this->tpl->setVariable('TXT_EXPORT_SUB', $this->lng->txt('ps_export_sub')); // Check user selection $this->exportSettings = new ilUserFormSettings('memexp'); $this->tpl->setVariable('CHECK_EXPORT_ADMIN', ilUtil::formCheckbox($this->exportSettings->enabled('admin'), 'export_members[admin]', 1)); if ($this->type == 'crs') { $this->tpl->setVariable('CHECK_EXPORT_TUTOR', ilUtil::formCheckbox($this->exportSettings->enabled('tutor'), 'export_members[tutor]', 1)); $this->tpl->setVariable('TXT_EXPORT_TUTOR', $this->lng->txt('ps_export_tutor')); } $this->tpl->setVariable('CHECK_EXPORT_MEMBER', ilUtil::formCheckbox($this->exportSettings->enabled('member'), 'export_members[member]', 1)); $this->tpl->setVariable('CHECK_EXPORT_SUB', ilUtil::formCheckbox($this->exportSettings->enabled('subscribers'), 'export_members[subscribers]', 1)); $this->tpl->setVariable('CHECK_EXPORT_WAIT', ilUtil::formCheckbox($this->exportSettings->enabled('waiting_list'), 'export_members[waiting_list]', 1)); $this->tpl->setVariable('TXT_EXPORT', $this->lng->txt('ps_perform_export')); $this->tpl->setVariable('TXT_EXPORT_EXCEL', $this->lng->txt('ps_export_excel')); // User Data $this->tpl->setVariable('TXT_USER_DATA_SELECTION', $this->lng->txt('ps_export_data')); $this->tpl->setVariable('TXT_EXPORT_USER_DATA_HEADER', $this->lng->txt('ps_export_user_data')); include_once './Services/Booking/classes/class.ilBookingEntry.php'; if (ilBookingEntry::hasObjectBookingEntries($this->obj_id, $GLOBALS['ilUser']->getId())) { $this->tpl->setCurrentBlock('consultation'); $this->lng->loadLanguageModule('dateplaner'); $this->tpl->setVariable('TXT_CH', $this->lng->txt('cal_ch_field_ch')); $this->tpl->setVariable('TXT_EXPORT_CH', $this->lng->txt('cal_ch_export_apps')); $this->tpl->setVariable('CHECK_EXPORT_CH', ilUtil::formCheckbox($this->exportSettings->enabled('consultation_hour'), 'export_members[consultation_hour]', 1)); $this->tpl->parseCurrentBlock(); } $fields = $this->fields_info->getFieldsInfo(); foreach ($fields as $field => $exportable) { if (!$exportable) { continue; } $this->tpl->setCurrentBlock('user_data_row'); $this->tpl->setVariable('CHECK_EXPORT_USER_DATA', ilUtil::formCheckbox($this->exportSettings->enabled($field), 'export_members[' . $field . ']', 1)); $this->tpl->setVariable('TXT_EXPORT_USER_DATA', $this->lng->txt($field)); $this->tpl->parseCurrentBlock(); } $udf = ilUserDefinedFields::_getInstance(); foreach ($exp = $udf->getExportableFields($this->obj_id) as $field_id => $udf_data) { $this->tpl->setCurrentBlock('user_data_row'); $this->tpl->setVariable('CHECK_EXPORT_USER_DATA', ilUtil::formCheckbox($this->exportSettings->enabled('udf_' . $field_id), 'export_members[udf_' . $field_id . ']', 1)); $this->tpl->setVariable('TXT_EXPORT_USER_DATA', $udf_data['field_name']); $this->tpl->parseCurrentBlock(); } $cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->obj_id); foreach ($cdf_fields as $field_obj) { $this->tpl->setCurrentBlock('cdf_row'); $this->tpl->setVariable('CHECK_CDF_DATA', ilUtil::formCheckbox($this->exportSettings->enabled('cdf_' . $field_obj->getId()), 'export_members[cdf_' . $field_obj->getId() . ']', 1)); $this->tpl->setVariable('TXT_CDF_NAME', $field_obj->getName()); $this->tpl->parseCurrentBlock(); } if (count($cdf_fields)) { $this->tpl->setCurrentBlock('cdf_fields'); $this->tpl->setVariable('TXT_CDF_SELECTION', $this->lng->txt('ps_' . $this->type . '_user_fields')); $this->tpl->parseCurrentBlock(); } if ($a_deliver_file and 0) { $this->tpl->setCurrentBlock('iframe'); $this->tpl->setVariable('SOURCE', $this->ctrl->getLinkTarget($this, 'deliverData')); } }
/** * Get selectable fields * @return */ public function getSelectableFieldsInfo($a_obj_id) { global $lng; $fields = array(); foreach ($this->getExportableFields() as $field) { switch ($field) { case 'lastname': case 'firstname': break; case 'username': $fields['login']['txt'] = $lng->txt('login'); $fields['login']['default'] = 1; break; default: $fields[$field]['txt'] = $lng->txt($field); $fields[$field]['default'] = 0; break; } } include_once './Services/Booking/classes/class.ilBookingEntry.php'; if (ilBookingEntry::hasObjectBookingEntries($a_obj_id, $GLOBALS['ilUser']->getId())) { $GLOBALS['lng']->loadLanguageModule('dateplaner'); $fields['consultation_hour']['txt'] = $GLOBALS['lng']->txt('cal_ch_field_ch'); $fields['consultation_hour']['default'] = 0; } include_once './Services/User/classes/class.ilUserDefinedFields.php'; if ($this->getType() == 'crs') { $udf = ilUserDefinedFields::_getInstance()->getCourseExportableFields(); } elseif ($this->getType() == 'grp') { $udf = ilUserDefinedFields::_getInstance()->getGroupExportableFields(); } if ($udf) { foreach ($udf as $field_id => $field) { $fields['udf_' . $field_id]['txt'] = $field['field_name']; $fields['udf_' . $field_id]['default'] = 0; } } include_once './Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; $cdf = ilCourseDefinedFieldDefinition::_getFields($a_obj_id); foreach ($cdf as $def) { $fields['odf_' . $def->getId()]['txt'] = $def->getName(); $fields['odf_' . $def->getId()]['default'] = 0; } if (count($cdf)) { // add last edit $fields['odf_last_update']['txt'] = $GLOBALS['lng']->txt($this->getType() . '_cdf_tbl_last_edit'); $fields['odf_last_update']['default'] = 0; } return $fields; }
/** * Save course defined fields * @param ilPropertyFormGUI $form */ public static function saveCourseDefinedFields(ilPropertyFormGUI $form, $a_obj_id, $a_usr_id = 0) { global $ilUser; if (!$a_usr_id) { $a_usr_id = $ilUser->getId(); } foreach (ilCourseDefinedFieldDefinition::_getFields($a_obj_id) as $field_obj) { switch ($field_obj->getType()) { case IL_CDF_TYPE_SELECT: // Split value id from post list($field_id, $option_id) = explode('_', $form->getInput('cdf_' . $field_obj->getId())); $open_answer_indexes = (array) $field_obj->getValueOptions(); if (in_array($option_id, $open_answer_indexes)) { $value = $form->getInput('cdf_oa_' . $field_obj->getId() . '_' . $option_id); } else { $value = $field_obj->getValueById($option_id); } break; case IL_CDF_TYPE_TEXT: $value = $form->getInput('cdf_' . $field_obj->getId()); break; } $course_user_data = new ilCourseUserData($a_usr_id, $field_obj->getId()); $course_user_data->setValue($value); $course_user_data->update(); } }
/** * show information screen */ function infoScreen() { global $ilErr, $ilAccess, $ilUser, $ilSetting; $this->checkPermission('visible'); // Fill meta header tags include_once 'Services/MetaData/classes/class.ilMDUtils.php'; ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs'); $this->tabs_gui->setTabActive('info_short'); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; include_once 'Modules/Course/classes/class.ilCourseFile.php'; $files =& ilCourseFile::_readFilesByCourse($this->object->getId()); $info = new ilInfoScreenGUI($this); $info->enablePrivateNotes(); $info->enableFeedback(); $info->enableNews(); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $info->enableNewsEditing(); } if (strlen($this->object->getImportantInformation()) or strlen($this->object->getSyllabus()) or count($files)) { $info->addSection($this->lng->txt('crs_general_informations')); } if (strlen($this->object->getImportantInformation())) { $info->addProperty($this->lng->txt('crs_important_info'), "<strong>" . nl2br(ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>")); } if (strlen($this->object->getSyllabus())) { $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(ilUtil::makeClickable($this->object->getSyllabus(), true))); } // files if (count($files)) { $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'Modules/Course'); foreach ($files as $file) { $tpl->setCurrentBlock("files"); $this->ctrl->setParameter($this, 'file_id', $file->getFileId()); $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile')); $tpl->setVariable("DOWN_NAME", $file->getFileName()); $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info')); $tpl->setVariable("DOWN_SIZE", $file->getFileSize()); $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes')); $tpl->parseCurrentBlock(); } $info->addProperty($this->lng->txt('crs_file_download'), $tpl->get()); } include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php'; $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId()); $record_gui->setInfoObject($info); $record_gui->parse(); // meta data $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType()); // contact if ($this->object->hasContactData()) { $info->addSection($this->lng->txt("crs_contact")); } if (strlen($this->object->getContactName())) { $info->addProperty($this->lng->txt("crs_contact_name"), $this->object->getContactName()); } if (strlen($this->object->getContactResponsibility())) { $info->addProperty($this->lng->txt("crs_contact_responsibility"), $this->object->getContactResponsibility()); } if (strlen($this->object->getContactPhone())) { $info->addProperty($this->lng->txt("crs_contact_phone"), $this->object->getContactPhone()); } if ($this->object->getContactEmail()) { require_once 'Services/Mail/classes/class.ilMailFormCall.php'; $emails = split(",", $this->object->getContactEmail()); foreach ($emails as $email) { $email = trim($email); $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course'); $etpl->setVariable("EMAIL_LINK", ilMailFormCall::getLinkTarget($info, 'showSummary', array(), array('type' => 'new', 'rcp_to' => $email, 'sig' => $this->createMailSignature()))); $etpl->setVariable("CONTACT_EMAIL", $email); $mailString .= $etpl->get() . "<br />"; } $info->addProperty($this->lng->txt("crs_contact_email"), $mailString); } if (strlen($this->object->getContactConsultation())) { $info->addProperty($this->lng->txt("crs_contact_consultation"), nl2br($this->object->getContactConsultation())); } // // access // // #10360 $this->lng->loadLanguageModule("rep"); $info->addSection($this->lng->txt("rep_activation_availability")); $info->showLDAPRoleGroupMappingInfo(); // activation if ($this->object->getActivationUnlimitedStatus()) { $info->addProperty($this->lng->txt("rep_activation_access"), $this->lng->txt('crs_visibility_limitless')); } else { $info->addProperty($this->lng->txt('rep_activation_access'), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX), new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX))); } switch ($this->object->getSubscriptionLimitationType()) { case IL_CRS_SUBSCRIPTION_DEACTIVATED: $txt = $this->lng->txt("crs_info_reg_deactivated"); break; default: switch ($this->object->getSubscriptionType()) { case IL_CRS_SUBSCRIPTION_CONFIRMATION: $txt = $this->lng->txt("crs_info_reg_confirmation"); break; case IL_CRS_SUBSCRIPTION_DIRECT: $txt = $this->lng->txt("crs_info_reg_direct"); break; case IL_CRS_SUBSCRIPTION_PASSWORD: $txt = $this->lng->txt("crs_info_reg_password"); break; } } // subscription $info->addProperty($this->lng->txt("crs_info_reg"), $txt); if ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) { if ($this->object->getSubscriptionUnlimitedStatus()) { $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_unlimited')); } elseif ($this->object->getSubscriptionStart() < time()) { $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_to') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX))); } elseif ($this->object->getSubscriptionStart() > time()) { $info->addProperty($this->lng->txt("crs_reg_until"), $this->lng->txt('crs_from') . ' ' . ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX))); } if ($this->object->isSubscriptionMembershipLimited()) { include_once './Services/Membership/classes/class.ilParticipants.php'; $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getSubscriptionMaxMembers() - ilParticipants::lookupNumberOfMembers($this->object->getRefId()))); } } // archive if ($this->object->getViewMode() == IL_CRS_VIEW_ARCHIVE) { if ($this->object->getArchiveType() != IL_CRS_ARCHIVE_NONE) { $info->addProperty($this->lng->txt("crs_archive"), ilDatePresentation::formatPeriod(new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX), new ilDateTime($this->object->getArchiveStart(), IL_CAL_UNIX))); } } // Confirmation include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport()) { include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php'; $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType()); $this->lng->loadLanguageModule('ps'); $info->addSection($this->lng->txt('crs_user_agreement_info')); $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString()); if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) { $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields); } } $info->enableLearningProgress(true); // forward the command $this->ctrl->forwardCommand($info); }
/** * Get selectable fields * @return */ public function getSelectableFieldsInfo($a_obj_id) { global $lng; $fields = array(); foreach ($this->getExportableFields() as $field) { switch ($field) { case 'lastname': case 'firstname': break; case 'username': $fields['login']['txt'] = $lng->txt('username'); $fields['login']['default'] = 1; break; default: $fields[$field]['txt'] = $lng->txt($field); $fields[$field]['default'] = 0; break; } } include_once './Services/User/classes/class.ilUserDefinedFields.php'; if ($this->getType() == 'crs') { $udf = ilUserDefinedFields::_getInstance()->getCourseExportableFields(); } elseif ($this->getType() == 'grp') { $udf = ilUserDefinedFields::_getInstance()->getGroupExportableFields(); } if ($udf) { foreach ($udf as $field_id => $field) { $fields['udf_' . $field_id]['txt'] = $field['field_name']; $fields['udf_' . $field_id]['default'] = 0; } } include_once './Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; $cdf = ilCourseDefinedFieldDefinition::_getFields($a_obj_id); foreach ($cdf as $def) { $fields['odf_' . $def->getId()]['txt'] = $def->getName(); $fields['odf_' . $def->getId()]['default'] = 0; } return $fields; }
/** * show information screen */ function infoScreen() { global $rbacsystem, $ilUser, $ilSetting; $this->tabs_gui->setTabActive('info_short'); if (!$rbacsystem->checkAccess("visible", $this->ref_id)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE); } include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); if (strlen($this->object->getInformation())) { $info->addSection($this->lng->txt('grp_general_informations')); $info->addProperty($this->lng->txt('grp_information'), nl2br(ilUtil::makeClickable($this->object->getInformation(), true))); } $info->enablePrivateNotes(); $info->enableLearningProgress(true); $info->addSection($this->lng->txt('group_registration')); $info->showLDAPRoleGroupMappingInfo(); if (!$this->object->isRegistrationEnabled()) { $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_deac_info_screen')); } else { switch ($this->object->getRegistrationType()) { case GRP_REGISTRATION_DIRECT: $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_direct_info_screen')); break; case GRP_REGISTRATION_REQUEST: $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_req_info_screen')); break; case GRP_REGISTRATION_PASSWORD: $info->addProperty($this->lng->txt('group_registration_mode'), $this->lng->txt('grp_reg_passwd_info_screen')); break; } /* $info->addProperty($this->lng->txt('group_registration_time'), ilDatePresentation::formatPeriod( $this->object->getRegistrationStart(), $this->object->getRegistrationEnd())); */ if ($this->object->isRegistrationUnlimited()) { $info->addProperty($this->lng->txt('group_registration_time'), $this->lng->txt('grp_registration_unlimited')); } elseif ($this->object->getRegistrationStart()->getUnixTime() < time()) { $info->addProperty($this->lng->txt("group_registration_time"), $this->lng->txt('cal_until') . ' ' . ilDatePresentation::formatDate($this->object->getRegistrationEnd())); } elseif ($this->object->getRegistrationStart()->getUnixTime() >= time()) { $info->addProperty($this->lng->txt("group_registration_time"), $this->lng->txt('cal_from') . ' ' . ilDatePresentation::formatDate($this->object->getRegistrationStart())); } if ($this->object->isMembershipLimited()) { $info->addProperty($this->lng->txt("mem_free_places"), max(0, $this->object->getMaxMembers() - $this->object->members_obj->getCountMembers())); } } // Confirmation include_once 'Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; if ($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledGroupExport()) { include_once 'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php'; $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType()); $this->lng->loadLanguageModule('ps'); $info->addSection($this->lng->txt('grp_user_agreement_info')); $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString()); if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) { $info->addProperty($this->lng->txt('ps_grp_user_fields'), $fields); } } // forward the command $this->ctrl->forwardCommand($info); }
/** * Check required course fields * * @access protected * */ protected function validateCustomFields() { global $ilUser; include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; include_once 'Modules/Course/classes/Export/class.ilCourseUserData.php'; $all_required = true; foreach (ilCourseDefinedFieldDefinition::_getFields($this->container->getId()) as $field_obj) { switch ($field_obj->getType()) { case IL_CDF_TYPE_SELECT: $tmp_value = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]); $value = ''; foreach ((array) $field_obj->getValues() as $v) { if ($v == $tmp_value) { $value = $tmp_value; break; } } break; case IL_CDF_TYPE_TEXT: $value = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]); break; } $course_user_data = new ilCourseUserData($ilUser->getId(), $field_obj->getId()); $course_user_data->setValue($value); $course_user_data->update(); if ($field_obj->isRequired() and (!strlen($value) or $value == -1)) { $all_required = false; } } return $all_required; }
/** * Check if there are any define fields * * @access public * @param int container_id */ public static function _hasFields($a_container_id) { return count(ilCourseDefinedFieldDefinition::_getFields($a_container_id)); }