ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTimelineGUI Class Reference

Timline (temporary implementation) More...

+ Collaboration diagram for ilTimelineGUI:

Public Member Functions

 addItem (ilTimelineItemInt $a_item)
 Add item. More...
 
 render ($a_items_only=false)
 Render. More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Protected Member Functions

 __construct ()
 Construct. More...
 

Protected Attributes

 $items = array()
 
 $lng
 
 $tpl
 

Detailed Description

Timline (temporary implementation)

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

Definition at line 14 of file class.ilTimelineGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTimelineGUI::__construct ( )
protected

Construct.

Parameters

return

Definition at line 34 of file class.ilTimelineGUI.php.

35 {
36 global $DIC;
37
38 $this->lng = $DIC->language();
39 $this->tpl = $DIC["tpl"];
40 }
global $DIC
Definition: goto.php:24

References $DIC.

Member Function Documentation

◆ addItem()

ilTimelineGUI::addItem ( ilTimelineItemInt  $a_item)

Add item.

Parameters

return

Definition at line 59 of file class.ilTimelineGUI.php.

60 {
61 $this->items[] = $a_item;
62 }

◆ getInstance()

static ilTimelineGUI::getInstance ( )
static

Get instance.

Parameters

return

Definition at line 48 of file class.ilTimelineGUI.php.

49 {
50 return new self();
51 }

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

+ Here is the caller graph for this function:

◆ render()

ilTimelineGUI::render (   $a_items_only = false)

Render.

Parameters

return

Definition at line 70 of file class.ilTimelineGUI.php.

71 {
72 $this->tpl->addJavaScript("./Services/News/Timeline/js/Timeline.js");
73 $this->tpl->addJavaScript("./Services/News/Timeline/libs/jquery-dynamic-max-height-master/src/jquery.dynamicmaxheight.js");
74
75 $t = new ilTemplate("tpl.timeline.html", true, true, "Services/News/Timeline");
76 if (!$a_items_only) {
77 $t->touchBlock("list_start");
78 $t->touchBlock("list_end");
79 }
80 $keys = array_keys($this->items);
81 foreach ($this->items as $k => $i) {
82 $next = null;
83 if (isset($this->items[$keys[$k + 1]])) {
84 $next = $this->items[$keys[$k + 1]];
85 }
86
87 $dt = $i->getDateTime();
88 if (is_null($next) || $dt->get(IL_CAL_FKT_DATE, "Y-m-d") != $next->getDateTime()->get(IL_CAL_FKT_DATE, "Y-m-d")) {
89 $t->setCurrentBlock("badge");
90 $t->setVariable("DAY", $dt->get(IL_CAL_FKT_DATE, "d"));
91 $t->setVariable("MONTH", $this->lng->txt("month_" . $dt->get(IL_CAL_FKT_DATE, "m") . "_short"));
92 $t->parseCurrentBlock();
93 }
94
95 $t->setCurrentBlock("item");
96 $t->setVariable("CONTENT", $i->render());
97 $t->setVariable("FOOTER", $i->renderFooter());
98 $t->parseCurrentBlock();
99 }
100 return $t->get();
101 }
const IL_CAL_FKT_DATE
special template class to simplify handling of ITX/PEAR
$i
Definition: metadata.php:24
$keys
Definition: metadata.php:187

References $i, $keys, and IL_CAL_FKT_DATE.

Field Documentation

◆ $items

ilTimelineGUI::$items = array()
protected

Definition at line 16 of file class.ilTimelineGUI.php.

◆ $lng

ilTimelineGUI::$lng
protected

Definition at line 21 of file class.ilTimelineGUI.php.

◆ $tpl

ilTimelineGUI::$tpl
protected

Definition at line 26 of file class.ilTimelineGUI.php.


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