ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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)
 

Protected Attributes

ilObjUser $current_user
 
ILIAS DI UIServices $ui
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
int $user_id
 
ilLearningHistoryFactory $factory
 
ilLanguage $lng
 

Additional Inherited Members

- Protected Member Functions inherited from ilAbstractLearningHistoryProvider
 getUserId ()
 
 getFactory ()
 
 getLanguage ()
 
 getEmphasizedTitle (string $title)
 

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 Learning history provider: Badges

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

Definition at line 23 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 28 of file class.ilBadgeLearningHistoryProvider.php.

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

35  {
36  global $DIC;
37 
38  parent::__construct($user_id, $factory, $lng, $template);
39 
40  if (is_null($current_user)) {
41  $current_user = $DIC->user();
42  }
43  $this->current_user = $current_user;
44 
45  if (is_null($ui)) {
46  $ui = $DIC->ui();
47  }
48  $this->ui = $ui;
49  }
global $DIC
Definition: feed.php:28
__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 
)

Implements ilLearningHistoryProviderInterface.

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

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

59  : array
60  {
61  $lng = $this->getLanguage();
62  $lng->loadLanguageModule("badge");
63  $completions = ilBadgeAssignment::getBadgesForUser($this->getUserId(), $ts_start, $ts_end);
64 
65  $entries = [];
66  foreach ($completions as $c) {
67  $title = $this->getEmphasizedTitle($c["title"]);
68  if ($this->current_user->getId() === $this->getUserId()) {
69  $title = $this->ui->renderer()->render($this->ui->factory()->link()->standard(
70  $title,
71  $url = ilLink::_getLink($this->getUserId(), "usr", array(), "_bdg")
72  ));
73  }
74  $text1 = str_replace("$3$", $title, $lng->txt("badge_lhist_badge_completed"));
75  $text2 = str_replace("$3$", $title, $lng->txt("badge_lhist_badge_completed_in"));
76  $entries[] = $this->getFactory()->entry(
77  $text1,
78  $text2,
79  ilUtil::getImagePath("icon_bdga.svg"),
80  $c["tstamp"],
81  $c["parent_id"]
82  );
83  }
84  return $entries;
85  }
$c
Definition: cli.php:38
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 $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
loadLanguageModule(string $a_module)
Load language module.
static getBadgesForUser(int $a_user_id, int $a_ts_from, int $a_ts_to)
$url
+ Here is the call graph for this function:

◆ getName()

ilBadgeLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

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

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

87  : string
88  {
89  $lng = $this->getLanguage();
90 
91  return $lng->txt("obj_bdga");
92  }
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...
+ Here is the call graph for this function:

◆ isActive()

ilBadgeLearningHistoryProvider::isActive ( )

Implements ilLearningHistoryProviderInterface.

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

References ilBadgeHandler\getInstance().

51  : bool
52  {
54  return true;
55  }
56  return false;
57  }
+ Here is the call graph for this function:

Field Documentation

◆ $current_user

ilObjUser ilBadgeLearningHistoryProvider::$current_user
protected

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

Referenced by __construct().

◆ $ui

ILIAS DI UIServices ilBadgeLearningHistoryProvider::$ui
protected

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

Referenced by __construct().


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