/** * Returns the list of all Band entities */ public function listAction() { if ($this->request->getFormat() === 'json') { $this->view->setVariablesToRender(['bands']); } $searchArr = []; if ($this->request->hasArgument('columns')) { $columns = $this->request->getArgument('columns'); foreach ($columns as $column) { if (!empty($column['data']) && !empty($column['search']['value'])) { $searchArr[$column['data']] = $column['search']['value']; } } } if ($this->request->hasArgument('order')) { $order = $this->request->getArgument('order'); if (!empty($order)) { $orderDir = $order[0]['dir']; $orderById = $order[0]['column']; if (!empty($orderById)) { $columns = $this->request->getArgument('columns'); $orderBy = $columns[$orderById]['data']; } } } if ($this->request->hasArgument('draw')) { $draw = $this->request->getArgument('draw'); } else { $draw = 0; } $start = $this->request->hasArgument('start') ? $this->request->getArgument('start') : self::start; $length = $this->request->hasArgument('length') ? $this->request->getArgument('length') : self::length; if (empty($searchArr)) { if (isset($orderBy) && !empty($orderBy) && (isset($orderDir) && !empty($orderDir))) { if ($orderDir === 'asc') { $orderArr = [$orderBy => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]; } elseif ($orderDir === 'desc') { $orderArr = [$orderBy => \TYPO3\Flow\Persistence\QueryInterface::ORDER_DESCENDING]; } } if (isset($orderArr) && !empty($orderArr)) { $orderings = $orderArr; } else { $orderings = ['sortierung' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]; } $bands = $this->bandRepository->getCertainNumberOfBand($start, $length, $orderings); $recordsTotal = $this->bandRepository->getNumberOfEntries(); } else { if (isset($orderBy) && !empty($orderBy) && (isset($orderDir) && !empty($orderDir))) { if ($orderDir === 'asc') { $orderArr = [$orderBy, 'ASC']; } elseif ($orderDir === 'desc') { $orderArr = [$orderBy, 'DESC']; } } if (isset($orderArr) && !empty($orderArr)) { $orderings = $orderArr; } else { $orderings = ['sortierung', 'ASC']; } $bands = $this->bandRepository->searchCertainNumberOfBand($start, $length, $orderings, $searchArr, 1); $recordsFiltered = $this->bandRepository->searchCertainNumberOfBand($start, $length, $orderings, $searchArr, 2); $recordsTotal = $this->bandRepository->getNumberOfEntries(); } if (!isset($recordsFiltered)) { $recordsFiltered = $recordsTotal; } $bandArr = []; foreach ($bands as $k => $band) { if (is_object($band)) { $uUID = $band->getUUID(); if (!empty($uUID)) { $bandArr[$k]['uUID'] = $uUID; } else { $bandArr[$k]['uUID'] = ''; } $nummer = $band->getNummer(); if (!empty($nummer)) { $bandArr[$k]['nummer'] = $nummer; } else { $bandArr[$k]['nummer'] = ''; } $titel = $band->getTitel(); if (!empty($titel)) { $bandArr[$k]['titel'] = $titel; } else { $bandArr[$k]['titel'] = ''; } $kurztitel = $band->getKurztitel(); if (!empty($kurztitel)) { $bandArr[$k]['kurztitel'] = $kurztitel; } else { $bandArr[$k]['kurztitel'] = ''; } $sortierung = $band->getSortierung(); if (!empty($sortierung)) { $bandArr[$k]['sortierung'] = $sortierung; } else { $bandArr[$k]['sortierung'] = ''; } $bistumObj = $band->getBistum(); if (is_object($bistumObj)) { $bistum = $bistumObj->getUUID(); if (!empty($bistum)) { $bandArr[$k]['bistum'] = $bistum; } else { $bandArr[$k]['bistum'] = ''; } } } } $this->view->assign('bands', ['data' => $bandArr, 'draw' => $draw, 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered]); $this->view->assign('bearbeiter', $this->bearbeiterObj->getBearbeiter()); return $this->view->render(); }