ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLearningHistoryTimelineItem 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 ilLearningHistoryTimelineItem:
+ Collaboration diagram for ilLearningHistoryTimelineItem:

Public Member Functions

 __construct (ilLearningHistoryEntry $lh_entry, \ILIAS\DI\UIServices $ui, int $user_id, ilAccessHandler $access, ilTree $tree)
 
 getDatetime ()
 
 render ()
 Render item. More...
 
 renderFooter ()
 
- Public Member Functions inherited from ilTimelineItemInt
 getDateTime ()
 Get datetime. More...
 

Protected Member Functions

 getEmphasizedTitle (string $title)
 

Protected Attributes

ilLearningHistoryEntry $lh_entry
 
ILIAS DI UIServices $ui
 
int $user_id
 
ilAccessHandler $access
 
ilTree $tree
 

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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLearningHistoryTimelineItem::__construct ( ilLearningHistoryEntry  $lh_entry,
\ILIAS\DI\UIServices  $ui,
int  $user_id,
ilAccessHandler  $access,
ilTree  $tree 
)

Member Function Documentation

◆ getDatetime()

ilLearningHistoryTimelineItem::getDatetime ( )

Definition at line 44 of file class.ilLearningHistoryTimelineItem.php.

References IL_CAL_UNIX.

44  : ilDateTime
45  {
46  return new ilDateTime($this->lh_entry->getTimestamp(), IL_CAL_UNIX);
47  }
const IL_CAL_UNIX

◆ getEmphasizedTitle()

ilLearningHistoryTimelineItem::getEmphasizedTitle ( string  $title)
protected

Definition at line 103 of file class.ilLearningHistoryTimelineItem.php.

References $tpl.

Referenced by render().

103  : string
104  {
105  $tpl = new ilTemplate("tpl.emphasized_title.php", true, true, "Services/LearningHistory");
106  $tpl->setVariable("TITLE", $title);
107  return $tpl->get();
108  }
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the caller graph for this function:

◆ render()

ilLearningHistoryTimelineItem::render ( )

Render item.

Returns
string html

Implements ilTimelineItemInt.

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

References $access, Vendor\Package\$f, $ref_id, $tpl, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilRBACAccessHandler\checkAccessOfUser(), getEmphasizedTitle(), and ILIAS\Repository\ui().

49  : string
50  {
52  $parent_ref_id = 0;
53 
54  $tpl = new ilTemplate("tpl.timeline_item_inner.html", true, true, "Services/LearningHistory");
55 
56  $f = $this->ui->factory();
57  $r = $this->ui->renderer();
58 
59  $ico = $f->symbol()->icon()->custom($this->lh_entry->getIconPath(), '')->withSize(\ILIAS\UI\Component\Symbol\Icon\Icon::MEDIUM);
60 
61  $obj_id = $this->lh_entry->getObjId();
62  $title = ilObject::_lookupTitle($obj_id);
63  if ($this->lh_entry->getRefId() === 0) {
64  $ref_ids = ilObject::_getAllReferences($obj_id);
65  } else {
66  $ref_ids = [$this->lh_entry->getRefId()];
67  }
68  $readable_ref_id = 0;
69  foreach ($ref_ids as $ref_id) {
70  if ($readable_ref_id === 0 && $access->checkAccessOfUser($this->user_id, "read", "", $ref_id)) {
71  $readable_ref_id = $ref_id;
72  }
73  }
74 
75  if ($readable_ref_id > 0) {
76  if (ilObject::_lookupType(ilObject::_lookupObjId($readable_ref_id)) === "crs") {
77  $parent_ref_id = $readable_ref_id;
78  } else {
79  $parent_ref_id = $this->tree->checkForParentType($readable_ref_id, "crs", true);
80  }
81  }
82 
83  if ($parent_ref_id > 0) {
84  $text = $this->lh_entry->getAchieveInText();
85  $obj_placeholder = "<a href='" . ilLink::_getLink($parent_ref_id) . "'>" .
86  $this->getEmphasizedTitle(ilObject::_lookupTitle(ilObject::_lookupObjId($parent_ref_id))) . "</a>";
87  $text = str_replace("$2$", $obj_placeholder, $text);
88  } else {
89  $text = $this->lh_entry->getAchieveText();
90  }
91 
92  $obj_placeholder = ($readable_ref_id > 0)
93  ? "<a href='" . ilLink::_getLink($readable_ref_id) . "'>" . $this->getEmphasizedTitle($title) . "</a>"
94  : $this->getEmphasizedTitle($title);
95  $text = str_replace("$1$", $obj_placeholder, $text);
96 
97  $tpl->setVariable("TEXT", $text);
98  $tpl->setVariable("ICON", $r->render($ico));
99 
100  return $tpl->get();
101  }
Class Factory.
Class ChatMainBarProvider .
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
static _lookupTitle(int $obj_id)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
static _lookupType(int $id, bool $reference=false)
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
+ Here is the call graph for this function:

◆ renderFooter()

ilLearningHistoryTimelineItem::renderFooter ( )

Definition at line 110 of file class.ilLearningHistoryTimelineItem.php.

110  : string
111  {
112  return "";
113  }

Field Documentation

◆ $access

ilAccessHandler ilLearningHistoryTimelineItem::$access
protected

Definition at line 27 of file class.ilLearningHistoryTimelineItem.php.

Referenced by __construct(), and render().

◆ $lh_entry

ilLearningHistoryEntry ilLearningHistoryTimelineItem::$lh_entry
protected

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

Referenced by __construct().

◆ $tree

ilTree ilLearningHistoryTimelineItem::$tree
protected

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

Referenced by __construct().

◆ $ui

ILIAS DI UIServices ilLearningHistoryTimelineItem::$ui
protected

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

Referenced by __construct().

◆ $user_id

int ilLearningHistoryTimelineItem::$user_id
protected

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

Referenced by __construct().


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