ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 

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.

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

49  {
50  $lng->loadLanguageModule("cert");
51 
52  parent::__construct($user_id, $factory, $lng, $template);
53 
54  if (null === $dic) {
55  global $DIC;
56  $dic = $DIC;
57  }
58 
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  }
loadLanguageModule(string $a_module)
Load language module.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly ilUserCertificateRepository $userCertificateRepository
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
$dic
Definition: result.php:31
+ 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.

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

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...
+ Here is the call graph for this function:

◆ getName()

ilCertificateLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

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

References ILIAS\Repository\lng().

154  : string
155  {
156  return $this->lng->txt('certificates');
157  }
+ 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: