ILIAS  release_8 Revision v8.24
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

ilUserCertificateRepository $userCertificateRepository
 
ilCtrlInterface $ctrl
 
ilSetting $certificateSettings
 
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 }
Just a wrapper class to create Unit Test for other classes.
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$dic
Definition: result.php:32

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.

Parameters
int$ts_start
int$ts_end
Returns
ilLearningHistoryEntry[]

Implements ilLearningHistoryProviderInterface.

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

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

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

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

ilSetting ilCertificateLearningHistoryProvider::$certificateSettings
private

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

Referenced by __construct().

◆ $ctrl

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

ilUserCertificateRepository ilCertificateLearningHistoryProvider::$userCertificateRepository
private

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

Referenced by __construct().

◆ $utilHelper

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: