45 $this->like_gui = $a_like_gui;
46 $this->
lng = $DIC->language();
47 $this->
ctrl = $DIC->ctrl();
49 $this->
user = $DIC->user();
50 $this->obj_def = $DIC[
"objDefinition"];
51 $this->news_item_ref_id = $a_news_ref_id;
57 $this->ref_id = $this->std_request->
getRefId();
65 return new self($a_news_item, $a_news_ref_id, $a_like_gui);
70 $this->news_item = $a_val;
83 $this->user_edit_all = $a_val;
103 $tpl =
new ilTemplate(
"tpl.timeline_item.html",
true,
true,
"Services/News");
106 $news_renderer->setLanguage($this->
lng->getLangKey());
107 $news_renderer->setNewsItem(
$i, $this->news_item_ref_id);
109 $obj_id =
$i->getContextObjId();
112 if (
$i->getCreationDate() !==
$i->getUpdateDate()) {
113 $tpl->setCurrentBlock(
"edited");
115 $tpl->setVariable(
"TXT_EDITED", $this->
lng->txt(
"cont_news_edited"));
116 if (
$i->getUpdateUserId() > 0 && (
$i->getUpdateUserId() !==
$i->getUserId())) {
118 $i->getUpdateUserId(),
121 $this->
ctrl->getLinkTargetByClass(
"ilnewstimelinegui")
125 $tpl->parseCurrentBlock();
129 if ($this->news_item_ref_id > 0 && $this->ref_id !== $this->news_item_ref_id) {
130 $tpl->setCurrentBlock(
"object");
133 $tpl->setVariable(
"OBJ_HREF", $news_renderer->getObjectLink());
134 $tpl->parseCurrentBlock();
140 $tpl->setCurrentBlock(
"player");
141 $tpl->setVariable(
"PLAYER", $media);
142 $tpl->parseCurrentBlock();
152 $tpl->setVariable(
"CONTENT", $news_renderer->getTimelineContent());
158 $this->
ctrl->getLinkTargetByClass(
"ilnewstimelinegui")
165 $list->setListTitle(
"");
166 $list->setId(
"news_tl_act_" .
$i->getId());
168 $list->setUseImages(
false);
171 if (!$news_renderer->preventEditing()) {
173 $this->
lng->txt(
"edit"),
181 "il.News.edit(" .
$i->getId() .
");" 184 $this->
lng->txt(
"delete"),
192 "il.News.delete(" .
$i->getId() .
");" 197 $news_renderer->addTimelineActions($list);
199 $tpl->setVariable(
"ACTIONS", $list->getHTML());
211 $ui_factory = $DIC->ui()->factory();
212 $ui_renderer = $DIC->ui()->renderer();
214 if (in_array($mime, [
"image/jpeg",
"image/svg+xml",
"image/gif",
"image/png"])) {
215 $item_id =
"il-news-modal-img-" . $i->
getId();
216 $title = basename($media_path);
217 $image = $ui_renderer->render($ui_factory->image()->responsive($media_path, $title));
219 $img_tpl =
new ilTemplate(
"tpl.news_timeline_image_file.html",
true,
true,
"Services/News");
220 $img_tpl->setVariable(
"ITEM_ID", $item_id);
221 $img_tpl->setVariable(
"IMAGE", $image);
223 $html = $img_tpl->get();
224 } elseif (in_array($mime, [
"video/mp4"])) {
225 $video = $ui_factory->player()->video($media_path);
226 $html = $ui_renderer->render($video);
227 } elseif (in_array($mime, [
"audio/mpeg"])) {
228 $audio = $ui_factory->player()->audio($media_path);
229 $html = $ui_renderer->render($audio);
244 $ui_factory = $DIC->ui()->factory();
245 $ui_renderer = $DIC->ui()->renderer();
249 if (in_array($mime, [
"image/jpeg",
"image/svg+xml",
"image/gif",
"image/png"])) {
250 $title = basename($media_path);
251 $item_id =
"il-news-modal-img-" . $i->
getId();
252 $image = $ui_renderer->render($ui_factory->image()->responsive($media_path, $title));
254 $modal->setId($item_id);
256 $modal->setBody($image);
257 $modal->setHeading($title);
258 $modal_html = $modal->getHTML();
268 $this->
ctrl->setParameterByClass(
"ilnewstimelinegui",
"news_id",
$i->getId());
269 $this->like_gui->setObject(
270 $i->getContextObjId(),
271 $i->getContextObjType(),
272 $i->getContextSubObjId(),
273 (string)
$i->getContextSubObjType(),
276 $html = $this->
ctrl->getHTML($this->like_gui);
279 $notes_obj_type = (
$i->getContextSubObjType() ==
"")
280 ?
$i->getContextObjType()
281 :
$i->getContextSubObjType();
283 $i->getContextObjId(),
284 $i->getContextSubObjId(),
290 $note_gui->setShowEmptyListMessage(
false);
291 $note_gui->setShowHeader(
false);
292 $html .= $this->
ctrl->getHTML($note_gui);
294 $this->
ctrl->setParameterByClass(
"ilnewstimelinegui",
"news_id", $this->std_request->getNewsId());
305 if (strcasecmp(
"Reference", $med->getLocationType()) === 0) {
306 $media_path = $med->getLocation();
Single news timeline item.
renderMediaModal(ilNewsItem $i)
getUserEditAll()
Get user can edit other users postings.
getDateTime()
Get datetime.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
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="ilpublicuserprofilegui")
Default behaviour is:
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=[])
Determine title for news item entry.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
setDefaultCommand(string $a_val)
__construct(ilNewsItem $a_news_item, int $a_news_ref_id, ilLikeGUI $a_like_gui)
renderMedia(ilNewsItem $i)
static getRenderer(string $a_context_obj_type)
parses the objects.xml it handles the xml-description of all ilias objects
setUserEditAll(bool $a_val)
Set user can edit other users postings.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupTitle(int $obj_id)
getMediaPath(ilNewsItem $i)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
static getInstance(ilNewsItem $a_news_item, int $a_news_ref_id, ilLikeGUI $a_like_gui)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
User interface for like feature.
setNewsItem(ilNewsItem $a_val)
StandardGUIRequest $std_request
ilObjectDefinition $obj_def