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

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 $DIC, ilAbstractLearningHistoryProvider\$template, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\ui().

31  {
32  global $DIC;
33 
34  parent::__construct($user_id, $factory, $lng, $template);
35 
36  $this->current_user = $current_user ?? $DIC->user();
37  $this->ui = $ui ?? $DIC->ui();
38  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ 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.

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().

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  }
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...
loadLanguageModule(string $a_module)
Load language module.
$url
Definition: shib_logout.php:66
$c
Definition: deliver.php:25
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getBadgesForUser(int $a_user_id, int $a_ts_from, int $a_ts_to)
+ Here is the call graph for this function:

◆ getName()

ilBadgeLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

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

References ilAbstractLearningHistoryProvider\getLanguage().

82  : string
83  {
84  return $this->getLanguage()->txt('obj_bdga');
85  }
+ Here is the call graph for this function:

◆ isActive()

ilBadgeLearningHistoryProvider::isActive ( )

Implements ilLearningHistoryProviderInterface.

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

References ilBadgeHandler\getInstance().

40  : bool
41  {
43  return true;
44  }
45  return false;
46  }
+ Here is the call graph for this function:

Field Documentation

◆ $current_user

ilObjUser ilBadgeLearningHistoryProvider::$current_user
private

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

◆ $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: