Browse Source

add new function with parameter

jabongwa 2 years ago
parent
commit
3ce79f391c
1 changed files with 17 additions and 2 deletions
  1. 17 2
      Classes/Controller/BackendController.php

+ 17 - 2
Classes/Controller/BackendController.php

@@ -137,7 +137,7 @@ class BackendController extends ActionController
 
   public function showLast30Action()
   {
-    $activePagesExpiredInlast30days = $this->activePageRepository->findExpiredRecordsInTheLast30Days();
+    $activePagesExpiredInlast30days = $this->activePageRepository->findExpiredRecordsInTheLast30OR90Days(30);
     $itemsperpage = $this->settings['itemsPerPage'] ?? 50;
 
     $pageObjectArray = [];
@@ -165,7 +165,7 @@ class BackendController extends ActionController
 
   public function showLast90Action()
   {
-    $activePagesExpiredInlast90days = $this->activePageRepository->findExpiredRecordsInTheLast90Days();
+    $activePagesExpiredInlast90days = $this->activePageRepository->findExpiredRecordsInTheLast30OR90Days(90);
     $itemsperpage = $this->settings['itemsPerPage'] ?? 50;
 
     $pageObjectArray = [];
@@ -204,6 +204,20 @@ class BackendController extends ActionController
     $totalNumberOfRecords = count($activePages);
 
     $cPage = $arrayPaginator->getCurrentPageNumber();
+    $controlleractionName = $this->request->getControllerActionName();
+    $actioName = '';
+
+    switch($controlleractionName) {
+      case 'index':
+        $actionName = 'index';
+        break;
+      case 'showLast30':
+        $actionName = 'showLast30';
+        break;
+      case 'showLast90':
+          $actionName = 'showLast90';
+          break;
+    }
 
     $this->view->assignMultiple(
       [
@@ -213,6 +227,7 @@ class BackendController extends ActionController
         'paginator' => $arrayPaginator,
         'paging' => $paging,
         'pages' => range(1, $paging->getLastPageNumber()),
+        'actionName' => $actionName
       ]
     );
   }