ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Blog\Navigation\ToolbarNavigationRenderer Class Reference
+ Collaboration diagram for ILIAS\Blog\Navigation\ToolbarNavigationRenderer:

Public Member Functions

 __construct (InternalDomainService $domain, InternalGUIService $gui)
 
 renderToolbarNavigation (BlogAccess $blog_acces, array $a_items, int $blog_page, bool $single_posting, bool $prtf_embed, $month, int $portfolio_page)
 
 getNextPosting (int $blog_page)
 

Protected Member Functions

 renderActionDropdown (bool $single_posting)
 
 getLatestPosting ()
 
 getPreviousPosting (int $blog_page)
 
 getPostingTarget (int $posting, string $cmd)
 
 getMonthTarget (string $month)
 
 renderMonthDropdown ()
 
 getNextMonth ( $current_month)
 
 getPreviousMonth ( $current_month)
 
 getLatestMonth ()
 
 renderNextButton (string $href="")
 
 renderPreviousButton (string $href="")
 
 renderNavButton (string $dir, string $href="")
 
 renderPostingDropdown (string $cmd)
 
 getDropdownLabel (string $label)
 

Protected Attributes

array $items
 
InternalGUIService $gui
 
int $portfolio_page
 
bool $prtf_embed
 
int $blog_page
 
ILIAS Blog Presentation Util $util
 
 $current_month
 
ilCtrl $ctrl
 
BlogAccess $blog_access
 
InternalDomainService $domain
 

Detailed Description

Definition at line 27 of file ToolbarNavigationRenderer.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::__construct ( InternalDomainService  $domain,
InternalGUIService  $gui 
)

Member Function Documentation

◆ getDropdownLabel()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getDropdownLabel ( string  $label)
protected

Definition at line 328 of file ToolbarNavigationRenderer.php.

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderMonthDropdown(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPostingDropdown().

328  : string
329  {
330  return "<span style='vertical-align: bottom; max-width:60px; display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . $label . "</span>";
331  }
+ Here is the caller graph for this function:

◆ getLatestMonth()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getLatestMonth ( )
protected
Parameters
array$a_itemsitem array

Definition at line 267 of file ToolbarNavigationRenderer.php.

267  : string
268  {
269  reset($this->items);
270  return key($this->items);
271  }

◆ getLatestPosting()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getLatestPosting ( )
protected

Definition at line 156 of file ToolbarNavigationRenderer.php.

156  : int
157  {
158  reset($this->items);
159  $month = current($this->items);
160  if (is_array($month)) {
161  return (int) current($month)["id"];
162  }
163  return 0;
164  }

◆ getMonthTarget()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getMonthTarget ( string  $month)
protected

Definition at line 210 of file ToolbarNavigationRenderer.php.

References ILIAS\Repository\ctrl().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderMonthDropdown(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPostingDropdown(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

210  : string
211  {
212  $this->ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", $month);
213  return $this->ctrl->getLinkTargetByClass(\ilObjBlogGUI::class, "preview");
214  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNextMonth()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getNextMonth (   $current_month)
protected

Definition at line 238 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$current_month.

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

240  : string {
241  reset($this->items);
242  $found = "";
243  foreach ($this->items as $month => $items) {
244  if ($month > $current_month) {
245  $found = $month;
246  }
247  }
248  return $found;
249  }
+ Here is the caller graph for this function:

◆ getNextPosting()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getNextPosting ( int  $blog_page)

Definition at line 166 of file ToolbarNavigationRenderer.php.

References ILIAS\Repository\int().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

168  : int {
169  reset($this->items);
170  $found = "";
171  $next_blpg = 0;
172  foreach ($this->items as $month => $items) {
173  foreach ($items as $item) {
174  if ($item["id"] == $blog_page) {
175  $found = true;
176  }
177  if (!$found) {
178  $next_blpg = (int) $item["id"];
179  }
180  }
181  }
182  return $next_blpg;
183  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPostingTarget()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getPostingTarget ( int  $posting,
string  $cmd 
)
protected

Definition at line 204 of file ToolbarNavigationRenderer.php.

References ILIAS\Repository\ctrl().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPostingDropdown(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

204  : string
205  {
206  $this->ctrl->setParameterByClass(\ilBlogPostingGUI::class, "blpg", (string) $posting);
207  return $this->ctrl->getLinkTargetByClass(\ilBlogPostingGUI::class, $cmd);
208  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPreviousMonth()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getPreviousMonth (   $current_month)
protected

Definition at line 251 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$current_month.

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

253  : string {
254  reset($this->items);
255  $found = "";
256  foreach ($this->items as $month => $items) {
257  if ($month < $current_month && $found === "") {
258  $found = $month;
259  }
260  }
261  return $found;
262  }
+ Here is the caller graph for this function:

◆ getPreviousPosting()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::getPreviousPosting ( int  $blog_page)
protected

Definition at line 185 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$blog_page, and ILIAS\Repository\int().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

187  : int {
188  reset($this->items);
189  $found = "";
190  $prev_blpg = 0;
191  foreach ($this->items as $month => $items) {
192  foreach ($items as $item) {
193  if ($found && $prev_blpg === 0) {
194  $prev_blpg = (int) $item["id"];
195  }
196  if ((int) $item["id"] === $blog_page) {
197  $found = true;
198  }
199  }
200  }
201  return $prev_blpg;
202  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderActionDropdown()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderActionDropdown ( bool  $single_posting)
protected

Definition at line 119 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$ctrl, Vendor\Package\$f, $lng, and ilCtrl\setParameterByClass().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

119  : void
120  {
121  $lng = $this->domain->lng();
122  $toolbar = $this->gui->toolbar();
123  $f = $this->gui->ui()->factory();
124  $ctrl = $this->ctrl;
125  $actions = [];
126  if ($this->blog_access->mayContribute()) {
127  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "prvm", "");
128 
129  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", "");
130  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "blpg", "");
131  $link = $ctrl->getLinkTargetByClass(\ilObjBlogGUI::class, "");
132  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "blpg", $this->blog_page);
133  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", $this->current_month);
134  $actions[] = $f->button()->shy(
135  $lng->txt("blog_edit"),
136  $link
137  );
138  }
139 
140  if ($single_posting && $this->blog_access->mayContribute() && $this->blog_access->mayEditPosting($this->blog_page)) {
141  $ctrl->setParameterByClass(\ilBlogPostingGUI::class, "blpg", $this->blog_page);
142  if ($this->prtf_embed) {
143  $ctrl->setParameterByClass(\ilObjPortfolioGUI::class, "ppage", $this->portfolio_page);
144  }
145  $link = $ctrl->getLinkTargetByClass(\ilBlogPostingGUI::class, "edit");
146  $actions[] = $f->button()->shy(
147  $lng->txt("blog_edit_posting"),
148  $link
149  );
150  }
151  if (count($actions) > 0) {
152  $toolbar->addStickyItem($f->dropdown()->standard($actions));
153  }
154  }
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
$lng
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderMonthDropdown()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderMonthDropdown ( )
protected

Definition at line 216 of file ToolbarNavigationRenderer.php.

References Vendor\Package\$f, ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getDropdownLabel(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getMonthTarget().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

216  : void
217  {
218  $toolbar = $this->gui->toolbar();
219  $f = $this->gui->ui()->factory();
220  $m = [];
221  foreach ($this->items as $month => $items) {
222  $label = $this->util->getMonthPresentation($month);
223  if ($month === $this->current_month) {
224  $label = "ยป " . $label;
225  }
226  $m[] = $f->link()->standard(
227  $label,
228  $this->getMonthTarget($month)
229  );
230  }
231  if (count($m) > 0) {
232  $toolbar->addStickyItem($f->dropdown()->standard($m)->withLabel(
233  $this->getDropdownLabel($this->util->getMonthPresentation($this->current_month))
234  ));
235  }
236  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderNavButton()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderNavButton ( string  $dir,
string  $href = "" 
)
protected

Definition at line 283 of file ToolbarNavigationRenderer.php.

References Vendor\Package\$b.

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderNextButton(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPreviousButton().

283  : void
284  {
285  $toolbar = $this->gui->toolbar();
286  $b = $this->gui->ui()->factory()->button()->standard(
287  "<span class=\"glyphicon glyphicon-chevron-" . $dir . " \" aria-hidden=\"true\"></span>",
288  $href
289  );
290  if ($href === "") {
291  $b = $b->withUnavailableAction();
292  }
293  $toolbar->addStickyItem($b);
294  }
+ Here is the caller graph for this function:

◆ renderNextButton()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderNextButton ( string  $href = "")
protected

Definition at line 273 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderNavButton().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

273  : void
274  {
275  $this->renderNavButton("right", $href);
276  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPostingDropdown()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderPostingDropdown ( string  $cmd)
protected

Definition at line 296 of file ToolbarNavigationRenderer.php.

References Vendor\Package\$f, ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getDropdownLabel(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getMonthTarget(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getPostingTarget().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

296  : void
297  {
298  $toolbar = $this->gui->toolbar();
299  $f = $this->gui->ui()->factory();
300  $m = [];
301  $dd_title = "";
302  foreach ($this->items as $month => $items) {
303  $label = $this->util->getMonthPresentation($month);
304  $m[] = $f->button()->shy(
305  $label,
306  $this->getMonthTarget($month)
307  )->withUnavailableAction();
308  foreach ($items as $item) {
309  $label = $item["title"];
310  if ((int) $item["id"] === $this->blog_page) {
311  $label = "ยป " . $label;
312  $dd_title = $item["title"];
313  }
314  $label = str_pad("", 12, "&nbsp;") . $label;
315  $m[] = $f->link()->standard(
316  $label,
317  $this->getPostingTarget((int) $item["id"], $cmd)
318  );
319  }
320  }
321  if (count($m) > 0) {
322  $toolbar->addStickyItem($f->dropdown()->standard($m)->withLabel(
323  $this->getDropdownLabel($dd_title)
324  ));
325  }
326  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPreviousButton()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderPreviousButton ( string  $href = "")
protected

Definition at line 278 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderNavButton().

Referenced by ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderToolbarNavigation().

278  : void
279  {
280  $this->renderNavButton("left", $href);
281  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderToolbarNavigation()

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::renderToolbarNavigation ( BlogAccess  $blog_acces,
array  $a_items,
int  $blog_page,
bool  $single_posting,
bool  $prtf_embed,
  $month,
int  $portfolio_page 
)

Definition at line 49 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$blog_page, Vendor\Package\$f, $lng, ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$portfolio_page, ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$prtf_embed, ILIAS\Repository\ctrl(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getMonthTarget(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getNextMonth(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getNextPosting(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getPostingTarget(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getPreviousMonth(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getPreviousPosting(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderActionDropdown(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderMonthDropdown(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderNextButton(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPostingDropdown(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPreviousButton().

57  : void {
58 
59  $this->blog_access = $blog_acces;
60  $toolbar = $this->gui->toolbar();
61  $lng = $this->domain->lng();
62  $this->ctrl = $ctrl = $this->gui->ctrl();
63  $f = $this->gui->ui()->factory();
64  $this->items = $a_items;
65  $this->current_month = $month;
66  $this->blog_page = $blog_page;
67  $this->prtf_embed = $prtf_embed;
68  $this->portfolio_page = $portfolio_page;
69 
70  $cmd = ($prtf_embed)
71  ? "previewEmbedded"
72  : "previewFullscreen";
73 
74  if ($single_posting) { // single posting view
75  $next_posting = $this->getNextPosting($blog_page);
76  if ($next_posting > 0) {
77  $this->renderPreviousButton($this->getPostingTarget($next_posting, $cmd));
78  } else {
79  $this->renderPreviousButton("");
80  }
81 
82  $this->renderPostingDropdown($cmd);
83 
84  $prev_posting = $this->getPreviousPosting($blog_page);
85  if ($prev_posting > 0) {
86  $this->renderNextButton($this->getPostingTarget($prev_posting, $cmd));
87  } else {
88  $this->renderNextButton("");
89  }
90 
91 
92  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "blpg", $blog_page);
93 
94  $this->renderActionDropdown(true);
95 
96  } else { // month view
97  $next_month = $this->getNextMonth($month);
98  if ($next_month !== "") {
99  $this->renderPreviousButton($this->getMonthTarget($next_month));
100  } else {
101  $this->renderPreviousButton("");
102  }
103 
104  $this->renderMonthDropdown();
105 
106  $prev_month = $this->getPreviousMonth($month);
107  if ($prev_month !== "") {
108  $this->renderNextButton($this->getMonthTarget($prev_month));
109  } else {
110  $this->renderNextButton("");
111  }
112 
113  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", $month);
114 
115  $this->renderActionDropdown(false);
116  }
117  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
$lng
+ Here is the call graph for this function:

Field Documentation

◆ $blog_access

BlogAccess ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$blog_access
protected

Definition at line 37 of file ToolbarNavigationRenderer.php.

◆ $blog_page

int ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$blog_page
protected

◆ $ctrl

ilCtrl ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$ctrl
protected

◆ $current_month

ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$current_month
protected

◆ $domain

InternalDomainService ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$domain
protected

◆ $gui

InternalGUIService ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$gui
protected

◆ $items

array ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$items
protected

Definition at line 29 of file ToolbarNavigationRenderer.php.

◆ $portfolio_page

int ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$portfolio_page
protected

◆ $prtf_embed

bool ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$prtf_embed
protected

◆ $util

ILIAS Blog Presentation Util ILIAS\Blog\Navigation\ToolbarNavigationRenderer::$util
protected

Definition at line 34 of file ToolbarNavigationRenderer.php.


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