73 $this->like_gui = $a_like_gui;
75 $this->lng = $DIC->language();
76 $this->ctrl = $DIC->ctrl();
78 $this->
user = $DIC->user();
79 $this->obj_def = $DIC[
"objDefinition"];
80 $this->news_item_ref_id = $a_news_ref_id;
82 $this->ref_id = (int)
$_GET[
"ref_id"];
93 return new self($a_news_item, $a_news_ref_id, $a_like_gui);
104 $this->news_item = $a_val;
124 $this->user_edit_all = $a_val;
153 $tpl =
new ilTemplate(
"tpl.timeline_item.html",
true,
true,
"Services/News");
155 include_once(
"./Services/News/classes/class.ilNewsRendererFactory.php");
157 $news_renderer->setLanguage($this->lng->getLangKey());
158 $news_renderer->setNewsItem(
$i, $this->news_item_ref_id);
160 $obj_id =
$i->getContextObjId();
163 if (
$i->getCreationDate() !=
$i->getUpdateDate()) {
164 $tpl->setCurrentBlock(
"edited");
166 $tpl->setVariable(
"TXT_EDITED", $this->lng->txt(
"cont_news_edited"));
167 if (
$i->getUpdateUserId() > 0 && (
$i->getUpdateUserId() !=
$i->getUserId())) {
168 include_once(
"./Services/User/classes/class.ilUserUtil.php");
170 $i->getUpdateUserId(),
173 $this->ctrl->getLinkTargetByClass(
"ilnewstimelinegui")
176 include_once(
"./Services/Calendar/classes/class.ilDatePresentation.php");
178 $tpl->parseCurrentBlock();
183 include_once(
"./Services/Link/classes/class.ilLink.php");
184 if ($this->news_item_ref_id > 0 && $this->ref_id != $this->news_item_ref_id) {
185 $tpl->setCurrentBlock(
"object");
187 $tpl->setVariable(
"OBJ_IMG", ilObject::_getIcon($obj_id));
188 $tpl->setVariable(
"OBJ_HREF", $news_renderer->getObjectLink());
189 $tpl->parseCurrentBlock();
195 $tpl->setCurrentBlock(
"player");
196 $tpl->setVariable(
"PLAYER", $media);
197 $tpl->parseCurrentBlock();
200 $tpl->setVariable(
"USER_IMAGE", ilObjUser::_getPersonalPicturePath(
$i->getUserId(),
"xsmall"));
207 $tpl->setVariable(
"CONTENT", $news_renderer->getTimelineContent());
209 include_once(
"./Services/User/classes/class.ilUserUtil.php");
214 $this->ctrl->getLinkTargetByClass(
"ilnewstimelinegui")
217 include_once(
"./Services/Calendar/classes/class.ilDatePresentation.php");
221 include_once(
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
223 $list->setListTitle(
"");
224 $list->setId(
"news_tl_act_" .
$i->getId());
229 $list->setUseImages(
false);
233 $this->lng->txt(
"edit"),
241 "il.News.edit(" .
$i->getId() .
");" 244 $this->lng->txt(
"delete"),
252 "il.News.delete(" .
$i->getId() .
");" 256 $news_renderer->addTimelineActions(
$list);
258 $tpl->setVariable(
"ACTIONS",
$list->getHTML());
276 $ui_factory = $DIC->ui()->factory();
277 $ui_renderer = $DIC->ui()->renderer();
279 if (in_array($mime, array(
"image/jpeg",
"image/svg+xml",
"image/gif",
"image/png"))) {
280 $item_id =
"il-news-modal-img-" . $i->
getId();
281 $title = basename($media_path);
282 $image = $ui_renderer->render($ui_factory->image()->responsive($media_path,
$title));
284 $img_tpl =
new ilTemplate(
"tpl.news_timeline_image_file.html",
true,
true,
"Services/News");
285 $img_tpl->setVariable(
"ITEM_ID", $item_id);
286 $img_tpl->setVariable(
"IMAGE", $image);
288 $html = $img_tpl->get();
289 } elseif (in_array($mime, array(
"audio/mpeg",
"audio/ogg",
"video/mp4",
"video/x-flv",
"video/webm"))) {
291 $mp->setFile($media_path);
292 $mp->setDisplayHeight(200);
293 $html = $mp->getMediaPlayerHtml();
314 $ui_factory = $DIC->ui()->factory();
315 $ui_renderer = $DIC->ui()->renderer();
319 if (in_array($mime, array(
"image/jpeg",
"image/svg+xml",
"image/gif",
"image/png"))) {
320 $title = basename($media_path);
321 $item_id =
"il-news-modal-img-" . $i->
getId();
322 $image = $ui_renderer->render($ui_factory->image()->responsive($media_path,
$title));
324 $modal->setId($item_id);
326 $modal->setBody($image);
327 $modal->setHeading(
$title);
328 $modal_html = $modal->getHTML();
343 $this->ctrl->setParameterByClass(
"ilnewstimelinegui",
"news_id",
$i->getId());
344 $this->like_gui->setObject(
345 $i->getContextObjId(),
346 $i->getContextObjType(),
347 $i->getContextSubObjId(),
348 $i->getContextSubObjType(),
351 $html = $this->ctrl->getHTML($this->like_gui);
354 $notes_obj_type = (
$i->getContextSubObjType() ==
"")
355 ?
$i->getContextObjType()
356 :
$i->getContextSubObjType();
358 $i->getContextObjId(),
359 $i->getContextSubObjId(),
367 $html .= $this->ctrl->getHTML($note_gui);
369 $this->ctrl->setParameterByClass(
"ilnewstimelinegui",
"news_id",
$_GET[
"news_id"]);
382 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
383 include_once(
"./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php");
386 if (strcasecmp(
"Reference", $med->getLocationType()) == 0) {
387 $media_path = $med->getLocation();
Single news timeline item.
renderMediaModal(ilNewsItem $i)
Render media.
if(isset($_REQUEST['delete'])) $list
getUserEditAll()
Get user can edit other users postings.
getDateTime()
Get datetime.ilDateTime timestamp
getNewsItem()
Get news item.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
render()
Render item.string html
static _lookupTitle($a_id)
lookup object title
renderMedia(ilNewsItem $i)
Render media.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
__construct(ilNewsItem $a_news_item, $a_news_ref_id, \ilLikeGUI $a_like_gui)
Constructor.
static getInstance(ilNewsItem $a_news_item, $a_news_ref_id, \ilLikeGUI $a_like_gui)
Get instance.
special template class to simplify handling of ITX/PEAR
getMediaPath(ilNewsItem $i)
renderFooter()
Render footer.
Interface for timeline items.
setUserEditAll($a_val)
Set user can edit other users postings.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
User interface class for advanced drop-down selection lists.
static getInstance()
Get instance.
static getRenderer($a_context_obj_type)
Get renderer.
static determineNewsTitle( $a_context_obj_type, $a_title, $a_content_is_lang_var, $a_agg_ref_id=0, $a_aggregation="")
Determine title for news item entry.
User interface for like feature.
setNewsItem(ilNewsItem $a_val)
Set news item.
setDefaultCommand($a_val)
Set default command.