/**
  * action delete
  *
  * @param $wiper
  * @return void
  */
 public function deleteAction(Wiper $wiper)
 {
     $this->wiperRepository->remove($wiper);
     $this->flashMessageContainer->add('Your Wiper was removed.');
     $this->redirect('list');
 }
 /**
  * action show
  *
  * @param \Winkel\WinkelProducts\Domain\Model\Bearing $bearing
  * @return void
  */
 public function showAction(\Winkel\WinkelProducts\Domain\Model\Bearing $bearing)
 {
     $this->view->assign('sysLanguageUid', $GLOBALS['TSFE']->sys_language_uid);
     $this->view->assign('languageKey', $GLOBALS['TSFE']->config['config']['language']);
     // Alle Anschraubplatten der Rolle auslesen
     $flangeplates = $bearing->getFlangePlates();
     $search = '';
     foreach ($flangeplates as $flangePlate) {
         $type = $flangePlate->getType();
         if (substr(strtoupper($type), -3) == 'LUB') {
             $search = $type;
         }
     }
     // Alle Wiper auslesen
     $wipers = $this->wiperRepository->findAll();
     $foundOne = FALSE;
     //debug($wipers->count(),'C Wipers');
     foreach ($wipers as $wiper) {
         //debug($wiper->getFlangePlate(), '$wiper');
         if ($foundOne === FALSE and $wiper->getFlangePlate() != NULL) {
             if ($search == $wiper->getFlangePlate()->getType()) {
                 $foundOne = TRUE;
                 $this->view->assign('wiper', $wiper);
             }
         }
     }
     $bearingGroupArray = $bearing->getBearingGroup();
     foreach ($bearingGroupArray as $value) {
         $bearingGroup = $value;
         $title = $bearing->getTitleShow() . ' ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts_domain_model_bearing.title-' . $bearingGroup->getUid(), $this->extensionName);
         #$bearingGroup->getTitle() .
         //				' ' .
         //				\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts_domain_model_bearing.type', $this->extensionName);
         #\Winkel\WinkelProducts\Domain\Model\bearings.title-
         $this->local_cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_cObj');
         $this->local_cObj->LOAD_REGISTER(array('wpTitle' => $title), '');
         $GLOBALS['TSFE']->page['title'] = $title;
         if ($_GET['debug'] == 1) {
             //				DebuggerUtility::var_dump($GLOBALS['TSFE']->fe_user);
             DebuggerUtility::var_dump($GLOBALS['TSFE']->loginUser, 'LoginUser');
             DebuggerUtility::var_dump($GLOBALS['TSFE']->fe_user->groupData, 'LoginGroup');
         }
         #debug($GLOBALS['TSFE']->page['title'],'$GLOBALS[TSFE]->title');
         #debug($GLOBALS['TSFE']->page,'page');
         #debug($GLOBALS['TSFE']->register,'Register');
     }
     // Related bearing
     $prBearing = $this->bearingRepository->findOneByTitleShow('PR ' . $bearing->getType());
     $this->view->assign('bearing', $bearing);
     // SEO descripton building
     $advantage = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts.seodescr_advantages_bearing_group-' . $bearingGroup->getUid(), 'winkel_products');
     if ($advantage != '') {
         $advantage = $advantage . '. ';
     }
     $GLOBALS['TSFE']->page['description'] = ' ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts_domain_model_bearing.title-' . $bearingGroup->getUid(), 'winkel_products') . '' . ' ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts_domain_model_bearing.type', 'winkel_products') . ': ' . $bearing->getTitleShow() . ', ' . $advantage . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts.seodescr_here_all_details_facts_winkel_bearing', 'winkel_products') . ' ' . $bearing->getTitleShow() . ' ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_winkelproducts.seodescr_find_here', 'winkel_products') . '.';
     #	debug($GLOBALS['TSFE']->page['description']);
     //		if($_GET['dev'] == 1) {
     //			DebuggerUtility::var_dump($bearingGroup, '$bearingGroup');
     //			DebuggerUtility::var_dump($GLOBALS['TSFE']->page['description'], 'descr');
     //
     //		}
     $this->view->assign('prBearing', $prBearing);
     $this->view->assign('bearingGroup', $bearingGroup);
     $this->view->assign('user', $GLOBALS['TSFE']->fe_user->user);
     $this->view->assign('fe_user', $GLOBALS['TSFE']->fe_user->user);
     // Blueprint
     $search = array(' ', '/', '[', ']', '+');
     $replace = array('_', '.', '', '', 'plus');
     $file = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT') . '/fileadmin/templates/2012/img/article/preview/' . str_replace($search, $replace, $bearing->getTitleShow()) . '_bp.jpg_preview.jpg';
     //		\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(file_exists($file), $file);
     if (file_exists($file)) {
         $this->view->assign('hasBlueprint', TRUE);
     } else {
         $this->view->assign('hasBlueprint', FALSE);
     }
 }