19 declare(strict_types=1);
    40         if (null === $language) {
    42             $language = $DIC->language();
    43             $language->loadLanguageModule(
'certificate');
    47         if (null === $defaultPlaceholderValues) {
    50         $this->defaultPlaceholderValuesObject = $defaultPlaceholderValues;
    52         if (null === $dateHelper) {
    57         if (null === $objectHelper) {
    62         if (null === $utilHelper) {
    67         if (null === $objectLPHelper) {
    72         if (null === $lpStatusHelper) {
    91         $this->
language->loadLanguageModule(
'certificate');
    93         $object = $this->objectHelper->getInstanceByObjId($objId);
    94         $points = $object->getPointsInPercent();
    95         if (is_null($points)) {
    96             $txtPoints = $this->
language->txt(
'certificate_points_notavailable');
    98             $txtPoints = number_format(
   101                 $this->
language->txt(
'lang_sep_decimal'),
   102                 $this->
language->txt(
'lang_sep_thousand')
   106         $max_points = $object->getMaxPoints();
   107         $txtMaxPoints = (string) $max_points;
   108         if (is_null($max_points)) {
   109             $txtMaxPoints = $this->
language->txt(
'certificate_points_notavailable');
   110         } elseif ($max_points != floor($max_points)) {
   111             $txtMaxPoints = number_format(
   114                 $this->
language->txt(
'lang_sep_decimal'),
   115                 $this->
language->txt(
'lang_sep_thousand')
   119         $completionDate = $this->lpStatusHelper->lookupStatusChanged($objId, $userId);
   121         $placeHolders = $this->defaultPlaceholderValuesObject->getPlaceholderValues($userId, $objId);
   123         $placeHolders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
   124         $placeHolders[
'SCORM_POINTS'] = $txtPoints;
   125         $placeHolders[
'SCORM_POINTS_MAX'] = $txtMaxPoints;
   127         $placeHolders[
'DATE_COMPLETED'] = 
'';
   128         $placeHolders[
'DATETIME_COMPLETED'] = 
'';
   130         if ($completionDate !== 
'') {
   131             $placeHolders[
'DATE_COMPLETED'] = $this->dateHelper->formatDate($completionDate);
   132             $placeHolders[
'DATETIME_COMPLETED'] = $this->dateHelper->formatDateTime($completionDate);
   135         $olp = $this->objectLPHelper->getInstance($object->getId());
   136         $collection = $olp->getCollectionInstance();
   138         if ($collection !== null) {
   140             foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
   141                 if ($collection->isAssignedEntry($item_id)) {
   142                     $placeHolders[
'SCO_T_' . $counter] = $sahs_item[
'title'];
   143                     $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id, $userId);
   145                     $placeHolders[
'SCO_P_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
   146                     if ($a_scores[
'raw'] !== null) {
   147                         $placeHolders[
'SCO_P_' . $counter] = number_format(
   148                             (
float) $a_scores[
'raw'],
   150                             $this->
language->txt(
'lang_sep_decimal'),
   151                             $this->
language->txt(
'lang_sep_thousand')
   155                     $placeHolders[
'SCO_PM_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
   156                     if ($a_scores[
'max'] !== null) {
   157                         $placeHolders[
'SCO_PM_' . $counter] = number_format(
   158                             (
float) $a_scores[
'max'],
   160                             $this->
language->txt(
'lang_sep_decimal'),
   161                             $this->
language->txt(
'lang_sep_thousand')
   165                     $placeHolders[
'SCO_PP_' . $counter] = $this->
language->txt(
'certificate_points_notavailable');
   166                     if ($a_scores[
'scaled'] !== null) {
   167                         $placeHolders[
'SCO_PP_' . $counter] = number_format(
   168                             (
float) ($a_scores[
'scaled'] * 100),
   170                             $this->
language->txt(
'lang_sep_decimal'),
   171                             $this->
language->txt(
'lang_sep_thousand')
   174                         $placeHolders[
'SCO_PP_' . $counter] .= 
' %';
   182         return $placeHolders;
   192         $placeholders = $this->defaultPlaceholderValuesObject->getPlaceholderValuesForPreview($userId, $objId);
   194         $object = $this->objectHelper->getInstanceByObjId($objId);
   196         $placeholders[
'SCORM_TITLE'] = $this->utilHelper->prepareFormOutput($object->getTitle());
   198         $placeholders[
'SCORM_POINTS'] = number_format(
   201             $this->
language->txt(
'lang_sep_decimal'),
   202             $this->
language->txt(
'lang_sep_thousand')
   205         $placeholders[
'SCORM_POINTS_MAX'] = number_format(
   208             $this->
language->txt(
'lang_sep_decimal'),
   209             $this->
language->txt(
'lang_sep_thousand')
   213         foreach ($placeholders as 
$id => $caption) {
   214             $insert_tags[
$id] = $caption;
   217         $olp = $this->objectLPHelper->getInstance($objId);
   218         $collection = $olp->getCollectionInstance();
   220         if ($collection !== null) {
   222             foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
   223                 if ($collection->isAssignedEntry($item_id)) {
   224                     $insert_tags[
'SCO_T_' . $counter] = $sahs_item[
'title'];
   226                     $insert_tags[
'SCO_P_' . $counter] = number_format(
   229                         $this->
language->txt(
'lang_sep_decimal'),
   230                         $this->
language->txt(
'lang_sep_thousand')
   233                     $insert_tags[
'SCO_PM_' . $counter] = number_format(
   236                         $this->
language->txt(
'lang_sep_decimal'),
   237                         $this->
language->txt(
'lang_sep_thousand')
   240                     $insert_tags[
'SCO_PP_' . $counter] = number_format(
   243                         $this->
language->txt(
'lang_sep_decimal'),
   244                         $this->
language->txt(
'lang_sep_thousand')
 
readonly ilCertificateObjectLPHelper $objectLPHelper
 
readonly ilCertificateLPStatusHelper $lpStatusHelper
 
getPlaceholderValuesForPreview(int $userId, int $objId)
This method is different then the 'getPlaceholderValues' method, this method is used to create a plac...
 
readonly ilDefaultPlaceholderValues $defaultPlaceholderValuesObject
 
readonly ilCertificateUtilHelper $utilHelper
 
readonly ilCertificateDateHelper $dateHelper
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
getPlaceholderValues(int $userId, int $objId)
This method MUST return an array that contains the actual data for the given user of the given object...
 
readonly ilLanguage $language
 
readonly ilCertificateObjectHelper $objectHelper
 
language()
 description: > Example for rendring a language glyph. 
 
__construct(?ilDefaultPlaceholderValues $defaultPlaceholderValues=null, ?ilLanguage $language=null, ?ilCertificateDateHelper $dateHelper=null, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateUtilHelper $utilHelper=null, ?ilCertificateObjectLPHelper $objectLPHelper=null, ?ilCertificateLPStatusHelper $lpStatusHelper=null)