/** * 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); } }
/** * @param string $bearing * @param string $headerType * @param string $decimalSeperator * @param string $thousandsSeperator * @param string $strNew * @param string $headerLink * @return string */ public function render(\Winkel\WinkelProducts\Domain\Model\Bearing $bearing = null, $headerType = '', $decimalSeperator = ',', $thousandsSeperator = '.', $strNew = 'NEW!', $headerLink = null) { /* * <f:if condition="{f:format.date(date: 'now', format: 'U')} < {f:format.date(date: '{bearing.newUntil}', format: 'U')}"> <span class="label-new">' . $strNew . '</span> </f:if> */ if ($bearing->getNewUntil() != null) { $newUntil = date_format($bearing->getNewUntil(), 'U'); if (date('U') < $newUntil) { $new = '<span class="list-new">' . $strNew . '</span> '; } else { $new = ''; } } else { $new = ''; } if ($headerLink != null) { $headerLinkArray[0] = '<a href=' . $headerLink . ' onClick="_gaq.push([\'_trackEvent\', \'Form\', \'click\', \'' . $bearing->getTitleShow() . '\']);">'; $headerLinkArray[1] = '</a>'; } else { $headerLinkArray[0] = ''; $headerLinkArray[1] = ''; } // todo check $str $str = '</div>' . $headerLinkArray[0] . '<div class="diameter">'; $str .= $new . $headerType . ': ' . $bearing->getTitleShow() . ' | <span class="diasign">Ø ' . number_format($bearing->getBearingDiameter(), 1, $decimalSeperator, $thousandsSeperator) . 'mm</span>'; if ($bearing->getLoadCapacityFRkN() != '') { $str .= ' | <span class="red">F<sub>R</sub> kN</span>: ' . number_format($bearing->getLoadCapacityFRkN(), 2, $decimalSeperator, $thousandsSeperator); } if ($bearing->getLoadCapacityFAkN() != '') { $str .= ' | <span class="red">F<sub>A</sub> kN</span>: ' . number_format($bearing->getLoadCapacityFAkN(), 2, $decimalSeperator, $thousandsSeperator); } if ($bearing->getLoadCapacityC() != '') { $str .= ' | <span class="red">C kN</span>: ' . number_format($bearing->getLoadCapacityC(), 1, $decimalSeperator, $thousandsSeperator); } if ($bearing->getLoadCapacityCo() != '') { $str .= ' | <span class="red">C<sub>O</sub> kN</span>: ' . number_format($bearing->getLoadCapacityCo(), 1, $decimalSeperator, $thousandsSeperator); } $str .= '</div>' . $headerLinkArray[1] . '<div class="clearfix borlist p5 fz0">'; if ($bearing->getType() != $GLOBALS['previousBearing']) { $GLOBALS['previousBearing'] = $bearing->getType(); return $str; } else { return ''; } }