19declare(strict_types=1);
56 require_once __DIR__ .
'/../../../../Calendar/classes/class.ilDateTime.php';
68 $profile ??=
$DIC[
'user']->getProfile();
71 $this->userDefinedFieldsPlaceholderValues =
74 new ilCertificateObjectHelper(),
80 $this->placeholder = [
81 'CERTIFICATE_ID' =>
'',
83 'USER_FULLNAME' =>
'',
84 'USER_FIRSTNAME' =>
'',
85 'USER_LASTNAME' =>
'',
87 'USER_SALUTATION' =>
'',
88 'USER_BIRTHDAY' =>
'',
89 'USER_INSTITUTION' =>
'',
90 'USER_DEPARTMENT' =>
'',
95 'USER_MATRICULATION' =>
'',
98 'DATE_COMPLETED' =>
'',
99 'DATETIME_COMPLETED' =>
'',
113 $user = $this->objectHelper->getInstanceByObjId($userId);
115 throw new ilException(
'The entered id: ' . $userId .
' is not an user object');
120 $placeholder[
'USER_LOGIN'] = $this->utilHelper->prepareFormOutput((trim($user->getLogin())));
121 $placeholder[
'USER_FULLNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getFullname())));
122 $placeholder[
'USER_FIRSTNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getFirstname())));
123 $placeholder[
'USER_LASTNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getLastname())));
124 $placeholder[
'USER_TITLE'] = $this->utilHelper->prepareFormOutput((trim($user->getUTitle())));
127 $gender = $user->getGender();
128 if (trim($gender) !==
'' && strtolower($gender) !==
'n') {
129 $salutation = $this->utilHelper->prepareFormOutput($user_lng->txt(
"salutation_" . trim($gender)));
135 $dateObject = $user->getBirthday();
136 if (
null !== $dateObject) {
137 $birthday = $this->dateHelper->formatDate($dateObject, $user, $this->birthdayDateFormat);
140 $placeholder[
'USER_BIRTHDAY'] = $this->utilHelper->prepareFormOutput((trim($birthday)));
141 $placeholder[
'USER_INSTITUTION'] = $this->utilHelper->prepareFormOutput((trim($user->getInstitution())));
142 $placeholder[
'USER_DEPARTMENT'] = $this->utilHelper->prepareFormOutput((trim($user->getDepartment())));
143 $placeholder[
'USER_STREET'] = $this->utilHelper->prepareFormOutput((trim($user->getStreet())));
144 $placeholder[
'USER_CITY'] = $this->utilHelper->prepareFormOutput((trim($user->getCity())));
145 $placeholder[
'USER_ZIPCODE'] = $this->utilHelper->prepareFormOutput((trim($user->getZipcode())));
146 $placeholder[
'USER_COUNTRY'] = $this->utilHelper->prepareFormOutput((trim($user->getCountry())));
147 $placeholder[
'USER_MATRICULATION'] = $this->utilHelper->prepareFormOutput((trim($user->getMatriculation())));
148 $placeholder[
'DATE'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
151 $this->unix_ts_format_id
153 $placeholder[
'DATETIME'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDateTime(
156 $this->unix_ts_format_id
161 $this->userDefinedFieldsPlaceholderValues->getPlaceholderValues($userId,
$objId)
176 $previewPlacholderValues = [
177 'CERTIFICATE_ID' => $this->utilHelper->prepareFormOutput($this->uuid_factory->uuid4AsString()),
178 "USER_LOGIN" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_login")),
179 "USER_FULLNAME" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_fullname")),
180 "USER_FIRSTNAME" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_firstname")),
181 "USER_LASTNAME" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_lastname")),
182 "USER_TITLE" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_title")),
183 "USER_SALUTATION" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_salutation")),
184 "USER_BIRTHDAY" => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
187 $this->unix_ts_format_id
189 "USER_INSTITUTION" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_institution")),
190 "USER_DEPARTMENT" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_department")),
191 "USER_STREET" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_street")),
192 "USER_CITY" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_city")),
193 "USER_ZIPCODE" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_zipcode")),
194 "USER_COUNTRY" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_country")),
195 "USER_MATRICULATION" => $this->utilHelper->prepareFormOutput($this->
language->txt(
"certificate_var_user_matriculation")),
196 'DATE' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
199 $this->unix_ts_format_id
201 'DATETIME' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDateTime(
204 $this->unix_ts_format_id
206 'DATE_COMPLETED' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(
209 $this->unix_ts_format_id
211 'DATETIME_COMPLETED' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDateTime(
214 $this->unix_ts_format_id
219 $previewPlacholderValues,
220 $this->userDefinedFieldsPlaceholderValues->getPlaceholderValuesForPreview($userId,
$objId)
226 if ($this->user_language instanceof
ilLanguage) {
Just a wrapper class to create Unit Test for other classes.
Collection of basic placeholder values that can be used.
readonly int $unix_ts_format_id
readonly array $placeholder
readonly ilCertificateObjectHelper $objectHelper
readonly ilCertificateDateHelper $dateHelper
readonly ilUserDefinedFieldsPlaceholderValues $userDefinedFieldsPlaceholderValues
getUserLanguage(ilObjUser $user)
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
readonly ilLanguage $language
__construct(?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateDateHelper $dateHelper=null, ?int $unix_ts_format_id=null, ?ilLanguage $language=null, ?Profile $profile=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilUserDefinedFieldsPlaceholderValues $userDefinedFieldsPlaceholderValues=null, ?ILIAS\Data\UUID\Factory $uuid_factory=null, ?int $birthdayDateFormat=null)
readonly ilCertificateUtilHelper $utilHelper
ilLanguage $user_language
readonly Factory $uuid_factory
readonly int $birthdayDateFormat
setUserLanguage(ilLanguage $language)
Base class for ILIAS Exception handling.
loadLanguageModule(string $a_module)
Load language module.
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.