ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilLearningHistoryTimelineItem.php
Go to the documentation of this file.
1
<?
php
2
3
/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11
class
ilLearningHistoryTimelineItem
implements
ilTimelineItemInt
12
{
16
protected
$lh_entry
;
17
21
protected
$ui
;
22
26
protected
$user_id
;
27
31
protected
$access
;
32
36
protected
$tree
;
37
43
public
function
__construct
(
44
ilLearningHistoryEntry
$lh_entry
,
45
\
ILIAS
\
DI
\UIServices
$ui
,
46
$user_id
,
47
ilAccessHandler
$access
,
48
ilTree
$tree
49
) {
50
$this->access =
$access
;
51
$this->lh_entry =
$lh_entry
;
52
$this->ui =
$ui
;
53
$this->user_id =
$user_id
;
54
$this->tree =
$tree
;
55
}
56
60
public
function
getDatetime
()
61
{
62
return
new
ilDateTime
($this->lh_entry->getTimestamp(),
IL_CAL_UNIX
);
63
}
64
68
public
function
render
()
69
{
70
$access
=
$this->access
;
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
}
120
127
protected
function
getEmphasizedTitle
(
$title
)
128
{
129
$tpl
=
new
ilTemplate
(
"tpl.emphasized_title.php"
,
true
,
true
,
"Services/LearningHistory"
);
130
$tpl
->setVariable(
"TITLE"
,
$title
);
131
;
132
return
$tpl
->get();
133
}
134
139
public
function
renderFooter
()
140
{
141
}
142
}
ilLearningHistoryTimelineItem\__construct
__construct(ilLearningHistoryEntry $lh_entry, \ILIAS\DI\UIServices $ui, $user_id, ilAccessHandler $access, ilTree $tree)
Constructor ilLearningHistoryTimelineItem constructor.
Definition:
class.ilLearningHistoryTimelineItem.php:43
ilLearningHistoryTimelineItem\getDatetime
getDatetime()
Definition:
class.ilLearningHistoryTimelineItem.php:60
UI
Class Factory.
ilLearningHistoryTimelineItem\$user_id
$user_id
Definition:
class.ilLearningHistoryTimelineItem.php:26
$tpl
$tpl
Definition:
ilias.php:10
ILIAS
Class BaseForm.
ILIAS\UI\Component
ilLearningHistoryTimelineItem\renderFooter
renderFooter()
Render footer.
Definition:
class.ilLearningHistoryTimelineItem.php:139
ilObject\_lookupTitle
static _lookupTitle($a_id)
lookup object title
Definition:
class.ilObject.php:988
IL_CAL_UNIX
const IL_CAL_UNIX
Definition:
class.ilDateTime.php:11
ilObject\_getAllReferences
static _getAllReferences($a_id)
get all reference ids of object
Definition:
class.ilObject.php:965
ilLearningHistoryTimelineItem\getEmphasizedTitle
getEmphasizedTitle($title)
Get emphasized title.
Definition:
class.ilLearningHistoryTimelineItem.php:127
ilAccessHandler
Interface ilAccessHandler.
Definition:
interface.ilAccessHandler.php:10
$r
$r
Definition:
example_031.php:79
$f
$f
Definition:
fetch_windows_zones.php:31
DI
Class HTTPServicesTest.
ilObject\_lookupObjId
static _lookupObjId($a_id)
Definition:
class.ilObject.php:1107
ilTemplate
special template class to simplify handling of ITX/PEAR
Definition:
class.ilTemplate.php:13
$text
$text
Definition:
errorreport.php:18
ilLearningHistoryTimelineItem\$tree
$tree
Definition:
class.ilLearningHistoryTimelineItem.php:36
ilLearningHistoryTimelineItem
Definition:
class.ilLearningHistoryTimelineItem.php:11
ilDateTime
Date and time handling
Definition:
class.ilDateTime.php:33
ilTimelineItemInt
Interface for timeline items.
Definition:
interface.ilTimelineItemInt.php:12
ilLearningHistoryTimelineItem\$lh_entry
$lh_entry
Definition:
class.ilLearningHistoryTimelineItem.php:16
ilLearningHistoryEntry
Learning history entry.
Definition:
class.ilLearningHistoryEntry.php:11
ilTree
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Definition:
class.ilTree.php:24
ilObject\_lookupType
static _lookupType($a_id, $a_reference=false)
lookup object type
Definition:
class.ilObject.php:1275
ilLearningHistoryTimelineItem\render
render()
Render item.string html
Definition:
class.ilLearningHistoryTimelineItem.php:68
ilLearningHistoryTimelineItem\$access
$access
Definition:
class.ilLearningHistoryTimelineItem.php:31
php
$title
$title
Definition:
memcachestat.tpl.php:28
ilLink\_getLink
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
Definition:
class.ilLink.php:17
ilLearningHistoryTimelineItem\$ui
$ui
Definition:
class.ilLearningHistoryTimelineItem.php:21
Services
LearningHistory
classes
class.ilLearningHistoryTimelineItem.php
Generated on Thu Jan 16 2025 19:02:23 for ILIAS by
1.8.13 (using
Doxyfile
)