/**
  * Homepage controller
  * @global type $globalContext
  */
 public function indexAction()
 {
     try {
         $globalContext = new \Sb\Context\Model\Context();
         $config = new Sb\Config\Model\Config();
         $this->view->placeholder('footer')->append("<script type=\"text/javascript\" src=\"" . BASE_URL . 'Resources/js/pressReviews.js?v=' . VERSION . "\"></script>");
         $this->view->placeholder('footer')->append("<script type=\"text/javascript\" src=\"" . BASE_URL . 'Resources/js/newsReader.js?v=' . VERSION . "\"></script>");
         $this->view->placeholder('footer')->append("<script type=\"text/javascript\" src=\"" . BASE_URL . 'Resources/js/content.js?v=' . VERSION . "\"></script>");
         $this->view->tagTitle = sprintf(__("%s : livre et littérature - tops | coups de cœur | critiques", "s1b"), \Sb\Entity\Constants::SITENAME);
         $this->view->metaDescription = __("Créez votre bibliothèque, partagez vos livres et coups de cœur avec la communauté de lecteurs et offrez le bon livre sans risque de doublon", "s1b");
         $this->view->metaKeywords = "BD|bibliotheque|commentaires|communaute|lecteurs|critiques|livres|emprunt|littérature|livre|notice|partage|policier|polar|prêt|recommandation|roman|thriller";
         $this->view->subscribeLink = HTTPHelper::Link(Urls::SUBSCRIBE);
         if ($config->getIsProduction()) {
             $facebookFrame = new FacebookFrame();
             $this->view->faceBookFrame = $facebookFrame->get();
             $ad = new Ad("user_login", "0457389056");
             $this->view->ad = $ad->get();
             $twitter = new TwitterWidget(TwitterSvc::getInstance($config));
             $this->view->twitter = $twitter->get();
             $googlePlus = new GooglePlus();
             $this->view->googlePlus = $googlePlus->get();
         }
         $this->view->placeholder('footer')->append("<script src=\"" . $globalContext->getBaseUrl() . 'Resources/js/simple-carousel/simple.carousel.js' . "\"></script>");
         $this->view->placeholder('footer')->append("<script>\$(function() {initCarousel('carousel-items', 980, 340)});</script>");
         // Getting wish list search widget
         $wishListSearchWidget = new WishListSearchWidget();
         $this->view->wishListSearchWidget = $wishListSearchWidget->get();
         // Set chronicles (last one, last from any groups except bloggers and bookstore, last from bloggers, last from bookstores)
         $this->setViewChronicles();
         // Getting last rated books cover flip
         $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('lastRatedBooks', 30)});</script>\n");
         $lastRatedBooks = BookSvc::getInstance()->getLastRatedBookForHomePage();
         $lastRatedCoverFlip = new BookCoverFlip($lastRatedBooks, __("Derniers livres notés", "s1b"), "lastRatedBooks", "");
         $this->view->lastRatedCoverFlip = $lastRatedCoverFlip->get();
         //             // Get last reviews
         //             $lastReviews = UserEventSvc::getInstance()->getLastEventsOfType(EventTypes::USERBOOK_REVIEW_CHANGE);
         //             $lastReviewsView = new LastReviews($lastReviews, __("Dernières critiques postées", "s1b"));
         //             $this->view->lastReviews = $lastReviewsView->get();
         // Press reviews subscription widget
         $pressReviewsSubscriptionWidget = new PressReviewsSubscriptionWidget();
         $this->view->pressReviewsSubscriptionWidget = $pressReviewsSubscriptionWidget->get();
         // Newsreader
         $pressReviews = $this->getNewsReaderPressReviews();
         if ($pressReviews) {
             $newsReader = new NewsReader($pressReviews);
             $this->view->newsReader = $newsReader->get();
         }
     } catch (\Exception $e) {
         Trace::addItem(sprintf("Une erreur s'est produite dans \"%s->%s\", TRACE : %s\"", get_class(), __FUNCTION__, $e->getTraceAsString()));
         $this->forward("error", "error", "default");
     }
 }
 private function addCommonListItemsToModelView($pageNumber, $tagId, $searchTerm, $pressReviews, $pressReviewTypeId)
 {
     if (!$pageNumber) {
         $pageNumber = 1;
     }
     //
     // Add press review list to model view
     $pressReviewsPaginated = $this->getPressReviewsPaginated($pressReviews, $pageNumber, $pressReviewTypeId == PressReviewTypes::ARTICLE ? 10 : 5);
     $pagesPressReviews = $pressReviewsPaginated->getItems();
     $this->view->pressReviews = $pagesPressReviews;
     // Get tags and add it to model view
     $tags = TagSvc::getInstance()->getTagsForPressReviews();
     // Add reinit url to model view
     switch ($pressReviewTypeId) {
         case PressReviewTypes::ARTICLE:
             $initUrl = $this->view->url(array(), 'articlePressReviews');
             $searchLabel = __("Rechercher un article", "s1b");
             break;
         case PressReviewTypes::VIDEO:
             $initUrl = $this->view->url(array(), 'videoPressReviews');
             $searchLabel = __("Rechercher une vidéo", "s1b");
             break;
     }
     // Get search content form and add it to model view
     $contentSearch = new ContentSearch("/default/press-review/search", $tags, $tagId, $searchLabel, $pressReviewTypeId, $searchTerm, $initUrl);
     $this->view->contentSearch = $contentSearch->get();
     // Get press review subscription module and add it to view model
     $pressReviewSubscriptionWidget = new PressReviewsSubscriptionWidget();
     $this->view->pressReviewSubscriptionWidget = $pressReviewSubscriptionWidget->get();
     // Add navigation bar to view model
     $this->view->navigationBar = $pressReviewsPaginated->getNavigationBar();
     // Get ad and add it to view model
     $ad = new Ad("", "");
     $this->view->ad = $ad->get();
     // Get chronicles for right column widget and add to view model
     $chroniclesTitle = "";
     $chronicles = null;
     if ($tagId) {
         $chroniclesTitle = __("<strong>Chroniques</strong> dans la même catégorie", "s1b");
         $chronicles = ChronicleSvc::getInstance()->getChroniclesWithTags(array($tagId), 5);
     } else {
         $chroniclesTitle = __("Dernières chroniques", "s1b");
         $chronicles = ChronicleSvc::getInstance()->getLastChronicles(5);
     }
     if (count($chronicles) > 0) {
         $chronicleAdapter = new ChronicleListAdapter();
         $chronicleAdapter->setChronicles($chronicles);
         $chroniclesView = new ChroniclesBlock($chronicleAdapter->getAsChronicleViewModelLightList(), $chroniclesTitle);
         $this->view->chroniclesView = $chroniclesView->get();
     }
     // Get books with press reviews for right column
     $this->view->placeholder('footer')->append("<script src=\"" . BASE_URL . 'Resources/js/waterwheel-carousel/jquery.waterwheelCarousel.min.js' . "\"></script>\n");
     $this->view->placeholder('footer')->append("<script>\$(function () {initCoverFlip('booksWithPressReviews', 30)});</script>\n");
     $books = BookSvc::getInstance()->getListWithPressReviews(15);
     $booksCoverFlip = new BookCoverFlip($books, __("Les livres dont parlent <strong>les médias</strong>", "s1b"), "booksWithPressReviews", "");
     $this->view->booksCoverFlip = $booksCoverFlip->get();
     // Add SEO (title, meta description and keywords)
     $routeName = Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName();
     $headerInformation = HeaderInformationSvc::getInstance()->getByRouteName($routeName);
     $this->view->tagTitle = $headerInformation->getTitle();
     $this->view->metaDescription = $headerInformation->getDescription();
     $this->view->metaKeywords = $headerInformation->getKeywords();
 }
 /**
  * Add common items to all actions in model view
  */
 private function addCommonItemsToModelView()
 {
     // Get ad and add it to model view
     $ad = new Ad("", "");
     $this->view->ad = $ad->get();
     // Get press reviews subscription widget and add it to view model
     $pressReviewsSubscriptionWidget = new PressReviewsSubscriptionWidget();
     $this->view->pressReviewsSubscriptionWidget = $pressReviewsSubscriptionWidget->get();
     // Newsreader
     $criteria = array("type" => array(false, "=", PressReviewTypes::ARTICLE), "is_validated" => array(false, "=", 1));
     $pressReviews = PressReviewSvc::getInstance()->getList($criteria, 50);
     if ($pressReviews) {
         $newsReader = new NewsReader($pressReviews);
         $this->view->newsReader = $newsReader->get();
     }
 }