86 $language->loadLanguageModule(
'certificate');
102 $this->placeholder = array(
104 'USER_FULLNAME' =>
'',
105 'USER_FIRSTNAME' =>
'',
106 'USER_LASTNAME' =>
'',
108 'USER_SALUTATION' =>
'',
109 'USER_BIRTHDAY' =>
'',
110 'USER_INSTITUTION' =>
'',
111 'USER_DEPARTMENT' =>
'',
114 'USER_ZIPCODE' =>
'',
115 'USER_COUNTRY' =>
'',
116 'USER_MATRICULATION' =>
'',
119 'DATE_COMPLETED' =>
'',
120 'DATETIME_COMPLETED' =>
'',
133 $user = $this->objectHelper->getInstanceByObjId($userId);
135 throw new ilException(
'The entered id: ' . $userId .
' is not an user object');
140 $placeholder[
'USER_LOGIN'] = $this->utilHelper->prepareFormOutput((trim($user->getLogin())));
141 $placeholder[
'USER_FULLNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getFullname())));
142 $placeholder[
'USER_FIRSTNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getFirstname())));
143 $placeholder[
'USER_LASTNAME'] = $this->utilHelper->prepareFormOutput((trim($user->getLastname())));
144 $placeholder[
'USER_TITLE'] = $this->utilHelper->prepareFormOutput((trim($user->getUTitle())));
147 $gender = $user->getGender();
148 if (is_string($gender) && strlen(trim($gender)) > 0 && strtolower($gender) !==
'n') {
149 $salutation = $this->utilHelper->prepareFormOutput($this->
language->txt(
"salutation_" . trim($gender)));
155 $dateObject = $user->getBirthday();
156 if (null !== $dateObject) {
157 $birthday = $this->dateHelper->formatDate($dateObject, $this->birthdayDateFormat);
160 $placeholder[
'USER_BIRTHDAY'] = $this->utilHelper->prepareFormOutput((trim($birthday)));
161 $placeholder[
'USER_INSTITUTION'] = $this->utilHelper->prepareFormOutput((trim($user->getInstitution())));
162 $placeholder[
'USER_DEPARTMENT'] = $this->utilHelper->prepareFormOutput((trim($user->getDepartment())));
163 $placeholder[
'USER_STREET'] = $this->utilHelper->prepareFormOutput((trim($user->getStreet())));
164 $placeholder[
'USER_CITY'] = $this->utilHelper->prepareFormOutput((trim($user->getCity())));
165 $placeholder[
'USER_ZIPCODE'] = $this->utilHelper->prepareFormOutput((trim($user->getZipcode())));
166 $placeholder[
'USER_COUNTRY'] = $this->utilHelper->prepareFormOutput((trim($user->getCountry())));
167 $placeholder[
'USER_MATRICULATION'] = $this->utilHelper->prepareFormOutput((trim($user->getMatriculation())));
168 $placeholder[
'DATE'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(time(), $this->dateFormat))));
169 $placeholder[
'DATETIME'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDatetime(time(), $this->dateFormat))));
171 $placeholder = array_merge(
$placeholder, $this->userDefinedFieldsPlaceholderValues->getPlaceholderValues($userId, $objId));
191 $previewPlacholderValues = array(
192 "USER_LOGIN" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_login")),
193 "USER_FULLNAME" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_fullname")),
194 "USER_FIRSTNAME" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_firstname")),
195 "USER_LASTNAME" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_lastname")),
196 "USER_TITLE" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_title")),
197 "USER_SALUTATION" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_salutation")),
198 "USER_BIRTHDAY" => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(time(), $this->dateFormat)))),
199 "USER_INSTITUTION" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_institution")),
200 "USER_DEPARTMENT" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_department")),
201 "USER_STREET" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_street")),
202 "USER_CITY" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_city")),
203 "USER_ZIPCODE" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_zipcode")),
204 "USER_COUNTRY" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_country")),
205 "USER_MATRICULATION" => $this->utilHelper->prepareFormOutput($this->language->txt(
"certificate_var_user_matriculation")),
206 'DATE' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(time(), $this->dateFormat)))),
207 'DATETIME' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDatetime(time(), $this->dateFormat)))),
208 'DATE_COMPLETED' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(time(), $this->dateFormat)))),
209 'DATETIME_COMPLETED' => $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDatetime(time(), $this->dateFormat))))
212 return array_merge($previewPlacholderValues, $this->userDefinedFieldsPlaceholderValues->getPlaceholderValuesForPreview($userId, $objId));
Collection of basic placeholder values that can be used.
$userDefinedFieldsPlaceholderValues
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
Just a wrapper class to create Unit Test for other classes.
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
__construct(ilCertificateObjectHelper $objectHelper=null, ilCertificateDateHelper $dateHelper=null, int $dateFormat=null, ilLanguage $language=null, ilCertificateUtilHelper $utilHelper=null, ilUserDefinedFieldsPlaceholderValues $userDefinedFieldsPlaceholderValues=null, $birthdayDateFormat=IL_CAL_DATE)