ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCertificateLearningHistoryProvider Class Reference
+ Inheritance diagram for ilCertificateLearningHistoryProvider:
+ Collaboration diagram for ilCertificateLearningHistoryProvider:

Public Member Functions

 __construct (int $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ?ilTemplate $template=null, ?Container $dic=null, ?ilUserCertificateRepository $userCertificateRepository=null, ?ilCtrlInterface $ctrl=null, ?ilSetting $certificateSettings=null, ?Factory $uiFactory=null, ?Renderer $uiRenderer=null, ?ilCertificateUtilHelper $utilHelper=null)
 
 isActive ()
 
 getEntries (int $ts_start, int $ts_end)
 Get entries. More...
 
 getName ()
 
- Public Member Functions inherited from ilAbstractLearningHistoryProvider
 __construct (int $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ?ilTemplate $template=null)
 
 isActive ()
 
 getEntries (int $ts_start, int $ts_end)
 
 getName ()
 

Protected Attributes

Factory $uiFactory
 
Renderer $uiRenderer
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
int $user_id
 
ilLearningHistoryFactory $factory
 
ilLanguage $lng
 

Private Attributes

readonly ilUserCertificateRepository $userCertificateRepository
 
readonly ilCtrlInterface $ctrl
 
readonly ilSetting $certificateSettings
 
readonly ilCertificateUtilHelper $utilHelper
 

Additional Inherited Members

- Protected Member Functions inherited from ilAbstractLearningHistoryProvider
 getUserId ()
 
 getFactory ()
 
 getLanguage ()
 
 getEmphasizedTitle (string $title)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateLearningHistoryProvider::__construct ( int  $user_id,
ilLearningHistoryFactory  $factory,
ilLanguage  $lng,
?ilTemplate  $template = null,
?Container  $dic = null,
?ilUserCertificateRepository  $userCertificateRepository = null,
?ilCtrlInterface  $ctrl = null,
?ilSetting  $certificateSettings = null,
?Factory  $uiFactory = null,
?Renderer  $uiRenderer = null,
?ilCertificateUtilHelper  $utilHelper = null 
)

Definition at line 37 of file class.ilCertificateLearningHistoryProvider.php.

49 {
50 $lng->loadLanguageModule("cert");
51
53
54 if (null === $dic) {
55 global $DIC;
56 $dic = $DIC;
57 }
58
59 if (null === $userCertificateRepository) {
60 $database = $dic->database();
61 $looger = $dic->logger()->cert();
63 }
64 $this->userCertificateRepository = $userCertificateRepository;
65
66 if (null === $ctrl) {
67 $ctrl = $dic->ctrl();
68 }
69 $this->ctrl = $ctrl;
70
71 if (null === $certificateSettings) {
72 $certificateSettings = new ilSetting("certificate");
73 }
74 $this->certificateSettings = $certificateSettings;
75
76 if (null === $uiFactory) {
77 $uiFactory = $dic->ui()->factory();
78 }
79 $this->uiFactory = $uiFactory;
80
81 if (null === $uiRenderer) {
82 $uiRenderer = $dic->ui()->renderer();
83 }
84 $this->uiRenderer = $uiRenderer;
85
86 if (null === $utilHelper) {
88 }
89 $this->utilHelper = $utilHelper;
90 }
readonly ilUserCertificateRepository $userCertificateRepository
Just a wrapper class to create Unit Test for other classes.
loadLanguageModule(string $a_module)
Load language module.
ILIAS Setting Class.
$dic
Definition: ltiresult.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $certificateSettings, $ctrl, $DIC, $dic, ilAbstractLearningHistoryProvider\$factory, ilAbstractLearningHistoryProvider\$lng, ilAbstractLearningHistoryProvider\$template, $uiFactory, $uiRenderer, ilAbstractLearningHistoryProvider\$user_id, $userCertificateRepository, $utilHelper, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), and ilLanguage\loadLanguageModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ getEntries()

ilCertificateLearningHistoryProvider::getEntries ( int  $ts_start,
int  $ts_end 
)

Get entries.

Returns
ilLearningHistoryEntry[]

Implements ilLearningHistoryProviderInterface.

Definition at line 101 of file class.ilCertificateLearningHistoryProvider.php.

101 : array
102 {
103 $entries = [];
104
105 $certificates = $this->userCertificateRepository->fetchActiveCertificatesInIntervalForPresentation(
106 $this->user_id,
107 $ts_start,
108 $ts_end
109 );
110
111 foreach ($certificates as $certificate) {
112 $objectId = $certificate->getUserCertificate()->getObjId();
113
114 $this->ctrl->setParameterByClass(
115 ilUserCertificateGUI::class,
116 'certificate_id',
117 $certificate->getUserCertificate()->getId()
118 );
119 $href = $this->ctrl->getLinkTargetByClass(
120 [
121 ilDashboardGUI::class,
122 ilAchievementsGUI::class,
123 ilUserCertificateGUI::class
124 ],
125 'download'
126 );
127 $this->ctrl->clearParametersByClass(ilUserCertificateGUI::class);
128
129 $prefixTextWithLink = sprintf(
130 $this->lng->txt('certificate_achievement_sub_obj'),
131 $this->uiRenderer->render($this->uiFactory->link()->standard(
132 $this->getEmphasizedTitle($certificate->getObjectTitle()),
133 $href
134 ))
135 );
136
137 $text = sprintf(
138 $this->lng->txt('certificate_achievement'),
139 $prefixTextWithLink
140 );
141
142 $entries[] = new ilLearningHistoryEntry(
143 $text,
144 $text,
145 $this->utilHelper->getImagePath("standard/icon_cert.svg"),
146 $certificate->getUserCertificate()->getAcquiredTimestamp(),
147 $objectId
148 );
149 }
150
151 return $entries;
152 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getName()

ilCertificateLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

Definition at line 154 of file class.ilCertificateLearningHistoryProvider.php.

154 : string
155 {
156 return $this->lng->txt('certificates');
157 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ isActive()

ilCertificateLearningHistoryProvider::isActive ( )

Implements ilLearningHistoryProviderInterface.

Definition at line 92 of file class.ilCertificateLearningHistoryProvider.php.

92 : bool
93 {
94 return (bool) $this->certificateSettings->get('active', '0');
95 }

Field Documentation

◆ $certificateSettings

readonly ilSetting ilCertificateLearningHistoryProvider::$certificateSettings
private

Definition at line 32 of file class.ilCertificateLearningHistoryProvider.php.

Referenced by __construct().

◆ $ctrl

readonly ilCtrlInterface ilCertificateLearningHistoryProvider::$ctrl
private

Definition at line 31 of file class.ilCertificateLearningHistoryProvider.php.

Referenced by __construct().

◆ $uiFactory

Factory ilCertificateLearningHistoryProvider::$uiFactory
protected

Definition at line 33 of file class.ilCertificateLearningHistoryProvider.php.

Referenced by __construct().

◆ $uiRenderer

Renderer ilCertificateLearningHistoryProvider::$uiRenderer
protected

Definition at line 34 of file class.ilCertificateLearningHistoryProvider.php.

Referenced by __construct().

◆ $userCertificateRepository

readonly ilUserCertificateRepository ilCertificateLearningHistoryProvider::$userCertificateRepository
private

Definition at line 30 of file class.ilCertificateLearningHistoryProvider.php.

Referenced by __construct().

◆ $utilHelper

readonly ilCertificateUtilHelper ilCertificateLearningHistoryProvider::$utilHelper
private

Definition at line 35 of file class.ilCertificateLearningHistoryProvider.php.

Referenced by __construct().


The documentation for this class was generated from the following file: