Render item.
114 : string
115 {
117 $tpl =
new ilTemplate(
"tpl.timeline_item.html",
true,
true,
"components/ILIAS/News");
118 $ui_factory = $this->gui->ui()->factory();
119 $ui_renderer = $this->gui->ui()->renderer();
120
122 $news_renderer->setLanguage($this->
lng->getLangKey());
123 $news_renderer->setNewsItem($i, $this->news_item_ref_id);
124
125 $obj_id = $i->getContextObjId();
126
127
128 if ($i->getCreationDate() !== $i->getUpdateDate()) {
129 $tpl->setCurrentBlock("edited");
131 $tpl->setVariable(
"TXT_EDITED", $this->
lng->txt(
"cont_news_edited"));
132 if ($i->getUpdateUserId() > 0 && ($i->getUpdateUserId() !== $i->getUserId())) {
134 $i->getUpdateUserId(),
135 false,
136 true,
137 $this->ctrl->getLinkTargetByClass("ilnewstimelinegui")
138 ) . " - ");
139 }
141 $tpl->parseCurrentBlock();
142 }
143
144
145 if ($this->news_item_ref_id > 0 && $this->ref_id !== $this->news_item_ref_id) {
146 $tpl->setCurrentBlock("object");
149 $tpl->setVariable("OBJ_HREF", $news_renderer->getObjectLink());
150 $tpl->parseCurrentBlock();
151 }
152
153
156 $tpl->setCurrentBlock("player");
157 $tpl->setVariable("PLAYER", $media);
158 $tpl->parseCurrentBlock();
159 }
160
161 $p = $this->gui->profile();
162 $tpl->setVariable("USER_AVATAR", $this->gui->ui()->renderer()->render(
163 $p->getAvatar($i->getUserId())
164 ));
165 $tpl->setVariable(
166 "TITLE",
168 );
169
170
171 $tpl->setVariable("CONTENT", $news_renderer->getTimelineContent());
172
173 $tpl->setVariable("TXT_USR", $p->getNamePresentation(
174 $i->getUserId(),
175 true,
176 $this->ctrl->getLinkTargetByClass("ilnewstimelinegui")
177 ));
178
180
181
182 $actions = [];
183
184 if ($i->getPriority() === 1 && ($i->getUserId() === $this->user->getId() || $this->getUserEditAll())) {
185 if (!$news_renderer->preventEditing()) {
186 $actions[] = $ui_factory->button()->shy(
187 $this->
lng->txt(
"edit"),
188 ""
189 )->withOnLoadCode(
static function (
$id) use ($i) {
190 return "document.getElementById('$id').addEventListener('click', () => {il.News.edit(" . $i->getId() . ");});";
191 });
192 $actions[] = $ui_factory->button()->shy(
193 $this->
lng->txt(
"delete"),
194 ""
195 )->withOnLoadCode(
static function (
$id) use ($i) {
196 return "document.getElementById('$id').addEventListener('click', () => {il.News.delete(" . $i->getId() . ");});";
197 });
198 }
199 }
200 foreach ($news_renderer->getTimelineActions() as $action) {
201 $actions[] = $action;
202 }
203 $dd = $ui_factory->dropdown()->standard($actions);
204 $tpl->setVariable("ACTIONS", $ui_renderer->render($dd));
205
206 return $tpl->get();
207 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static determineNewsTitle(string $a_context_obj_type, string $a_title, bool $a_content_is_lang_var, int $a_agg_ref_id=0, array $a_aggregation=[], ?ilLanguage $lng=null)
Determine title for news item entry.
static getRenderer(string $a_context_obj_type)
renderMedia(ilNewsItem $i)
getDateTime()
Get datetime.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupTitle(int $obj_id)
special template class to simplify handling of ITX/PEAR
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is: