コード例 #1
0
 /**
  * action werkstattAuswahl
  * 
  * @return void
  */
 public function werkstattAuswahlAction()
 {
     $this->view->assign('werkstattlistenUeberschrift', 'Suchergebnis');
     $this->view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('typo3conf/ext/werkstattsuche/Resources/Private/Templates/Werkstatt/List.html'));
     $bezirke = $this->bezirkRepository->findAll();
     $this->view->assign('bezirke', $bezirke);
     $produkteDienstleistungens = $this->produkteDienstleistungenRepository->findAll();
     $this->view->assign('produkteDienstleistungens', $produkteDienstleistungens);
     // /** @var $logger \TYPO3\CMS\Core\Log\Logger */
     //$logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger(__CLASS__);
     $bezirkArray = $this->request->getArgument('bezirk');
     $angebotArray = $this->request->getArgument('angebot');
     //$logger->info('werkstattAuswahlAction: Bezirke ', $bezirkArray);
     //$logger->info('werkstattAuswahlAction: Angebote', $angebotArray);
     /*
      * Validierung
      */
     $inputOk = true;
     if (is_array($bezirkArray) and is_array($angebotArray)) {
         foreach ($bezirkArray as $bezirkArrayId) {
             if (!is_numeric($bezirkArrayId)) {
                 $inputOk = false;
             } else {
                 $bezirkArrayId *= 1;
                 if (!is_int($bezirkArrayId)) {
                     $inputOk = false;
                 }
             }
         }
         foreach ($angebotArray as $angebotArrayId) {
             if (!is_numeric($angebotArrayId)) {
                 $inputOk = false;
             } else {
                 $angebotArrayId *= 1;
                 if (!is_int($angebotArrayId)) {
                     $inputOk = false;
                 }
             }
         }
     }
     if ($inputOk) {
         $bezirks = array();
         foreach ($bezirkArray as $bezirkArrayId) {
             $bezirk = $this->bezirkRepository->findByUid($bezirkArrayId);
             if (!is_null($bezirk)) {
                 $bezirks[] = $bezirk;
             }
         }
         $angebots = array();
         foreach ($angebotArray as $angebotArrayId) {
             $angebot = $this->produkteDienstleistungenRepository->findByUid($angebotArrayId);
             if (!is_null($angebot)) {
                 $angebots[] = $angebot;
             }
         }
         $werkstatts = array();
         //assuming, that there is small number of $werkstatts
         $werkstatts_all = $this->werkstattRepository->findAll();
         foreach ($werkstatts_all as $werkstatt) {
             //$x = array($werkstatts_all,$werkstatt);
             //$logger->info('werkstattAuswahlAction: $werkstatt ', $x);
             $angebot_found = false;
             $bezirk_found = false;
             foreach ($werkstatt->getProdukteDienstleistungen() as $angebot) {
                 if (in_array($angebot, $angebots)) {
                     $angebot_found = true;
                 }
             }
             foreach ($werkstatt->getBezirke() as $bezirk) {
                 if (in_array($bezirk, $bezirks)) {
                     $bezirk_found = true;
                 }
             }
             if (count($angebots) == 0 and count($bezirks) > 0) {
                 $angebot_found = true;
             }
             if (count($bezirks) == 0 and count($angebots) > 0) {
                 $bezirk_found = true;
             }
             if ($angebot_found and $bezirk_found) {
                 $werkstatts[] = $werkstatt;
             }
         }
         $this->view->assign('werkstatts', $werkstatts);
     } else {
         $werkstatts = $this->werkstattRepository->findAll();
         $this->view->assign('werkstatts', $werkstatts);
     }
 }
コード例 #2
0
 /**
  * action delete
  * 
  * @param \Fakturaberlin\Werkstattsuche\Domain\Model\Bezirk $bezirk
  * @return void
  */
 public function deleteAction(\Fakturaberlin\Werkstattsuche\Domain\Model\Bezirk $bezirk)
 {
     $this->addFlashMessage('The object was deleted. Please be aware that this action is publicly accessible unless you implement an access check. See <a href="http://wiki.typo3.org/T3Doc/Extension_Builder/Using_the_Extension_Builder#1._Model_the_domain" target="_blank">Wiki</a>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
     $this->bezirkRepository->remove($bezirk);
     $this->redirect('list');
 }