ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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, \ILIAS\DI\Container $dic=null, ilUserCertificateRepository $userCertificateRepository=null, ilCtrl $controller=null, ilSetting $certificateSettings=null, Factory $uiFactory=null, Renderer $uiRenderer=null, ilCertificateUtilHelper $utilHelper=null)
 
 isActive ()
 Is active? More...
 
 getEntries ($ts_start, $ts_end)
 Get entries. More...
 
 getName ()
 Get name of provider (in user language) More...
 
- Public Member Functions inherited from ilAbstractLearningHistoryProvider
 __construct ( $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ilTemplate $template=null)
 Constructor. More...
 

Protected Attributes

 $uiFactory
 
 $uiRenderer
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
 $user_id
 
 $factory
 
 $lng
 

Private Attributes

 $userCertificateRepository
 
 $controller
 
 $certificateSettings
 
 $utilHelper
 

Additional Inherited Members

- Protected Member Functions inherited from ilAbstractLearningHistoryProvider
 getUserId ()
 Get user id. More...
 
 getFactory ()
 Get factory. More...
 
 getLanguage ()
 Get language object. More...
 
 getEmphasizedTitle ($title)
 Get emphasized title. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateLearningHistoryProvider::__construct ( int  $user_id,
ilLearningHistoryFactory  $factory,
ilLanguage  $lng,
ilTemplate  $template = null,
\ILIAS\DI\Container  $dic = null,
ilUserCertificateRepository  $userCertificateRepository = null,
ilCtrl  $controller = null,
ilSetting  $certificateSettings = null,
Factory  $uiFactory = null,
Renderer  $uiRenderer = null,
ilCertificateUtilHelper  $utilHelper = null 
)
Parameters
int$user_id
ilLearningHistoryFactory$factory
ilLanguage$lng
ilTemplate | null$template
\ILIAS\DI\Container | null$dic
ilUserCertificateRepository | null$userCertificateRepository
ilCtrl$controller
ilSetting | null$certificateSettings
Factory | null$uiFactory
Renderer | null$uiRenderer
ilCertificateUtilHelper | null$utilHelper

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

References $certificateSettings, $controller, $DIC, ilAbstractLearningHistoryProvider\$template, $uiFactory, $uiRenderer, $userCertificateRepository, $utilHelper, and ilLanguage\loadLanguageModule().

61  {
62  $lng->loadLanguageModule("cert");
63 
64  parent::__construct($user_id, $factory, $lng, $template);
65 
66  if (null === $dic) {
67  global $DIC;
68  $dic = $DIC;
69  }
70 
71  if (null === $userCertificateRepository) {
72  $database = $dic->database();
73  $looger = $dic->logger()->cert();
74  $userCertificateRepository = new ilUserCertificateRepository($database, $looger);
75  }
76  $this->userCertificateRepository = $userCertificateRepository;
77 
78  if (null === $controller) {
79  $controller = $dic->ctrl();
80  }
81  $this->controller = $controller;
82 
83  if (null === $certificateSettings) {
84  $certificateSettings = new ilSetting("certificate");
85  }
86  $this->certificateSettings = $certificateSettings;
87 
88  if (null === $uiFactory) {
89  $uiFactory = $dic->ui()->factory();
90  }
91  $this->uiFactory = $uiFactory;
92 
93  if (null === $uiRenderer) {
94  $uiRenderer = $dic->ui()->renderer();
95  }
96  $this->uiRenderer = $uiRenderer;
97 
98  if (null === $utilHelper) {
99  $utilHelper = new ilCertificateUtilHelper();
100  }
101  $this->utilHelper = $utilHelper;
102  }
global $DIC
Definition: saml.php:7
Just a wrapper class to create Unit Test for other classes.
loadLanguageModule($a_module)
+ Here is the call graph for this function:

Member Function Documentation

◆ getEntries()

ilCertificateLearningHistoryProvider::getEntries (   $ts_start,
  $ts_end 
)

Get entries.

Parameters
int$ts_start
int$ts_end
Returns
ilLearningHistoryEntry[]

Implements ilLearningHistoryProviderInterface.

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

References $certificate, $certificates, $text, and ilAbstractLearningHistoryProvider\getEmphasizedTitle().

122  {
123  $entries = array();
124 
125  $certificates = $this->userCertificateRepository->fetchActiveCertificatesInIntervalForPresentation($this->user_id, $ts_start, $ts_end);
126 
127  foreach ($certificates as $certificate) {
128  $objectId = $certificate->getUserCertificate()->getObjId();
129 
130  $this->controller->setParameterByClass(
131  'ilUserCertificateGUI',
132  'certificate_id',
133  $certificate->getUserCertificate()->getId()
134  );
135  $href = $this->controller->getLinkTargetByClass(['ilPersonalDesktopGUI', 'ilAchievementsGUI', 'ilUserCertificateGUI'], 'download');
136  $this->controller->clearParametersByClass('ilUserCertificateGUI');
137 
138  $prefixTextWithLink = sprintf(
139  $this->lng->txt('certificate_achievement_sub_obj'),
140  $this->uiRenderer->render($this->uiFactory->link()->standard($this->getEmphasizedTitle($certificate->getObjectTitle()), $href))
141  );
142 
143  $text = sprintf(
144  $this->lng->txt('certificate_achievement'),
145  $prefixTextWithLink
146  );
147 
148  $entries[] = new ilLearningHistoryEntry(
149  $text,
150  $text,
151  $this->utilHelper->getImagePath("icon_cert.svg"),
152  $certificate->getUserCertificate()->getAcquiredTimestamp(),
153  $objectId
154  );
155  }
156 
157  return $entries;
158  }
$certificates
Definition: metarefresh.php:39
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
$text
Definition: errorreport.php:18
+ Here is the call graph for this function:

◆ getName()

ilCertificateLearningHistoryProvider::getName ( )

Get name of provider (in user language)

Returns
string

Implements ilLearningHistoryProviderInterface.

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

164  : string
165  {
166  return $this->lng->txt('certificates');
167  }

◆ isActive()

ilCertificateLearningHistoryProvider::isActive ( )

Is active?

Returns
bool

Implements ilLearningHistoryProviderInterface.

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

110  {
111  return (bool) $this->certificateSettings->get('active');
112  }

Field Documentation

◆ $certificateSettings

ilCertificateLearningHistoryProvider::$certificateSettings
private

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

Referenced by __construct().

◆ $controller

ilCertificateLearningHistoryProvider::$controller
private

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

Referenced by __construct().

◆ $uiFactory

ilCertificateLearningHistoryProvider::$uiFactory
protected

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

Referenced by __construct().

◆ $uiRenderer

ilCertificateLearningHistoryProvider::$uiRenderer
protected

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

Referenced by __construct().

◆ $userCertificateRepository

ilCertificateLearningHistoryProvider::$userCertificateRepository
private

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

Referenced by __construct().

◆ $utilHelper

ilCertificateLearningHistoryProvider::$utilHelper
private

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

Referenced by __construct().


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