ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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, $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
 
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 317 of file ToolbarNavigationRenderer.php.

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

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

◆ getLatestMonth()

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

Definition at line 256 of file ToolbarNavigationRenderer.php.

256  : string
257  {
258  reset($this->items);
259  return key($this->items);
260  }

◆ getLatestPosting()

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

Definition at line 145 of file ToolbarNavigationRenderer.php.

145  : int
146  {
147  reset($this->items);
148  $month = current($this->items);
149  if (is_array($month)) {
150  return (int) current($month)["id"];
151  }
152  return 0;
153  }

◆ getMonthTarget()

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

Definition at line 199 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().

199  : string
200  {
201  $this->ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", $month);
202  return $this->ctrl->getLinkTargetByClass(\ilObjBlogGUI::class, "preview");
203  }
+ 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 227 of file ToolbarNavigationRenderer.php.

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

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

229  : string {
230  reset($this->items);
231  $found = "";
232  foreach ($this->items as $month => $items) {
233  if ($month > $current_month) {
234  $found = $month;
235  }
236  }
237  return $found;
238  }
+ Here is the caller graph for this function:

◆ getNextPosting()

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

Definition at line 155 of file ToolbarNavigationRenderer.php.

References ILIAS\Repository\int().

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

157  : int {
158  reset($this->items);
159  $found = "";
160  $next_blpg = 0;
161  foreach ($this->items as $month => $items) {
162  foreach ($items as $item) {
163  if ($item["id"] == $blog_page) {
164  $found = true;
165  }
166  if (!$found) {
167  $next_blpg = (int) $item["id"];
168  }
169  }
170  }
171  return $next_blpg;
172  }
+ 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 193 of file ToolbarNavigationRenderer.php.

References ILIAS\Repository\ctrl().

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

193  : string
194  {
195  $this->ctrl->setParameterByClass(\ilBlogPostingGUI::class, "blpg", (string) $posting);
196  return $this->ctrl->getLinkTargetByClass(\ilBlogPostingGUI::class, $cmd);
197  }
+ 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 240 of file ToolbarNavigationRenderer.php.

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

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

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

◆ getPreviousPosting()

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

Definition at line 174 of file ToolbarNavigationRenderer.php.

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

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

176  : int {
177  reset($this->items);
178  $found = "";
179  $prev_blpg = 0;
180  foreach ($this->items as $month => $items) {
181  foreach ($items as $item) {
182  if ($found && $prev_blpg === 0) {
183  $prev_blpg = (int) $item["id"];
184  }
185  if ((int) $item["id"] === $blog_page) {
186  $found = true;
187  }
188  }
189  }
190  return $prev_blpg;
191  }
+ 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 111 of file ToolbarNavigationRenderer.php.

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

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

111  : void
112  {
113  $lng = $this->domain->lng();
114  $toolbar = $this->gui->toolbar();
115  $f = $this->gui->ui()->factory();
116  $ctrl = $this->ctrl;
117  $actions = [];
118  if ($this->blog_access->mayContribute()) {
119  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "prvm", "");
120 
121  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", "");
122  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "blpg", "");
123  $link = $ctrl->getLinkTargetByClass(\ilObjBlogGUI::class, "");
124  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "blpg", $this->blog_page);
125  $ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", $this->current_month);
126  $actions[] = $f->button()->shy(
127  $lng->txt("blog_edit"),
128  $link
129  );
130  }
131 
132  if ($single_posting && $this->blog_access->mayContribute() && $this->blog_access->mayEditPosting($this->blog_page)) {
133  $ctrl->setParameterByClass(\ilBlogPostingGUI::class, "blpg", $this->blog_page);
134  $link = $ctrl->getLinkTargetByClass(\ilBlogPostingGUI::class, "edit");
135  $actions[] = $f->button()->shy(
136  $lng->txt("blog_edit_posting"),
137  $link
138  );
139  }
140  if (count($actions) > 0) {
141  $toolbar->addStickyItem($f->dropdown()->standard($actions));
142  }
143  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
global $lng
Definition: privfeed.php:31
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ 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 205 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().

205  : void
206  {
207  $toolbar = $this->gui->toolbar();
208  $f = $this->gui->ui()->factory();
209  $m = [];
210  foreach ($this->items as $month => $items) {
211  $label = $this->util->getMonthPresentation($month);
212  if ($month === $this->current_month) {
213  $label = "» " . $label;
214  }
215  $m[] = $f->link()->standard(
216  $label,
217  $this->getMonthTarget($month)
218  );
219  }
220  if (count($m) > 0) {
221  $toolbar->addStickyItem($f->dropdown()->standard($m)->withLabel(
222  $this->getDropdownLabel($this->util->getMonthPresentation($this->current_month))
223  ));
224  }
225  }
+ 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 272 of file ToolbarNavigationRenderer.php.

References Vendor\Package\$b.

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

272  : void
273  {
274  $toolbar = $this->gui->toolbar();
275  $b = $this->gui->ui()->factory()->button()->standard(
276  "<span class=\"glyphicon glyphicon-chevron-" . $dir . " \" aria-hidden=\"true\"></span>",
277  $href
278  );
279  if ($href === "") {
280  $b = $b->withUnavailableAction();
281  }
282  $toolbar->addStickyItem($b);
283  }
+ Here is the caller graph for this function:

◆ renderNextButton()

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

Definition at line 262 of file ToolbarNavigationRenderer.php.

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

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

262  : void
263  {
264  $this->renderNavButton("right", $href);
265  }
+ 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 285 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().

285  : void
286  {
287  $toolbar = $this->gui->toolbar();
288  $f = $this->gui->ui()->factory();
289  $m = [];
290  $dd_title = "";
291  foreach ($this->items as $month => $items) {
292  $label = $this->util->getMonthPresentation($month);
293  $m[] = $f->button()->shy(
294  $label,
295  $this->getMonthTarget($month)
296  )->withUnavailableAction();
297  foreach ($items as $item) {
298  $label = $item["title"];
299  if ((int) $item["id"] === $this->blog_page) {
300  $label = "» " . $label;
301  $dd_title = $item["title"];
302  }
303  $label = str_pad("", 12, "&nbsp;") . $label;
304  $m[] = $f->link()->standard(
305  $label,
306  $this->getPostingTarget((int) $item["id"], $cmd)
307  );
308  }
309  }
310  if (count($m) > 0) {
311  $toolbar->addStickyItem($f->dropdown()->standard($m)->withLabel(
312  $this->getDropdownLabel($dd_title)
313  ));
314  }
315  }
+ 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 267 of file ToolbarNavigationRenderer.php.

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

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

267  : void
268  {
269  $this->renderNavButton("left", $href);
270  }
+ 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,
  $month,
int  $portfolio_page 
)

Definition at line 48 of file ToolbarNavigationRenderer.php.

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$blog_page, ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$portfolio_page, 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().

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

Field Documentation

◆ $blog_access

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

Definition at line 36 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

◆ $util

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

Definition at line 33 of file ToolbarNavigationRenderer.php.


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