19declare(strict_types=1);
37 protected \ILIAS\Blog\Presentation\Util
$util;
63 $this->blog_access = $blog_acces;
64 $this->
ctrl = $ctrl = $this->gui->ctrl();
65 $this->items = $a_items;
66 $this->current_month = $month;
70 if ($single_posting) {
71 $next_posting = $this->getNextPosting(
$blog_page);
72 if ($next_posting > 0) {
78 $this->renderPostingDropdown();
80 $prev_posting = $this->getPreviousPosting(
$blog_page);
81 if ($prev_posting > 0) {
88 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"blpg",
$blog_page);
94 if ($next_month !==
"") {
103 if ($prev_month !==
"") {
109 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"bmn", $month);
117 $lng = $this->domain->lng();
118 $toolbar = $this->gui->toolbar();
119 $f = $this->gui->ui()->factory();
122 if ($this->blog_access->mayContribute()) {
123 $link = $this->edit_link_builder->forMainList();
124 $actions[] =
$f->button()->shy(
125 $lng->txt(
"blog_edit"),
130 if ($single_posting && $this->blog_access->mayContribute() && $this->blog_access->mayEditPosting($this->blog_page)) {
131 $link = $this->edit_link_builder->forPosting($this->blog_page);
132 $actions[] =
$f->button()->shy(
133 $lng->txt(
"blog_edit_posting"),
137 if (count($actions) > 0) {
138 $toolbar->addStickyItem(
$f->dropdown()->standard($actions));
145 $month = current($this->items);
146 if (is_array($month)) {
147 $first = current($month);
149 return (
int) $first->getId();
155 public function getNextPosting(
161 foreach ($this->items as $month => $items) {
162 foreach ($items as $item) {
164 $item_id = (
int) $item->getId();
165 if (!$this->blog_access->isActive($item_id)) {
168 if ($item_id == $blog_page) {
172 $next_blpg = $item_id;
179 protected function getPreviousPosting(
185 foreach ($this->items as $month => $items) {
186 foreach ($items as $item) {
188 $item_id = (
int) $item->getId();
189 if (!$this->blog_access->isActive($item_id)) {
192 if ($found && $prev_blpg === 0) {
193 $prev_blpg = $item_id;
195 if ($item_id === $blog_page) {
205 return $this->pres_link_builder->forPosting($posting);
210 return $this->pres_link_builder->forMonth($month);
215 $toolbar = $this->gui->toolbar();
216 $f = $this->gui->ui()->factory();
218 foreach ($this->items as $month => $items) {
219 $label = $this->util->getMonthPresentation($month);
220 if ($month === $this->current_month) {
221 $label =
"» " . $label;
223 $m[] =
$f->link()->standard(
225 $this->getMonthTarget($month)
229 $toolbar->addStickyItem(
$f->dropdown()->standard($m)->withLabel(
230 $this->getDropdownLabel($this->util->getMonthPresentation($this->current_month))
236 string $current_month
240 foreach ($this->items as $month => $items) {
241 if ($month > $current_month) {
249 string $current_month
253 foreach ($this->items as $month => $items) {
254 if ($month < $current_month && $found ===
"") {
267 return key($this->items);
272 $this->renderNavButton(
"right", $href);
277 $this->renderNavButton(
"left", $href);
282 $toolbar = $this->gui->toolbar();
283 $b = $this->gui->ui()->factory()->button()->standard(
284 "<span class=\"glyphicon glyphicon-chevron-" . $dir .
" \" aria-hidden=\"true\"></span>",
288 $b =
$b->withUnavailableAction();
290 $toolbar->addStickyItem(
$b);
293 protected function renderPostingDropdown(): void
295 $toolbar = $this->gui->toolbar();
296 $f = $this->gui->ui()->factory();
299 foreach ($this->items as $month => $items) {
300 $label = $this->util->getMonthPresentation($month);
301 $m[] =
$f->button()->shy(
303 $this->getMonthTarget($month)
304 )->withUnavailableAction();
306 foreach ($items as $item) {
307 if (!$this->blog_access->isActive((
int) $item->getId())) {
310 $label = $item->getTitle();
311 if ((
int) $item->getId() === $this->blog_page) {
312 $label =
"» " . $label;
313 $dd_title = $item->getTitle();
315 $label = str_pad(
"", 12,
" ") . $label;
316 $m[] =
$f->link()->standard(
318 $this->getPostingTarget((
int) $item->getId())
323 $toolbar->addStickyItem(
$f->dropdown()->standard($m)->withLabel(
324 $this->getDropdownLabel($dd_title)
331 return "<span style='vertical-align: bottom; max-width:60px; display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . $label .
"</span>";
@ilCtrl_Calls ILIAS\Blog\Editing\EditingGUI: ilRepositorySearchGUI, ilBlogPostingGUI
renderNextButton(string $href="")
getPostingTarget(int $posting)
Link EditingLinkBuilder $edit_link_builder
PermissionManager $blog_access
renderActionDropdown(bool $single_posting)
renderToolbarNavigation(PermissionManager $blog_acces, array $a_items, int $blog_page, bool $single_posting, string $month, int $portfolio_page)
__construct(InternalDomainService $domain, InternalGUIService $gui, protected LinkBuilder $pres_link_builder)
renderNavButton(string $dir, string $href="")
ILIAS Blog Presentation Util $util
getPreviousMonth(string $current_month)
renderPreviousButton(string $href="")
getDropdownLabel(string $label)
getNextMonth(string $current_month)
getMonthTarget(string $month)
InternalDomainService $domain
Interface for building links within the Blog component.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.