ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilNewsTimelineItemGUI Class Reference

Single news timeline item. More...

+ Inheritance diagram for ilNewsTimelineItemGUI:
+ Collaboration diagram for ilNewsTimelineItemGUI:

Public Member Functions

 setNewsItem (ilNewsItem $a_val)
 Set news item. More...
 
 getNewsItem ()
 Get news item. More...
 
 setUserEditAll ($a_val)
 Set user can edit other users postings. More...
 
 getUserEditAll ()
 Get user can edit other users postings. More...
 
 getDateTime ()
 Get datetime.
Returns
ilDateTime timestamp
More...
 
 render ()
 Render item.
Returns
string html
More...
 

Static Public Member Functions

static getInstance (ilNewsItem $a_news_item, $a_news_ref_id)
 Get instance. More...
 

Protected Member Functions

 __construct (ilNewsItem $a_news_item, $a_news_ref_id)
 Constructor. More...
 

Protected Attributes

 $lng
 
 $news_item
 
 $obj_def
 
 $user
 
 $user_edit_all
 
 $news_item_ref_id
 
 $ref_id
 
 $ctrl
 

Detailed Description

Single news timeline item.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilNewsTimelineItemGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNewsTimelineItemGUI::__construct ( ilNewsItem  $a_news_item,
  $a_news_ref_id 
)
protected

Constructor.

$param ilNewsItem $a_news_item

Definition at line 62 of file class.ilNewsTimelineItemGUI.php.

References $_GET, $DIC, setNewsItem(), and user().

63  {
64  global $DIC;
65 
66  $this->lng = $DIC->language();
67  $this->ctrl = $DIC->ctrl();
68  $this->setNewsItem($a_news_item);
69  $this->user = $DIC->user();
70  $this->obj_def = $DIC["objDefinition"];
71  $this->news_item_ref_id = $a_news_ref_id;
72 
73  $this->ref_id = (int) $_GET["ref_id"];
74  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
setNewsItem(ilNewsItem $a_val)
Set news item.
+ Here is the call graph for this function:

Member Function Documentation

◆ getDateTime()

ilNewsTimelineItemGUI::getDateTime ( )

Get datetime.

Returns
ilDateTime timestamp

Implements ilTimelineItemInt.

Definition at line 131 of file class.ilNewsTimelineItemGUI.php.

References $i, getNewsItem(), and IL_CAL_DATETIME.

Referenced by render().

132  {
133  $i = $this->getNewsItem();
134  return new ilDateTime($i->getCreationDate(), IL_CAL_DATETIME);
135  }
const IL_CAL_DATETIME
Date and time handling
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilNewsTimelineItemGUI::getInstance ( ilNewsItem  $a_news_item,
  $a_news_ref_id 
)
static

Get instance.

Parameters
ilNewsItem$a_news_itemnews item
Returns
ilNewsTimelineItemGUI

Definition at line 82 of file class.ilNewsTimelineItemGUI.php.

Referenced by ilNewsTimelineGUI\loadMore(), and ilNewsTimelineGUI\show().

83  {
84  return new self($a_news_item, $a_news_ref_id);
85  }
+ Here is the caller graph for this function:

◆ getNewsItem()

ilNewsTimelineItemGUI::getNewsItem ( )

Get news item.

Returns
ilNewsItem news item

Definition at line 103 of file class.ilNewsTimelineItemGUI.php.

References $news_item.

Referenced by getDateTime(), and render().

+ Here is the caller graph for this function:

◆ getUserEditAll()

ilNewsTimelineItemGUI::getUserEditAll ( )

Get user can edit other users postings.

Returns
bool user can edit all postings

Definition at line 123 of file class.ilNewsTimelineItemGUI.php.

References $user_edit_all.

Referenced by render().

+ Here is the caller graph for this function:

◆ render()

ilNewsTimelineItemGUI::render ( )

Render item.

Returns
string html

Implements ilTimelineItemInt.

Definition at line 141 of file class.ilNewsTimelineItemGUI.php.

References $i, $list, $tpl, ilObject\_exists(), ilObject\_getIcon(), ilObjMediaObject\_getURL(), ilObject\_lookupTitle(), ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, ilDatePresentation\formatDate(), getDateTime(), ilObjMediaObject\getMediaItem(), ilUserUtil\getNamePresentation(), getNewsItem(), ilNewsRendererFactory\getRenderer(), getUserEditAll(), IL_CAL_DATETIME, NEWS_AUDIO, ilMediaPlayerGUI\setFile(), and user().

142  {
143  $i = $this->getNewsItem();
144  $tpl = new ilTemplate("tpl.timeline_item.html", true, true, "Services/News");
145 
146  include_once("./Services/News/classes/class.ilNewsRendererFactory.php");
147  $news_renderer = ilNewsRendererFactory::getRenderer($i->getContextObjType());
148  $news_renderer->setLanguage($this->lng->getLangKey());
149  $news_renderer->setNewsItem($i, $this->news_item_ref_id);
150 
151  $obj_id = $i->getContextObjId();
152 
153  // edited?
154  if ($i->getCreationDate() != $i->getUpdateDate()) {
155  $tpl->setCurrentBlock("edited");
156  $update_date = new ilDateTime($i->getUpdateDate(), IL_CAL_DATETIME);
157  $tpl->setVariable("TXT_EDITED", $this->lng->txt("cont_news_edited"));
158  if ($i->getUpdateUserId() > 0 && ($i->getUpdateUserId() != $i->getUserId())) {
159  include_once("./Services/User/classes/class.ilUserUtil.php");
160  $tpl->setVariable("TXT_USR_EDITED", ilUserUtil::getNamePresentation(
161  $i->getUpdateUserId(),
162  false,
163  true,
164  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui")
165  ) . " - ");
166  }
167  include_once("./Services/Calendar/classes/class.ilDatePresentation.php");
168  $tpl->setVariable("TIME_EDITED", ilDatePresentation::formatDate($update_date));
169  $tpl->parseCurrentBlock();
170  }
171 
172 
173  // context object link
174  include_once("./Services/Link/classes/class.ilLink.php");
175  if ($this->news_item_ref_id > 0 && $this->ref_id != $this->news_item_ref_id) {
176  $tpl->setCurrentBlock("object");
177  $tpl->setVariable("OBJ_TITLE", ilObject::_lookupTitle($obj_id));
178  $tpl->setVariable("OBJ_IMG", ilObject::_getIcon($obj_id));
179  $tpl->setVariable("OBJ_HREF", $news_renderer->getObjectLink());
180  $tpl->parseCurrentBlock();
181  }
182 
183  // media
184  if ($i->getContentType() == NEWS_AUDIO &&
185  $i->getMobId() > 0 && ilObject::_exists($i->getMobId())) {
186  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
187  include_once("./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php");
188  $mob = new ilObjMediaObject($i->getMobId());
189  $med = $mob->getMediaItem("Standard");
190  $mpl = new ilMediaPlayerGUI("news_pl_" . $i->getMobId());
191  if (strcasecmp("Reference", $med->getLocationType()) == 0) {
192  $mpl->setFile($med->getLocation());
193  } else {
194  $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
195  }
196  $mpl->setDisplayHeight($med->getHeight());
197  //$mpl->setDisplayWidth("100%");
198  //$mpl->setDisplayHeight("320");
199  $tpl->setCurrentBlock("player");
200  $tpl->setVariable(
201  "PLAYER",
202  $mpl->getMp3PlayerHtml()
203  );
204  $tpl->parseCurrentBlock();
205  }
206 
207 
208  $tpl->setVariable("USER_IMAGE", ilObjUser::_getPersonalPicturePath($i->getUserId(), "xsmall"));
209  if (!$i->getContentIsLangVar()) {
210  $tpl->setVariable("TITLE", $i->getTitle());
211  } else {
212  $tpl->setVariable("TITLE", $this->lng->txt($i->getTitle()));
213  }
214 
215  // content
216  $tpl->setVariable("CONTENT", $news_renderer->getTimelineContent());
217 
218  include_once("./Services/User/classes/class.ilUserUtil.php");
219  $tpl->setVariable("TXT_USR", ilUserUtil::getNamePresentation(
220  $i->getUserId(),
221  false,
222  true,
223  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui")
224  ));
225 
226  include_once("./Services/Calendar/classes/class.ilDatePresentation.php");
227  $tpl->setVariable("TIME", ilDatePresentation::formatDate($this->getDateTime()));
228 
229  // actions
230  include_once("Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
232  $list->setListTitle("");
233  $list->setId("news_tl_act_" . $i->getId());
234  //$list->setSelectionHeaderClass("small");
235  //$list->setItemLinkClass("xsmall");
236  //$list->setLinksMode("il_ContainerItemCommand2");
238  $list->setUseImages(false);
239 
240  if ($i->getPriority() == 1 && ($i->getUserId() == $this->user->getId() || $this->getUserEditAll())) {
241  $list->addItem(
242  $this->lng->txt("edit"),
243  "",
244  "",
245  "",
246  "",
247  "",
248  "",
249  false,
250  "il.News.edit(" . $i->getId() . ");"
251  );
252  $list->addItem(
253  $this->lng->txt("delete"),
254  "",
255  "",
256  "",
257  "",
258  "",
259  "",
260  false,
261  "il.News.delete(" . $i->getId() . ");"
262  );
263  }
264 
265  $news_renderer->addTimelineActions($list);
266 
267  $tpl->setVariable("ACTIONS", $list->getHTML());
268 
269 
270  return $tpl->get();
271  }
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
getUserEditAll()
Get user can edit other users postings.
getDateTime()
Get datetime.ilDateTime timestamp
& getMediaItem($a_purpose)
get item for media purpose
const IL_CAL_DATETIME
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
setFile($a_file)
Set File.
$tpl
Definition: ilias.php:10
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
static _lookupTitle($a_id)
lookup object title
static _getURL($a_mob_id)
get directory for files of media object (static)
user()
Definition: user.php:4
special template class to simplify handling of ITX/PEAR
Date and time handling
Class ilObjMediaObject.
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.
User interface for media player.
static getRenderer($a_context_obj_type)
Get renderer.
$i
Definition: disco.tpl.php:19
const NEWS_AUDIO
+ Here is the call graph for this function:

◆ setNewsItem()

ilNewsTimelineItemGUI::setNewsItem ( ilNewsItem  $a_val)

Set news item.

Parameters
ilNewsItem$a_valnews item

Definition at line 93 of file class.ilNewsTimelineItemGUI.php.

Referenced by __construct().

94  {
95  $this->news_item = $a_val;
96  }
+ Here is the caller graph for this function:

◆ setUserEditAll()

ilNewsTimelineItemGUI::setUserEditAll (   $a_val)

Set user can edit other users postings.

Parameters
bool$a_valuser can edit all postings

Definition at line 113 of file class.ilNewsTimelineItemGUI.php.

114  {
115  $this->user_edit_all = $a_val;
116  }

Field Documentation

◆ $ctrl

ilNewsTimelineItemGUI::$ctrl
protected

Definition at line 55 of file class.ilNewsTimelineItemGUI.php.

◆ $lng

ilNewsTimelineItemGUI::$lng
protected

Definition at line 17 of file class.ilNewsTimelineItemGUI.php.

◆ $news_item

ilNewsTimelineItemGUI::$news_item
protected

Definition at line 22 of file class.ilNewsTimelineItemGUI.php.

Referenced by getNewsItem().

◆ $news_item_ref_id

ilNewsTimelineItemGUI::$news_item_ref_id
protected

Definition at line 44 of file class.ilNewsTimelineItemGUI.php.

◆ $obj_def

ilNewsTimelineItemGUI::$obj_def
protected

Definition at line 27 of file class.ilNewsTimelineItemGUI.php.

◆ $ref_id

ilNewsTimelineItemGUI::$ref_id
protected

Definition at line 50 of file class.ilNewsTimelineItemGUI.php.

◆ $user

ilNewsTimelineItemGUI::$user
protected

Definition at line 32 of file class.ilNewsTimelineItemGUI.php.

◆ $user_edit_all

ilNewsTimelineItemGUI::$user_edit_all
protected

Definition at line 37 of file class.ilNewsTimelineItemGUI.php.

Referenced by getUserEditAll().


The documentation for this class was generated from the following file: