public function get() { $tpl = new Template("chronicleDetail"); // Get Social networks bar $imageUrlToPin = null; $textToPin = $this->chronicleViewModel->getTitle(); if ($this->chronicleViewModel->getChronicleHasBook()) { $imageUrlToPin = $this->chronicleViewModel->getBook()->getLargeImageUrl(); } $socialNetworksBar = new SocialNetworksBar($imageUrlToPin, $textToPin, $this->request); $tpl->setVariables(array("chronicle" => $this->chronicleViewModel, "socialNetworksBar" => $socialNetworksBar->get())); return $tpl->output(); }
/** * Action showing a book description */ public function indexAction() { try { $globalContext = new \Sb\Context\Model\Context(); $bookId = $this->_getParam('bid'); if (!$bookId) { $this->getResponse()->setHttpResponseCode(404); $this->forward("error", "error", "default"); return; } // Get book page /* @var $bookPage BookPage */ $bookPage = BookPageSvc::getInstance()->get($bookId); if (!$bookPage) { $this->getResponse()->setHttpResponseCode(404); $this->forward("error", "error", "default"); return; } // Add and js files $this->view->placeholder('footer')->append("<script src=\"" . $globalContext->getBaseUrl() . 'Resources/js/waterwheel-carousel/jquery.waterwheelCarousel.min.js' . "\"></script>\n"); $this->view->placeholder('footer')->append("<script>\$(function () {initCoverFlip('sameAuthorBooks', 30)});</script>\n"); // Get book view and add it to view model $bookView = new BookView($bookPage->getBook(), true, true, true, $bookPage->getBooksAlsoLiked(), $bookPage->getBooksWithSameTags(), $bookPage->getReviewedUserBooks(), false, true); $this->view->bookView = $bookView; // Get book buttonbar and add it to view model $buttonsBar = new ButtonsBar(false); $this->view->buttonsBar = $buttonsBar; // Get Books with same contributors and add it to view model $this->view->sameAuthorBooks = $bookPage->getBooksWithSameAuthor(); // We pass ASIN code to be used by amazon url builder widget $this->view->bookAsin = $bookPage->getBook()->getASIN(); // Get fnac buy link and add it to view model $this->view->buyOnFnacLink = null; if ($bookPage->getBook()->getISBN13()) { $this->view->buyOnFnacLink = 'http://clic.reussissonsensemble.fr/click.asp?ref=751772&site=14485&type=text&tnb=3&diurl=http%3A%2F%2Feultech.fnac.com%2Fdynclick%2Ffnac%2F%3Feseg-name%3DaffilieID%26eseg-item%3D%24ref%24%26eaf-publisher%3DAFFILINET%26eaf-name%3Dg%3Fn%3Frique%26eaf-creative%3D%24affmt%24%26eaf-creativetype%3D%24affmn%24%26eurl%3Dhttp%253A%252F%252Frecherche.fnac.com%252FSearchResult%252FResultList.aspx%253FSCat%253D0%2525211%2526Search%253D' . $bookPage->getBook()->getISBN13() . '%2526Origin%253Daffilinet%2524ref%2524'; } // Get social network bar and add it to view model $socialBar = new SocialNetworksBar($bookPage->getBook()->getLargeImageUrl(), $bookPage->getBook()->getTitle(), $this->getRequest()); $this->view->socialBar = $socialBar->get(); // Get ad and add it to view model $ad = new Ad("bibliotheque", "1223994660"); $this->view->ad = $ad; // Get Header Information and add it to view model $headerInformation = HeaderInformationSvc::getInstance()->get($bookPage->getBook()); $this->view->tagTitle = $headerInformation->getTitle(); $this->view->metaDescription = $headerInformation->getDescription(); $this->view->metaKeywords = $headerInformation->getKeywords(); $this->view->urlCanonical = $headerInformation->getUrlCanonical(); $this->view->pageImage = $headerInformation->getPageImage(); // Get last read userbooks for the book and add it to view model $this->view->lastlyReadUserbooks = $bookPage->getLastlyReadUserbooks(); if (count($this->view->lastlyReadUserbooks) > 1) { $this->view->placeholder('footer')->append("<script src=\"" . $globalContext->getBaseUrl() . 'Resources/js/simple-carousel/simple.carousel.js' . "\"></script>\n"); $this->view->placeholder('footer')->append("<script>\$(function() {initCarousel('carousel-lastUsersWhoReadThatBook', 298, 85)});</script>\n"); } // Get chronicles and add it to view model $this->view->chronicles = $this->getChronicleView($bookPage->getRelatedChronicles()); // Get video press review associated to book $this->view->placeholder('footer')->append("<script src=\"" . $globalContext->getBaseUrl() . 'Resources/js/waterwheel-carousel/jquery.waterwheelCarousel.min.js' . "\"></script>\n"); $this->view->placeholder('footer')->append("<script>\$(function () {initCoverFlip('sameAuthorBooks', 30)});</script>\n"); $video = $bookPage->getVideoPressReview(); if ($video) { $this->view->videoUrl = $video->getLink(); } // // Get book press reviews $bookPressReviews = $bookPage->getPressReviews(); if ($bookPressReviews) { $bookPressReviewsView = new BookPressReviews($bookPressReviews); $this->view->pressReviews = $bookPressReviewsView->get(); } } catch (\Exception $exc) { Trace::addItem(sprintf("Une erreur s'est produite dans \"%s->%s\", TRACE : %s\"", get_class(), __FUNCTION__, $exc->getTraceAsString())); $this->forward("error", "error", "default"); } }