100 $this->placeholder = array(
102 'USER_FULLNAME' =>
'',
103 'USER_FIRSTNAME' =>
'',
104 'USER_LASTNAME' =>
'',
106 'USER_SALUTATION' =>
'',
107 'USER_BIRTHDAY' =>
'',
108 'USER_INSTITUTION' =>
'',
109 'USER_DEPARTMENT' =>
'',
112 'USER_ZIPCODE' =>
'',
113 'USER_COUNTRY' =>
'',
114 'USER_MATRICULATION' =>
'',
117 'DATE_COMPLETED' =>
'',
118 'DATETIME_COMPLETED' =>
'',
131 $user = $this->objectHelper->getInstanceByObjId($userId);
133 throw new ilException(
'The entered id: ' . $userId .
' is not an user object');
138 $placeholder[
'USER_LOGIN'] = $this->utilHelper->prepareFormOutput((trim(
$user->getLogin())));
139 $placeholder[
'USER_FULLNAME'] = $this->utilHelper->prepareFormOutput((trim(
$user->getFullname())));
140 $placeholder[
'USER_FIRSTNAME'] = $this->utilHelper->prepareFormOutput((trim(
$user->getFirstname())));
141 $placeholder[
'USER_LASTNAME'] = $this->utilHelper->prepareFormOutput((trim(
$user->getLastname())));
142 $placeholder[
'USER_TITLE'] = $this->utilHelper->prepareFormOutput((trim(
$user->getUTitle())));
145 $gender =
$user->getGender();
146 if (is_string($gender) && strlen(trim($gender)) > 0 && strtolower($gender) !==
'n') {
147 $salutation = $this->utilHelper->prepareFormOutput($this->
language->txt(
"salutation_" . trim($gender)));
153 $dateObject =
$user->getBirthday();
154 if (null !== $dateObject) {
155 $birthday = $this->dateHelper->formatDate($dateObject, $this->birthdayDateFormat);
158 $placeholder[
'USER_BIRTHDAY'] = $this->utilHelper->prepareFormOutput((trim($birthday)));
159 $placeholder[
'USER_INSTITUTION'] = $this->utilHelper->prepareFormOutput((trim(
$user->getInstitution())));
160 $placeholder[
'USER_DEPARTMENT'] = $this->utilHelper->prepareFormOutput((trim(
$user->getDepartment())));
161 $placeholder[
'USER_STREET'] = $this->utilHelper->prepareFormOutput((trim(
$user->getStreet())));
162 $placeholder[
'USER_CITY'] = $this->utilHelper->prepareFormOutput((trim(
$user->getCity())));
163 $placeholder[
'USER_ZIPCODE'] = $this->utilHelper->prepareFormOutput((trim(
$user->getZipcode())));
164 $placeholder[
'USER_COUNTRY'] = $this->utilHelper->prepareFormOutput((trim(
$user->getCountry())));
165 $placeholder[
'USER_MATRICULATION'] = $this->utilHelper->prepareFormOutput((trim(
$user->getMatriculation())));
166 $placeholder[
'DATE'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDate(time(), $this->dateFormat))));
167 $placeholder[
'DATETIME'] = $this->utilHelper->prepareFormOutput((trim($this->dateHelper->formatDatetime(time(), $this->dateFormat))));
169 $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)