ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Blog\Navigation\ToolbarNavigationRenderer Class Reference
+ Collaboration diagram for ILIAS\Blog\Navigation\ToolbarNavigationRenderer:

Public Member Functions

 __construct (InternalDomainService $domain, InternalGUIService $gui)
 
 renderToolbarNavigation (PermissionManager $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
 
PermissionManager $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 326 of file ToolbarNavigationRenderer.php.

326 : string
327 {
328 return "<span style='vertical-align: bottom; max-width:60px; display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . $label . "</span>";
329 }

◆ getLatestMonth()

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

Definition at line 262 of file ToolbarNavigationRenderer.php.

262 : string
263 {
264 reset($this->items);
265 return key($this->items);
266 }

◆ 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 205 of file ToolbarNavigationRenderer.php.

205 : string
206 {
207 $this->ctrl->setParameterByClass(\ilObjBlogGUI::class, "bmn", $month);
208 return $this->ctrl->getLinkTargetByClass(\ilObjBlogGUI::class, "preview");
209 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getNextMonth()

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

Definition at line 233 of file ToolbarNavigationRenderer.php.

235 : string {
236 reset($this->items);
237 $found = "";
238 foreach ($this->items as $month => $items) {
239 if ($month > $current_month) {
240 $found = $month;
241 }
242 }
243 return $found;
244 }

◆ getNextPosting()

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

Definition at line 155 of file ToolbarNavigationRenderer.php.

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 (!$this->blog_access->isActive((int) $item["id"])) {
164 continue;
165 }
166 if ($item["id"] == $blog_page) {
167 $found = true;
168 }
169 if (!$found) {
170 $next_blpg = (int) $item["id"];
171 }
172 }
173 }
174 return $next_blpg;
175 }

References ILIAS\Repository\int().

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

+ 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 199 of file ToolbarNavigationRenderer.php.

199 : string
200 {
201 $this->ctrl->setParameterByClass(\ilBlogPostingGUI::class, "blpg", (string) $posting);
202 return $this->ctrl->getLinkTargetByClass(\ilBlogPostingGUI::class, $cmd);
203 }

References ILIAS\Repository\ctrl().

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

+ 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 246 of file ToolbarNavigationRenderer.php.

248 : string {
249 reset($this->items);
250 $found = "";
251 foreach ($this->items as $month => $items) {
252 if ($month < $current_month && $found === "") {
253 $found = $month;
254 }
255 }
256 return $found;
257 }

◆ getPreviousPosting()

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

Definition at line 177 of file ToolbarNavigationRenderer.php.

179 : int {
180 reset($this->items);
181 $found = "";
182 $prev_blpg = 0;
183 foreach ($this->items as $month => $items) {
184 foreach ($items as $item) {
185 if (!$this->blog_access->isActive((int) $item["id"])) {
186 continue;
187 }
188 if ($found && $prev_blpg === 0) {
189 $prev_blpg = (int) $item["id"];
190 }
191 if ((int) $item["id"] === $blog_page) {
192 $found = true;
193 }
194 }
195 }
196 return $prev_blpg;
197 }

References ILIAS\Repository\int().

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

+ 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.

111 : void
112 {
113 $lng = $this->domain->lng();
114 $toolbar = $this->gui->toolbar();
115 $f = $this->gui->ui()->factory();
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)
@inheritDoc
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
global $lng
Definition: privfeed.php:31

References Vendor\Package\$f, and $lng.

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

+ Here is the caller graph for this function:

◆ renderMonthDropdown()

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

Definition at line 211 of file ToolbarNavigationRenderer.php.

211 : void
212 {
213 $toolbar = $this->gui->toolbar();
214 $f = $this->gui->ui()->factory();
215 $m = [];
216 foreach ($this->items as $month => $items) {
217 $label = $this->util->getMonthPresentation($month);
218 if ($month === $this->current_month) {
219 $label = "» " . $label;
220 }
221 $m[] = $f->link()->standard(
222 $label,
223 $this->getMonthTarget($month)
224 );
225 }
226 if (count($m) > 0) {
227 $toolbar->addStickyItem($f->dropdown()->standard($m)->withLabel(
228 $this->getDropdownLabel($this->util->getMonthPresentation($this->current_month))
229 ));
230 }
231 }

References Vendor\Package\$f.

◆ renderNavButton()

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

Definition at line 278 of file ToolbarNavigationRenderer.php.

278 : void
279 {
280 $toolbar = $this->gui->toolbar();
281 $b = $this->gui->ui()->factory()->button()->standard(
282 "<span class=\"glyphicon glyphicon-chevron-" . $dir . " \" aria-hidden=\"true\"></span>",
283 $href
284 );
285 if ($href === "") {
286 $b = $b->withUnavailableAction();
287 }
288 $toolbar->addStickyItem($b);
289 }

References Vendor\Package\$b.

◆ renderNextButton()

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

Definition at line 268 of file ToolbarNavigationRenderer.php.

268 : void
269 {
270 $this->renderNavButton("right", $href);
271 }

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

+ Here is the caller graph for this function:

◆ renderPostingDropdown()

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

Definition at line 291 of file ToolbarNavigationRenderer.php.

291 : void
292 {
293 $toolbar = $this->gui->toolbar();
294 $f = $this->gui->ui()->factory();
295 $m = [];
296 $dd_title = "";
297 foreach ($this->items as $month => $items) {
298 $label = $this->util->getMonthPresentation($month);
299 $m[] = $f->button()->shy(
300 $label,
301 $this->getMonthTarget($month)
302 )->withUnavailableAction();
303 foreach ($items as $item) {
304 if (!$this->blog_access->isActive((int) $item["id"])) {
305 continue;
306 }
307 $label = $item["title"];
308 if ((int) $item["id"] === $this->blog_page) {
309 $label = "» " . $label;
310 $dd_title = $item["title"];
311 }
312 $label = str_pad("", 12, "&nbsp;") . $label;
313 $m[] = $f->link()->standard(
314 $label,
315 $this->getPostingTarget((int) $item["id"], $cmd)
316 );
317 }
318 }
319 if (count($m) > 0) {
320 $toolbar->addStickyItem($f->dropdown()->standard($m)->withLabel(
321 $this->getDropdownLabel($dd_title)
322 ));
323 }
324 }

References Vendor\Package\$f.

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

+ Here is the caller graph for this function:

◆ renderPreviousButton()

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

Definition at line 273 of file ToolbarNavigationRenderer.php.

273 : void
274 {
275 $this->renderNavButton("left", $href);
276 }

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

+ Here is the caller graph for this function:

◆ renderToolbarNavigation()

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

Definition at line 48 of file ToolbarNavigationRenderer.php.

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 }

References ILIAS\Blog\Navigation\ToolbarNavigationRenderer\$blog_page, ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getNextPosting(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getPostingTarget(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\getPreviousPosting(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderActionDropdown(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderNextButton(), ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPostingDropdown(), and ILIAS\Blog\Navigation\ToolbarNavigationRenderer\renderPreviousButton().

+ Here is the call graph for this function:

Field Documentation

◆ $blog_access

PermissionManager 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

Definition at line 35 of file ToolbarNavigationRenderer.php.

◆ $current_month

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

Definition at line 34 of file ToolbarNavigationRenderer.php.

◆ $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

Definition at line 31 of file ToolbarNavigationRenderer.php.

◆ $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: