/** * Update a list of Orden entities */ public function updateListAction() { if ($this->request->hasArgument('data')) { $ordenlist = $this->request->getArgument('data'); } if (empty($ordenlist)) { $this->throwStatus(400, 'Required data arguemnts not provided', null); } foreach ($ordenlist as $uuid => $orden) { if (isset($uuid) && !empty($uuid)) { $ordenObj = $this->ordenRepository->findByIdentifier($uuid); $ordenObj->setOrden($orden['orden']); $ordenObj->setOrdo($orden['ordo']); $ordenObj->setSymbol($orden['symbol']); $ordenObj->setGraphik($orden['graphik']); $ordenstypUUID = $orden['ordenstyp']; $ordenstyp = $this->ordenstypRepository->findByIdentifier($ordenstypUUID); $ordenObj->setOrdenstyp($ordenstyp); } else { $this->throwStatus(400, 'Required uUID not provided', null); } $this->ordenRepository->update($ordenObj); } $this->persistenceManager->persistAll(); $this->throwStatus(200, null, null); }
/** * Update a list of Ordenstyp entities */ public function updateListAction() { if ($this->request->hasArgument('data')) { $ordenstyplist = $this->request->getArgument('data'); } if (empty($ordenstyplist)) { $this->throwStatus(400, 'Required data arguemnts not provided', null); } foreach ($ordenstyplist as $uuid => $ordenstyp) { $ordenstypObj = $this->ordenstypRepository->findByIdentifier($uuid); $ordenstypObj->setOrdenstyp($ordenstyp['ordenstyp']); $this->ordenstypRepository->update($ordenstypObj); } $this->persistenceManager->persistAll(); $this->throwStatus(200, null, null); }
/** * Import Orden table into the FLOW domain_model tabel subugoe_germaniasacra_domain_model_orden * @return int */ public function importOrdenAction() { if ($this->logger) { $start = microtime(true); } /** @var \Doctrine\DBAL\Connection $sqlConnection */ $sqlConnection = $this->entityManager->getConnection(); $sql = 'SELECT * FROM Orden'; $ordens = $sqlConnection->fetchAll($sql); $ordenstypArr = []; if (isset($ordens) and is_array($ordens)) { $nOrden = 0; foreach ($ordens as $ordenvalue) { $uid = $ordenvalue['ID_Ordo']; $orden = $ordenvalue['Ordensbezeichnung']; $ordo = $ordenvalue['Ordo']; $symbol = $ordenvalue['Symbol']; $graphik = null; if (isset($ordenvalue['Grafikdatei']) && !empty($ordenvalue['Grafikdatei'])) { $graphik = $ordenvalue['Grafikdatei']; } $ordenstyp = $ordenvalue['Geschlecht']; $gnd = $ordenvalue['GND_Orden']; $wikipedia = $ordenvalue['Wikipedia_Orden']; if (empty($ordenstyp)) { $ordenstyp = 'unbekannt'; } if (!in_array($ordenstyp, $ordenstypArr)) { $ordenstypObject = new Ordenstyp(); $ordenstypObject->setOrdenstyp($ordenstyp); $this->ordenstypRepository->add($ordenstypObject); $this->persistenceManager->persistAll(); $ordenstypUUID = $ordenstypObject->getUUID(); } array_push($ordenstypArr, $ordenstyp); if (isset($ordenstypUUID) && !empty($ordenstypUUID)) { $ordenstypObject = $this->ordenstypRepository->findByIdentifier($ordenstypUUID); } else { $ordenstypObject = $this->ordenstypRepository->findOneByOrdenstyp($ordenstyp); } $ordenObject = new Orden(); $ordenObject->setUid($uid); $ordenObject->setOrden($orden); $ordenObject->setOrdo($ordo); $ordenObject->setSymbol($symbol); $ordenObject->setGraphik($graphik); $ordenObject->setOrdenstyp($ordenstypObject); $this->ordenRepository->add($ordenObject); $this->persistenceManager->persistAll(); unset($ordenstypUUID); $ordenUUID = $ordenObject->getUUID(); if (isset($gnd) && !empty($gnd)) { $gnd = str_replace("\t", " ", $gnd); $gnd = str_replace("http:// ", " ", $gnd); $gnd = str_replace(" http", ";http", $gnd); $gnd = str_replace(";", "#", $gnd); $gnds = explode("#", $gnd); if (isset($gnds) && is_array($gnds)) { $oldgnd = ""; foreach ($gnds as $gnd) { if (isset($gnd) && !empty($gnd)) { if ($gnd != $oldgnd) { $gnd = str_replace(" ", "", $gnd); $gnd = str_replace("# ", "", $gnd); $gndid = str_replace("http://d-nb.info/gnd/", "", $gnd); $gndbemerkung = $orden . " [" . $gndid . "]"; $urlObject = new Url(); $urlObject->setUrl($gnd); $urlObject->setBemerkung($gndbemerkung); $gndurltypObject = $this->urltypRepository->findOneByName('GND'); $urlObject->setUrltyp($gndurltypObject); $this->urlRepository->add($urlObject); $this->persistenceManager->persistAll(); $gndurlUUID = $urlObject->getUUID(); $oldgnd = $gnd; $ordenhasurlObject = new Ordenhasurl(); $ordenObject = $this->ordenRepository->findByIdentifier($ordenUUID); $ordenhasurlObject->setOrden($ordenObject); $gndurlObject = $this->urlRepository->findByIdentifier($gndurlUUID); $ordenhasurlObject->setUrl($gndurlObject); $this->ordenHasUrlRepository->add($ordenhasurlObject); $this->persistenceManager->persistAll(); } } } } } if (isset($wikipedia) && !empty($wikipedia)) { $wikipedia = str_replace("http:// ", " ", $wikipedia); $wikipedia = str_replace(";", "#", $wikipedia); $wikipedias = explode("#", $wikipedia); if (isset($wikipedias) && is_array($wikipedias)) { $oldwikipedia = ""; foreach ($wikipedias as $wikipedia) { if (isset($wikipedia) && !empty($wikipedia)) { if ($wikipedia != $oldwikipedia) { $wikipediabemerkung = str_replace("http://de.wikipedia.org/wiki/", "", $wikipedia); $wikipediabemerkung = str_replace("_", " ", $wikipediabemerkung); $wikipediabemerkung = rawurldecode($wikipediabemerkung); $urlObject = new Url(); $urlObject->setUrl($wikipedia); $urlObject->setBemerkung($wikipediabemerkung); $wikiurltypObject = $this->urltypRepository->findOneByName('Wikipedia'); $urlObject->setUrltyp($wikiurltypObject); $this->urlRepository->add($urlObject); $this->persistenceManager->persistAll(); $wikiurlUUID = $urlObject->getUUID(); $oldwikipedia = $wikipedia; $ordenhasurlObject = new Ordenhasurl(); $ordenObject = $this->ordenRepository->findByIdentifier($ordenUUID); $ordenhasurlObject->setOrden($ordenObject); $wikiurlObject = $this->urlRepository->findByIdentifier($wikiurlUUID); $ordenhasurlObject->setUrl($wikiurlObject); $this->ordenHasUrlRepository->add($ordenhasurlObject); $this->persistenceManager->persistAll(); } } } } } $nOrden++; } if ($this->logger) { $end = microtime(true); $time = number_format($end - $start, 2); $this->logger->log('Orden import completed in ' . round($time / 60, 2) . ' minutes.'); } return $nOrden; } }
/** * Return the options to fill the select fields in Kloster edit form * @FLOW\SkipCsrfProtection * @return array $response select options as JSON */ public function getOptionsAction() { // Bearbeitungsstatus data $bearbeitungsstatusArr = []; $this->bearbeitungsstatusRepository->setDefaultOrderings(['name' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $bearbeitungsstatuses = $this->bearbeitungsstatusRepository->findAll(); foreach ($bearbeitungsstatuses as $bearbeitungsstatus) { $bearbeitungsstatusArr[$bearbeitungsstatus->getUUID()] = $bearbeitungsstatus->getName(); } // Personallistenstatus data $personallistenstatusArr = []; $personallistenstatuses = $this->personallistenstatusRepository->findAll(); foreach ($personallistenstatuses as $personallistenstatus) { $personallistenstatusArr[$personallistenstatus->getUUID()] = $personallistenstatus->getName(); } // Band data $bandArr = []; $this->bandRepository->setDefaultOrderings(['sortierung' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $bands = $this->bandRepository->findAll(); foreach ($bands as $band) { $bandNummerTitel = $band->getNummer() . '-' . $band->getTitel(); $bandArr[$band->getUUID()] = $bandNummerTitel; } // Literature data for select box $literaturArr = $this->getLiteraturAction(); // Bistum data for select box $bistumArr = []; $this->bistumRepository->setDefaultOrderings(['bistum' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $bistums = $this->bistumRepository->findAll(); foreach ($bistums as $bistum) { if ($bistum->getBistum() != 'keine Angabe') { $bistumArr[$bistum->getUUID()] = $bistum->getBistum(); } else { $bistumArr[$bistum->getUUID()] = '––'; } } // Orden data for select box $ordenArr = []; $this->ordenRepository->setDefaultOrderings(['orden' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $ordens = $this->ordenRepository->findAll(); foreach ($ordens as $orden) { $ordenArr[$orden->getUUID()] = $orden->getOrden(); } // Ordenstyp data for select box $ordenstypArr = []; $this->ordenstypRepository->setDefaultOrderings(['ordenstyp' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $ordenstyps = $this->ordenstypRepository->findAll(); foreach ($ordenstyps as $ordenstyp) { $ordenstypArr[$ordenstyp->getUUID()] = $ordenstyp->getOrdenstyp(); } // Klosterstatus data for select box $klosterstatusArr = []; $this->klosterstatusRepository->setDefaultOrderings(['status' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $klosterstatuses = $this->klosterstatusRepository->findAll(); foreach ($klosterstatuses as $klosterstatus) { if ($klosterstatus->getStatus() != 'keine Angabe') { $klosterstatusArr[$klosterstatus->getUUID()] = $klosterstatus->getStatus(); } else { $klosterstatusArr[$klosterstatus->getUUID()] = '––'; } } // Bearbeiter data for select box $bearbeiterArr = []; $this->bearbeiterRepository->setDefaultOrderings(['bearbeiter' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $bearbeiters = $this->bearbeiterRepository->findAll(); foreach ($bearbeiters as $bearbeiter) { $bearbeiterArr[$bearbeiter->getUUID()] = $bearbeiter->getBearbeiter(); } // URL-Typ data for select box $urltypArr = []; $this->urltypRepository->setDefaultOrderings(['name' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $urltyps = $this->urltypRepository->findAll(); foreach ($urltyps as $urltyp) { if ($urltyp->getName() != 'GND' && $urltyp->getName() != 'Wikipedia') { $urltypArr[$urltyp->getUUID()] = $urltyp->getName(); } } // Land data for select box $landArr = []; $this->landRepository->setDefaultOrderings(['land' => \TYPO3\Flow\Persistence\QueryInterface::ORDER_ASCENDING]); $lands = $this->landRepository->findAll(); foreach ($lands as $land) { $landArr[$land->getUUID()] = $land->getLand(); } // Bearbeiter roles $roleArr = []; foreach ($this->roleRepository->findAll()->toArray() as $role) { if (stristr($role->getIdentifier(), 'Flow.Login')) { $roleValues = explode(':', $role->getIdentifier()); $roleArr[$role->getIdentifier()] = $roleValues[1]; } } $response = []; $response['bearbeitungsstatus'] = $bearbeitungsstatusArr; $response['personallistenstatus'] = $personallistenstatusArr; $response['band'] = $bandArr; $response['literatur'] = $literaturArr; $response['bistum'] = $bistumArr; $response['orden'] = $ordenArr; $response['ordenstyp'] = $ordenstypArr; $response['klosterstatus'] = $klosterstatusArr; $response['bearbeiter'] = $bearbeiterArr; $response['url_typ'] = $urltypArr; $response['land'] = $landArr; $response['role'] = $roleArr; $getOptions = json_encode($response); return $getOptions; }