ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBadgeLearningHistoryProvider Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilBadgeLearningHistoryProvider:
+ Collaboration diagram for ilBadgeLearningHistoryProvider:

Public Member Functions

 __construct (int $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ?ilTemplate $template=null, ?ilObjUser $current_user=null, ?\ILIAS\DI\UIServices $ui=null)
 
 isActive ()
 
 getEntries (int $ts_start, int $ts_end)
 
 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 ()
 

Private Attributes

ilObjUser $current_user
 
ILIAS DI UIServices $ui
 

Additional Inherited Members

- Protected Member Functions inherited from ilAbstractLearningHistoryProvider
 getUserId ()
 
 getFactory ()
 
 getLanguage ()
 
 getEmphasizedTitle (string $title)
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
int $user_id
 
ilLearningHistoryFactory $factory
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilBadgeLearningHistoryProvider.php.

Constructor & Destructor Documentation

◆ __construct()

ilBadgeLearningHistoryProvider::__construct ( int  $user_id,
ilLearningHistoryFactory  $factory,
ilLanguage  $lng,
?ilTemplate  $template = null,
?ilObjUser  $current_user = null,
?\ILIAS\DI\UIServices  $ui = null 
)

Definition at line 24 of file class.ilBadgeLearningHistoryProvider.php.

References $current_user, $DIC, ilAbstractLearningHistoryProvider\$factory, ilAbstractLearningHistoryProvider\$lng, ilAbstractLearningHistoryProvider\$template, ilAbstractLearningHistoryProvider\$user_id, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ getEntries()

ilBadgeLearningHistoryProvider::getEntries ( int  $ts_start,
int  $ts_end 
)
Returns
list<ilLearningHistoryEntry>

Implements ilLearningHistoryProviderInterface.

Definition at line 51 of file class.ilBadgeLearningHistoryProvider.php.

51 : array
52 {
53 $lng = $this->getLanguage();
54 $lng->loadLanguageModule('badge');
55 $completions = ilBadgeAssignment::getBadgesForUser($this->getUserId(), $ts_start, $ts_end);
56
57 $entries = [];
58 foreach ($completions as $c) {
59 $title = $this->getEmphasizedTitle($c['title']);
60 if ($this->current_user->getId() === $this->getUserId()) {
61 $title = $this->ui->renderer()->render(
62 $this->ui->factory()->link()->standard(
63 $title,
64 $url = ilLink::_getLink($this->getUserId(), 'usr', [], '_bdg')
65 )
66 );
67 }
68 $text1 = str_replace('$3$', $title, $lng->txt('badge_lhist_badge_completed'));
69 $text2 = str_replace('$3$', $title, $lng->txt('badge_lhist_badge_completed_in'));
70 $entries[] = $this->getFactory()->entry(
71 $text1,
72 $text2,
73 ilUtil::getImagePath('standard/icon_bdga.svg'),
74 $c['tstamp'],
75 $c['parent_id']
76 );
77 }
78
79 return $entries;
80 }
static getBadgesForUser(int $a_user_id, int $a_ts_from, int $a_ts_to)
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$c
Definition: deliver.php:25
$url
Definition: shib_logout.php:68

References $c, ilAbstractLearningHistoryProvider\$lng, $url, ilBadgeAssignment\getBadgesForUser(), ilAbstractLearningHistoryProvider\getEmphasizedTitle(), ilAbstractLearningHistoryProvider\getFactory(), ilUtil\getImagePath(), ilAbstractLearningHistoryProvider\getLanguage(), ilAbstractLearningHistoryProvider\getUserId(), ilLanguage\loadLanguageModule(), ilLanguage\txt(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getName()

ilBadgeLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

Definition at line 82 of file class.ilBadgeLearningHistoryProvider.php.

82 : string
83 {
84 return $this->getLanguage()->txt('obj_bdga');
85 }

References ilAbstractLearningHistoryProvider\getLanguage().

+ Here is the call graph for this function:

◆ isActive()

ilBadgeLearningHistoryProvider::isActive ( )

Implements ilLearningHistoryProviderInterface.

Definition at line 40 of file class.ilBadgeLearningHistoryProvider.php.

40 : bool
41 {
43 return true;
44 }
45 return false;
46 }

References ilBadgeHandler\getInstance(), and isActive().

Referenced by isActive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $current_user

ilObjUser ilBadgeLearningHistoryProvider::$current_user
private

Definition at line 21 of file class.ilBadgeLearningHistoryProvider.php.

Referenced by __construct().

◆ $ui

ILIAS DI UIServices ilBadgeLearningHistoryProvider::$ui
private

Definition at line 22 of file class.ilBadgeLearningHistoryProvider.php.


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