ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBadgeLearningHistoryProvider Class Reference

Learning history provider: Badges. More...

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

Public Member Functions

 __construct ( $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ilTemplate $template=null, ilObjUser $current_user=null, \ILIAS\DI\UIServices $ui=null)
 Constructor. More...
 
 isActive ()
 Is active?
Returns
bool
More...
 
 getEntries ($ts_start, $ts_end)
 Get entries.
Parameters
int$ts_start
int$ts_end
Returns
ilLearningHistoryEntry[]
More...
 
 getName ()
 Get name of provider (in user language)
Returns
string
More...
 
- Public Member Functions inherited from ilAbstractLearningHistoryProvider
 __construct ( $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ilTemplate $template=null)
 Constructor. More...
 
 isActive ()
 Is active? More...
 
 getEntries ($ts_start, $ts_end)
 Get entries. More...
 
 getName ()
 Get name of provider (in user language) More...
 

Protected Attributes

 $current_user
 
 $ui
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
 $user_id
 
 $factory
 
 $lng
 

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

Learning history provider: Badges.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ getEntries()

ilBadgeLearningHistoryProvider::getEntries (   $ts_start,
  $ts_end 
)

Get entries.

Parameters
int$ts_start
int$ts_end
Returns
ilLearningHistoryEntry[]

Implements ilLearningHistoryProviderInterface.

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

69 {
70 $lng = $this->getLanguage();
71 $lng->loadLanguageModule("badge");
72 $completions = ilBadgeAssignment::getBadgesForUser($this->getUserId(), $ts_start, $ts_end);
73
74 $entries = [];
75 foreach ($completions as $c) {
76 $title = $this->getEmphasizedTitle($c["title"]);
77 if ($this->current_user->getId() == $this->getUserId()) {
78 $title = $this->ui->renderer()->render($this->ui->factory()->link()->standard(
79 $title,
80 $url = ilLink::_getLink($this->getUserId(), "usr", array(), "_bdg")
81 ));
82 }
83 $text1 = str_replace("$3$", $title, $lng->txt("badge_lhist_badge_completed"));
84 $text2 = str_replace("$3$", $title, $lng->txt("badge_lhist_badge_completed_in"));
85 $entries[] = $this->getFactory()->entry(
86 $text1,
87 $text2,
88 ilUtil::getImagePath("icon_bdga.svg"),
89 $c["tstamp"],
90 $c["parent_id"]
91 );
92 }
93 return $entries;
94 }
static getBadgesForUser($a_user_id, $a_ts_from, $a_ts_to)
Get badges for user.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$url

References $c, ilAbstractLearningHistoryProvider\$lng, $title, $url, ilLink\_getLink(), ilBadgeAssignment\getBadgesForUser(), ilAbstractLearningHistoryProvider\getEmphasizedTitle(), ilAbstractLearningHistoryProvider\getFactory(), ilUtil\getImagePath(), ilAbstractLearningHistoryProvider\getLanguage(), and ilAbstractLearningHistoryProvider\getUserId().

+ Here is the call graph for this function:

◆ getName()

ilBadgeLearningHistoryProvider::getName ( )

Get name of provider (in user language)

Returns
string

Implements ilLearningHistoryProviderInterface.

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

99 : string
100 {
101 $lng = $this->getLanguage();
102
103 return $lng->txt("obj_bdga");
104 }

References ilAbstractLearningHistoryProvider\$lng, and ilAbstractLearningHistoryProvider\getLanguage().

+ Here is the call graph for this function:

◆ isActive()

ilBadgeLearningHistoryProvider::isActive ( )

Is active?

Returns
bool

Implements ilLearningHistoryProviderInterface.

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

57 {
58 require_once 'Services/Badge/classes/class.ilBadgeHandler.php';
60 return true;
61 }
62 return false;
63 }
static getInstance()
Constructor.

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

ilBadgeLearningHistoryProvider::$current_user
protected

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

Referenced by __construct().

◆ $ui

ilBadgeLearningHistoryProvider::$ui
protected

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

Referenced by __construct().


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