ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLearningHistoryTimelineItem Class Reference
+ Inheritance diagram for ilLearningHistoryTimelineItem:
+ Collaboration diagram for ilLearningHistoryTimelineItem:

Public Member Functions

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

Protected Member Functions

 getEmphasizedTitle ($title)
 Get emphasized title. More...
 

Protected Attributes

 $lh_entry
 
 $ui
 
 $user_id
 
 $access
 
 $tree
 

Detailed Description

Author
.de

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

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ getDatetime()

ilLearningHistoryTimelineItem::getDatetime ( )

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

References IL_CAL_UNIX.

61  {
62  return new ilDateTime($this->lh_entry->getTimestamp(), IL_CAL_UNIX);
63  }
const IL_CAL_UNIX
Date and time handling

◆ getEmphasizedTitle()

ilLearningHistoryTimelineItem::getEmphasizedTitle (   $title)
protected

Get emphasized title.

Parameters
string
Returns
string

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

References $title, and $tpl.

Referenced by render().

128  {
129  $tpl = new ilTemplate("tpl.emphasized_title.php", true, true, "Services/LearningHistory");
130  $tpl->setVariable("TITLE", $title);
131  ;
132  return $tpl->get();
133  }
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ render()

ilLearningHistoryTimelineItem::render ( )

Render item.

Returns
string html

Implements ilTimelineItemInt.

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

References $access, $f, $r, $text, $title, $tpl, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), and getEmphasizedTitle().

69  {
71 
72  $tpl = new ilTemplate("tpl.timeline_item_inner.html", true, true, "Services/LearningHistory");
73 
74  $f = $this->ui->factory();
75  $r = $this->ui->renderer();
76 
77  $ico = $f->icon()->custom($this->lh_entry->getIconPath(), '')->withSize(\ILIAS\UI\Component\Icon\Custom::MEDIUM);
78 
79  $obj_id = $this->lh_entry->getObjId();
80  $title = ilObject::_lookupTitle($obj_id);
81  if ($this->lh_entry->getRefId() == 0) {
82  $ref_ids = ilObject::_getAllReferences($obj_id);
83  } else {
84  $ref_ids = [$this->lh_entry->getRefId()];
85  }
86  $readable_ref_id = 0;
87  foreach ($ref_ids as $ref_id) {
88  if ($readable_ref_id == 0 && $access->checkAccessOfUser($this->user_id, "read", "", $ref_id)) {
89  $readable_ref_id = $ref_id;
90  }
91  }
92 
93  if ($readable_ref_id > 0) {
94  if (ilObject::_lookupType(ilObject::_lookupObjId($readable_ref_id)) == "crs") {
95  $parent_ref_id = $readable_ref_id;
96  } else {
97  $parent_ref_id = $this->tree->checkForParentType($readable_ref_id, "crs", true);
98  }
99  }
100 
101  if ($parent_ref_id > 0) {
102  $text = $this->lh_entry->getAchieveInText();
103  $obj_placeholder = "<a href='" . ilLink::_getLink($parent_ref_id) . "'>" .
104  $this->getEmphasizedTitle(ilObject::_lookupTitle(ilObject::_lookupObjId($parent_ref_id))) . "</a>";
105  $text = str_replace("$2$", $obj_placeholder, $text);
106  } else {
107  $text = $this->lh_entry->getAchieveText();
108  }
109 
110  $obj_placeholder = ($readable_ref_id > 0)
111  ? "<a href='" . ilLink::_getLink($readable_ref_id) . "'>" . $this->getEmphasizedTitle($title) . "</a>"
112  : $this->getEmphasizedTitle($title);
113  $text = str_replace("$1$", $obj_placeholder, $text);
114 
115  $tpl->setVariable("TEXT", $text);
116  $tpl->setVariable("ICON", $r->render($ico));
117 
118  return $tpl->get();
119  }
Class Factory.
$tpl
Definition: ilias.php:10
Class BaseForm.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
$r
Definition: example_031.php:79
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
$text
Definition: errorreport.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ renderFooter()

ilLearningHistoryTimelineItem::renderFooter ( )

Render footer.

Exceptions
ilCtrlException

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

140  {
141  }

Field Documentation

◆ $access

ilLearningHistoryTimelineItem::$access
protected

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

Referenced by __construct(), and render().

◆ $lh_entry

ilLearningHistoryTimelineItem::$lh_entry
protected

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

Referenced by __construct().

◆ $tree

ilLearningHistoryTimelineItem::$tree
protected

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

Referenced by __construct().

◆ $ui

ilLearningHistoryTimelineItem::$ui
protected

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

Referenced by __construct().

◆ $user_id

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: