19declare(strict_types=1);
33 protected \ILIAS\Blog\Presentation\Util
$util;
57 $this->blog_access = $blog_acces;
58 $this->
ctrl = $ctrl = $this->gui->ctrl();
59 $this->items = $a_items;
60 $this->current_month = $month;
64 $cmd =
"previewFullscreen";
66 if ($single_posting) {
68 if ($next_posting > 0) {
77 if ($prev_posting > 0) {
84 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"blpg",
$blog_page);
90 if ($next_month !==
"") {
99 if ($prev_month !==
"") {
105 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"bmn", $month);
113 $lng = $this->domain->lng();
114 $toolbar = $this->gui->toolbar();
115 $f = $this->gui->ui()->factory();
118 if ($this->blog_access->mayContribute()) {
119 $ctrl->setParameterByClass(\ilObjBlogGUI::class,
"prvm",
"");
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"),
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"),
140 if (count($actions) > 0) {
141 $toolbar->addStickyItem(
$f->dropdown()->standard($actions));
148 $month = current($this->items);
149 if (is_array($month)) {
150 return (
int) current($month)[
"id"];
161 foreach ($this->items as $month => $items) {
162 foreach ($items as $item) {
163 if (!$this->blog_access->isActive((
int) $item[
"id"])) {
166 if ($item[
"id"] == $blog_page) {
170 $next_blpg = (
int) $item[
"id"];
183 foreach ($this->items as $month => $items) {
184 foreach ($items as $item) {
185 if (!$this->blog_access->isActive((
int) $item[
"id"])) {
188 if ($found && $prev_blpg === 0) {
189 $prev_blpg = (
int) $item[
"id"];
191 if ((
int) $item[
"id"] === $blog_page) {
201 $this->
ctrl->setParameterByClass(\ilBlogPostingGUI::class,
"blpg", (
string) $posting);
202 return $this->
ctrl->getLinkTargetByClass(\ilBlogPostingGUI::class, $cmd);
207 $this->
ctrl->setParameterByClass(\ilObjBlogGUI::class,
"bmn", $month);
208 return $this->
ctrl->getLinkTargetByClass(\ilObjBlogGUI::class,
"preview");
213 $toolbar = $this->gui->toolbar();
214 $f = $this->gui->ui()->factory();
216 foreach ($this->items as $month => $items) {
217 $label = $this->util->getMonthPresentation($month);
218 if ($month === $this->current_month) {
219 $label =
"» " . $label;
221 $m[] =
$f->link()->standard(
223 $this->getMonthTarget($month)
227 $toolbar->addStickyItem(
$f->dropdown()->standard($m)->withLabel(
228 $this->getDropdownLabel($this->util->getMonthPresentation($this->current_month))
238 foreach ($this->items as $month => $items) {
239 if ($month > $current_month) {
251 foreach ($this->items as $month => $items) {
252 if ($month < $current_month && $found ===
"") {
265 return key($this->items);
270 $this->renderNavButton(
"right", $href);
275 $this->renderNavButton(
"left", $href);
280 $toolbar = $this->gui->toolbar();
281 $b = $this->gui->ui()->factory()->button()->standard(
282 "<span class=\"glyphicon glyphicon-chevron-" . $dir .
" \" aria-hidden=\"true\"></span>",
286 $b =
$b->withUnavailableAction();
288 $toolbar->addStickyItem(
$b);
293 $toolbar = $this->gui->toolbar();
294 $f = $this->gui->ui()->factory();
297 foreach ($this->items as $month => $items) {
298 $label = $this->util->getMonthPresentation($month);
299 $m[] =
$f->button()->shy(
301 $this->getMonthTarget($month)
302 )->withUnavailableAction();
303 foreach ($items as $item) {
304 if (!$this->blog_access->isActive((
int) $item[
"id"])) {
307 $label = $item[
"title"];
308 if ((
int) $item[
"id"] === $this->blog_page) {
309 $label =
"» " . $label;
310 $dd_title = $item[
"title"];
312 $label = str_pad(
"", 12,
" ") . $label;
313 $m[] =
$f->link()->standard(
315 $this->getPostingTarget((
int) $item[
"id"], $cmd)
320 $toolbar->addStickyItem(
$f->dropdown()->standard($m)->withLabel(
321 $this->getDropdownLabel($dd_title)
328 return "<span style='vertical-align: bottom; max-width:60px; display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . $label .
"</span>";
getPreviousMonth( $current_month)
getNextPosting(int $blog_page)
renderNextButton(string $href="")
getPreviousPosting(int $blog_page)
PermissionManager $blog_access
renderActionDropdown(bool $single_posting)
getPostingTarget(int $posting, string $cmd)
__construct(InternalDomainService $domain, InternalGUIService $gui)
renderNavButton(string $dir, string $href="")
ILIAS Blog Presentation Util $util
renderPreviousButton(string $href="")
getDropdownLabel(string $label)
renderToolbarNavigation(PermissionManager $blog_acces, array $a_items, int $blog_page, bool $single_posting, $month, int $portfolio_page)
getNextMonth( $current_month)
getMonthTarget(string $month)
InternalDomainService $domain
renderPostingDropdown(string $cmd)