19 declare(strict_types=1);
44 ?
int $dateFormat =
null,
49 ?
int $birthdayDateFormat =
null 54 require_once __DIR__ .
'/../../../../Calendar/classes/class.ilDateTime.php';
57 $this->birthdayDateFormat = $birthdayDateFormat ??
IL_CAL_DATE;
59 if (
null === $language) {
61 $language = $DIC->language();
62 $language->loadLanguageModule(
'certificate');
67 $this->userDefinedFieldsPlaceholderValues =
71 $this->placeholder = [
72 'CERTIFICATE_ID' =>
'',
74 'USER_FULLNAME' =>
'',
75 'USER_FIRSTNAME' =>
'',
76 'USER_LASTNAME' =>
'',
78 'USER_SALUTATION' =>
'',
79 'USER_BIRTHDAY' =>
'',
80 'USER_INSTITUTION' =>
'',
81 'USER_DEPARTMENT' =>
'',
86 'USER_MATRICULATION' =>
'',
89 'DATE_COMPLETED' =>
'',
90 'DATETIME_COMPLETED' =>
'',
104 $user = $this->objectHelper->getInstanceByObjId($userId);
106 throw new ilException(
'The entered id: ' . $userId .
' is not an user object');
111 $placeholder[
'USER_LOGIN'] = $this->utilHelper->prepareFormOutput((trim($user->getLogin())));
112 $placeholder[
'USER_FULLNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getFullname())));
113 $placeholder[
'USER_FIRSTNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getFirstname())));
114 $placeholder[
'USER_LASTNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getLastname())));
115 $placeholder[
'USER_TITLE'] = $this->utilHelper->prepareFormOutput((trim($user->getUTitle())));
118 $gender = $user->getGender();
119 if (trim($gender) !==
'' && strtolower($gender) !==
'n') {
120 $salutation = $this->utilHelper->prepareFormOutput($user_lng->txt(
"salutation_" . trim($gender)));
123 $placeholder[
'USER_SALUTATION'] = $salutation;
126 $dateObject = $user->getBirthday();
127 if (
null !== $dateObject) {
128 $birthday = $this->dateHelper->formatDate($dateObject, $user, $this->birthdayDateFormat);
131 $placeholder[
'USER_BIRTHDAY'] = $this->utilHelper->prepareFormOutput((trim($birthday)));
132 $placeholder[
'USER_INSTITUTION'] = $this->utilHelper->prepareFormOutput((trim($user->getInstitution())));
133 $placeholder[
'USER_DEPARTMENT'] = $this->utilHelper->prepareFormOutput((trim($user->getDepartment())));
134 $placeholder[
'USER_STREET'] = $this->utilHelper->prepareFormOutput((trim($user->getStreet())));
135 $placeholder[
'USER_CITY'] = $this->utilHelper->prepareFormOutput((trim($user->getCity())));
136 $placeholder[
'USER_ZIPCODE'] = $this->utilHelper->prepareFormOutput((trim($user->getZipcode())));
137 $placeholder[
'USER_COUNTRY'] = $this->utilHelper->prepareFormOutput((trim($user->getCountry())));
138 $placeholder[
'USER_MATRICULATION'] = $this->utilHelper->prepareFormOutput((trim($user->getMatriculation())));
139 $placeholder[
'DATE'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
144 $placeholder[
'DATETIME'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDateTime(
152 $this->userDefinedFieldsPlaceholderValues->getPlaceholderValues($userId, $objId)
167 $previewPlacholderValues = [
168 'CERTIFICATE_ID' => $this->utilHelper->prepareFormOutput($this->uuid_factory->uuid4AsString()),
169 "USER_LOGIN" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_login")),
170 "USER_FULLNAME" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_fullname")),
171 "USER_FIRSTNAME" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_firstname")),
172 "USER_LASTNAME" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_lastname")),
173 "USER_TITLE" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_title")),
174 "USER_SALUTATION" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_salutation")),
175 "USER_BIRTHDAY" => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
180 "USER_INSTITUTION" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_institution")),
181 "USER_DEPARTMENT" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_department")),
182 "USER_STREET" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_street")),
183 "USER_CITY" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_city")),
184 "USER_ZIPCODE" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_zipcode")),
185 "USER_COUNTRY" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_country")),
186 "USER_MATRICULATION" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_matriculation")),
187 'DATE' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
192 'DATETIME' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDateTime(
197 'DATE_COMPLETED' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
202 'DATETIME_COMPLETED' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDateTime(
210 $previewPlacholderValues,
211 $this->userDefinedFieldsPlaceholderValues->getPlaceholderValuesForPreview($userId, $objId)
217 if ($this->user_language instanceof
ilLanguage) {
Interface Observer Contains several chained tasks and infos about them.
readonly Factory $uuid_factory
readonly ilUserDefinedFieldsPlaceholderValues $userDefinedFieldsPlaceholderValues
loadLanguageModule(string $a_module)
Load language module.
readonly ilCertificateUtilHelper $utilHelper
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly array $placeholder
readonly ilLanguage $language
ilLanguage $user_language
__construct(?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateDateHelper $dateHelper=null, ?int $dateFormat=null, ?ilLanguage $language=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilUserDefinedFieldsPlaceholderValues $userDefinedFieldsPlaceholderValues=null, ?ILIAS\Data\UUID\Factory $uuid_factory=null, ?int $birthdayDateFormat=null)
readonly ilCertificateDateHelper $dateHelper
readonly int $birthdayDateFormat
getUserLanguage(ilObjUser $user)
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
language()
description: > Example for rendring a language glyph.
readonly ilCertificateObjectHelper $objectHelper
setUserLanguage(ilLanguage $language)