Skip to content

Commit

Permalink
Add pagination to more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
okmiim committed Aug 6, 2022
1 parent 5aacf29 commit 8d26b8d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
25 changes: 20 additions & 5 deletions Classes/Controller/CalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,11 @@ public function yearAction($year = null)
return $this->return404Page();
}

$indices = $this->indexRepository->findYear((int)$date->format('Y'));

$this->eventExtendedAssignMultiple([
'indices' => $this->indexRepository->findYear((int)$date->format('Y')),
'indices' => $indices,
'pagination' => $this->getPagination($indices),
'date' => $date,
], __CLASS__, __FUNCTION__);
}
Expand All @@ -371,8 +374,11 @@ public function quarterAction(int $year = null, int $quarter = null)
return $this->return404Page();
}

$indices = $this->indexRepository->findQuarter((int)$date->format('Y'), $quarter);

$this->eventExtendedAssignMultiple([
'indices' => $this->indexRepository->findQuarter((int)$date->format('Y'), $quarter),
'indices' => $indices,
'pagination' => $this->getPagination($indices),
'date' => $date,
'quarter' => $quarter,
], __CLASS__, __FUNCTION__);
Expand Down Expand Up @@ -400,11 +406,14 @@ public function monthAction($year = null, $month = null, $day = null)
return $this->return404Page();
}

$indices = $this->indexRepository->findMonth((int)$date->format('Y'), (int)$date->format('n'));

$this->eventExtendedAssignMultiple([
'date' => $date,
'selectDay' => $useCurrentDate,
'ignoreSelectedDay' => !$useCurrentDate,
'indices' => $this->indexRepository->findMonth((int)$date->format('Y'), (int)$date->format('n')),
'indices' => $indices,
'pagination' => $this->getPagination($indices),
], __CLASS__, __FUNCTION__);
}

Expand Down Expand Up @@ -442,9 +451,12 @@ public function weekAction(?int $year = null, ?int $week = null)
'+6 days' => 1,
];

$indices = $this->indexRepository->findWeek($year, $week, $weekStart);

$this->eventExtendedAssignMultiple([
'firstDay' => $firstDay,
'indices' => $this->indexRepository->findWeek($year, $week, $weekStart),
'indices' => $indices,
'pagination' => $this->getPagination($indices),
'weekConfiguration' => $weekConfiguration,
], __CLASS__, __FUNCTION__);
}
Expand Down Expand Up @@ -473,8 +485,11 @@ public function dayAction($year = null, $month = null, $day = null)
$next = clone $date;
$next->modify('+1 day');

$indices = $this->indexRepository->findDay((int)$date->format('Y'), (int)$date->format('n'), (int)$date->format('j'));

$this->eventExtendedAssignMultiple([
'indices' => $this->indexRepository->findDay((int)$date->format('Y'), (int)$date->format('n'), (int)$date->format('j')),
'indices' => $indices,
'pagination' => $this->getPagination($indices),
'today' => $date,
'previous' => $previous,
'next' => $next,
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Templates/Calendar/Month.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<f:layout name="Default" />

<f:section name="Main">
<f:render partial="Month" arguments="{date:date,indices:indices,contentObject:contentObject, ignoreSelectedDay:ignoreSelectedDay}" />
<f:render partial="Month" arguments="{date:date,indices:indices,contentObject:contentObject, ignoreSelectedDay:ignoreSelectedDay, pagination: pagination}" />
</f:section>
</div>
2 changes: 1 addition & 1 deletion Resources/Private/Templates/Calendar/Year.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<tr>
<c:loop.monthsInYear date="{date}" iteration="year">
<td>
<f:render partial="Month" arguments="{date: year.calendar.date, indices:indices, ignoreSelectedDay: year.calendar.ignoreSelectedDay, contentObject: contentObject}" />
<f:render partial="Month" arguments="{date: year.calendar.date, indices:indices, ignoreSelectedDay: year.calendar.ignoreSelectedDay, contentObject: contentObject, pagination: pagination}" />
</td>
{f:if(condition: '{year.calendar.break3} == 0', then: '</tr><tr>')}
</c:loop.monthsInYear>
Expand Down

0 comments on commit 8d26b8d

Please sign in to comment.