public function get()
 {
     $tpl = new Template("pushedChronicle");
     $chronicleAdpater = new ChronicleAdapter($this->chronicle);
     $tpl->setVariables(array("chronicle" => $chronicleAdpater->getAsChronicleViewModel()));
     return $tpl->output();
 }
 public function get()
 {
     $tplBook = new Template("wishedUserBook");
     // Prepare variables
     $viewBookLink = HTTPHelper::Link($this->book->getLink());
     $img = BookHelper::getSmallImageTag($this->book, $this->defImg);
     $bookTitle = $this->book->getTitle();
     $bookAuthors = "";
     if ($this->book->getContributors()) {
         $bookAuthors = sprintf("Auteur(s) : %s", $this->book->getOrderableContributors());
     }
     $isOffered = $this->userbook->getActiveGiftRelated() != null;
     $offerer = null;
     $deactivateGiftOptionLink = "";
     if ($isOffered) {
         $deactivateGiftOptionLink = HTTPHelper::Link(Urls::USERBOOK_GIFT_DISABLE, array("ubgid" => $this->userbook->getActiveGiftRelated()->getId()));
         $offerer = $this->userbook->getActiveGiftRelated()->getOfferer();
     }
     $bookDescription = $this->book->getDescription();
     $buyOnAmazonLink = $this->book->getAmazonUrl();
     $buyOnFnacLink = null;
     if ($this->book->getISBN13()) {
         $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' . $this->book->getISBN13() . '%2526Origin%253Daffilinet%2524ref%2524';
     }
     $setAsOfferedLink = HTTPHelper::Link(Urls::WISHED_USERBOOK_SET_AS_OFFERED, array("ubid" => $this->userbook->getId()));
     $subscribeLink = HTTPHelper::Link(Urls::SUBSCRIBE);
     // Set variables
     $tplBook->setVariables(array("bookTitle" => $bookTitle, "bookAuthors" => $bookAuthors, "viewBookLink" => $viewBookLink, "image" => $img, "isOffered" => $isOffered, "buyOnAmazonLink" => $buyOnAmazonLink, "buyOnFnacLink" => $buyOnFnacLink, "offerer" => $offerer, "setAsOfferedLink" => $setAsOfferedLink, "subscribeLink" => $subscribeLink, "deactivateGiftOptionLink" => $deactivateGiftOptionLink, "isConnected" => $this->getContext()->getConnectedUser()));
     return $tplBook->output();
 }
Beispiel #3
0
 public function get()
 {
     $tpl = new Template("bookCoverFlip");
     // Set variables
     $tpl->setVariables(array("books" => $this->books, "title" => $this->title, "defaultImage" => $this->getContext()->getDefaultImage(), "coverFlipId" => $this->coverFlipId, "css" => $this->css));
     return $tpl->output();
 }
Beispiel #4
0
 public function get()
 {
     $tpl = new Template("bookShelf");
     // Set variables
     $tpl->setVariables(array("books" => $this->books, "title" => $this->title, "defaultImage" => $this->getContext()->getDefaultImage()));
     return $tpl->output();
 }
 public function get()
 {
     $server = $this->request->getServer();
     $currentPage = "http://" . $server['HTTP_HOST'] . $server['REQUEST_URI'];
     $tpl = new Template("socialNetworksBar");
     $tpl->setVariables(array("imageUrlToPin" => $this->imageUrlToPin, "textToPin" => $this->textToPin, 'currentPage' => $currentPage));
     return $tpl->output();
 }
 public function get()
 {
     $baseTpl = "components/createChroniclesLinks";
     $tpl = new Template($baseTpl);
     $params = array();
     $params["groupUsers"] = $this->groupUsers;
     $tpl->setVariables($params);
     return $tpl->output();
 }
 public function get()
 {
     $baseTpl = "components/pressReviewsSubscriptionWidget";
     $tpl = new Template($baseTpl);
     $form = new PressReviewsSusbcriptionForm();
     $params = array("form" => $form);
     $tpl->setVariables($params);
     return $tpl->output();
 }
 public function get()
 {
     $baseTpl = "components/wishListSearchWidget";
     $tpl = new Template($baseTpl);
     $form = new WishListSearchForm();
     $params = array("form" => $form);
     $tpl->setVariables($params);
     return $tpl->output();
 }
 public function get()
 {
     $baseTpl = "components/autoPromoWishlistWidget";
     $tpl = new Template($baseTpl);
     $autoPromoWishListLink = HTTPHelper::Link(Urls::USER_FRIENDS_WISHLIST);
     $autoPromoWishListImage = $this->getContext()->getBaseUrl() . "Resources/images/homepage/auto-promo-wishlist.png";
     $autoPromoWishListTitle = __("Offrez un livre à vos amis", "s1b");
     $tpl->setVariables(array("autoPromoWishListTitle" => $autoPromoWishListTitle, "autoPromoWishListLink" => $autoPromoWishListLink, "autoPromoWishListImage" => $autoPromoWishListImage));
     return $tpl->output();
 }
Beispiel #10
0
 public function get()
 {
     $baseTpl = "components/userLastEvents";
     $tpl = new Template($baseTpl);
     $params = array();
     $params["events"] = $this->events;
     $params["user"] = $this->user;
     $tpl->setVariables($params);
     return $tpl->output();
 }
 public function get()
 {
     $baseTpl = "components/userWishedBooksWidget";
     $tpl = new Template($baseTpl);
     $params = array();
     $wishedBooks = UserBookDao::getInstance()->getListWishedBooks($this->user->getId(), -1, false);
     $params["wishedBooks"] = $wishedBooks;
     $params["isCurrentConnectedUser"] = $this->isCurrentConnectedUser;
     $params["user"] = $this->user;
     $params["defImage"] = $this->defImg;
     $tpl->setVariables($params);
     return $tpl->output();
 }
Beispiel #12
0
 public function get()
 {
     $tpl = new Template("components/searchForm");
     $formAction = HTTPHelper::Link(Urls::BOOK_SEARCH_SUBMIT);
     $searchTermDef = "Titre, auteur, ISBN";
     $searchTerm = ArrayHelper::getSafeFromArray($_REQUEST, "searchTerm", $searchTermDef);
     $isConnected = false;
     if ($this->getContext()->getConnectedUser()) {
         $isConnected = true;
     }
     $tpl->setVariables(array("formAction" => $formAction, "searchTerm" => $searchTerm, "searchTermDef" => $searchTermDef, "isConnected" => $isConnected, "showSearchTermDef" => $this->showSearchTermDef));
     return $tpl->output();
 }
 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();
 }
Beispiel #14
0
 public function get()
 {
     $baseTpl = "book/bookForm/lending";
     // Préparation de l'historique des prêts
     // ----------------------------------------------
     $activeLending = null;
     $lendingLines = array();
     foreach ($this->lendings as $lending) {
         // Si le prêt est encore actif, la ligne n'est pas affichée dans l'historique
         if ($lending->getState() != \Sb\Lending\Model\LendingState::IN_ACTIVE) {
             $activeLending = $lending;
         } else {
             $lendingLineTpl = new \Sb\Templates\Template($baseTpl . "/inActiveLendingLine");
             $lendingLineTpl->set("borrowerName", $lending->getBorrower_userbook()->getUser()->getFirstName() . " " . $lending->getBorrower_userbook()->getUser()->getLastName());
             $lendingLineTpl->set("startDate", $lending->getStartDate()->format(__("d/m/Y", "s1b")));
             $lendingLineTpl->set("endDate", $lending->getEndDate()->format(__("d/m/Y", "s1b")));
             $lendingLines[] = $lendingLineTpl;
         }
     }
     $lendingsHisto = new \Sb\Templates\Template($baseTpl . "/lendingsHisto");
     // Si les lignes d'historiques en sont pas nulles, affichage sous forme de liste
     if ($lendingLines) {
         $lendingLinesTpl = \Sb\Templates\Template::merge($lendingLines);
         $lendingsHisto->set("histo", "<ul>" . $lendingLinesTpl . "</ul>");
     } else {
         // Sinon affichage d'un libellé "vide" ou "aucun"
         $lendingsHisto->set("histo", __("aucun", "s1b"));
     }
     return $lendingsHisto->output();
 }
Beispiel #15
0
 public function get()
 {
     $globalContext = \Sb\Context\Model\Context::getInstance();
     $tplHeader = new Template("header");
     $baseUrl = Urls::USER_LIBRARY;
     if ($globalContext->getIsShowingFriendLibrary()) {
         $baseUrl = Urls::FRIEND_LIBRARY;
     }
     $variables = array("allBooksUrl" => HTTPHelper::Link($baseUrl, array("key" => LibraryListKeys::ALL_BOOKS_KEY, "reset" => 1)), "borrowedBooksUrl" => HTTPHelper::Link($baseUrl, array("key" => LibraryListKeys::BORROWED_BOOKS_KEY, "reset" => 1)), "lendedBooksUrl" => HTTPHelper::Link($baseUrl, array("key" => LibraryListKeys::LENDED_BOOKS_KEY, "reset" => 1)), "wishedBooksUrl" => HTTPHelper::Link($baseUrl, array("key" => LibraryListKeys::WISHED_BOOKS_KEY, "reset" => 1)), "myBooksUrl" => HTTPHelper::Link($baseUrl, array("key" => LibraryListKeys::MY_BOOKS_KEY, "reset" => 1)), "friendLibrary" => false);
     if ($globalContext->getIsShowingFriendLibrary()) {
         $friend = UserDao::getInstance()->get($this->friendUserId);
         $variables["friendLibrary"] = true;
         $variables["friendUserName"] = $friend->getFirstName();
     }
     $tplHeader->setVariables($variables);
     $this->setActiveTab($tplHeader, $this->key);
     return $tplHeader->output();
 }
Beispiel #16
0
 public function get()
 {
     $lineIdx = 0;
     $userBooks = $this->shownResults;
     $booksTemplates = array();
     if ($userBooks) {
         $i = 0;
         foreach ($userBooks as $userBook) {
             $i++;
             $addSep = true;
             if ($i == 1) {
                 $addSep = false;
             }
             //$book = new \Sb\Db\Model\Book;
             $book = $userBook->getBook();
             // Get row template
             $rowTpl = new \Sb\Templates\Template("bookList/bookTableRow");
             $pictos = \Sb\Helpers\UserBookHelper::getStatusPictos($userBook, $this->friendLibrary);
             $rowTpl->set("pictos", $pictos);
             $cssClass = $lineIdx % 2 ? "lineA" : "lineB";
             $rowTpl->set("cssClass", $cssClass);
             $img = "";
             if ($book->getSmallImageUrl()) {
                 $img = sprintf("<img src = '%s' class = 'image-thumb-small'/>", $book->getSmallImageUrl());
             } else {
                 $img = sprintf("<img src = '%s' border = '0' class = 'image-thumb-small'/>", $this->defImg);
             }
             $rowTpl->set("img", $img);
             $rowTpl->set("title", $book->getTitle());
             if ($book->getPublisher()) {
                 $rowTpl->set("publicationInfo", $book->getPublicationInfo());
             } else {
                 $rowTpl->set("publicationInfo", "");
             }
             $rowTpl->set("author", $book->getOrderableContributors());
             $status = "";
             if ($userBook->getReadingState()) {
                 $status = $userBook->getReadingState()->getLabel();
             }
             $readingStateSvc = \Sb\Db\Service\ReadingStateSvc::getInstance();
             $readState = $readingStateSvc->getReadSate();
             if ($userBook->getReadingState() && $userBook->getReadingState()->getId() == $readState->getId()) {
                 if ($userBook->getReadingDate()) {
                     $status = sprintf(__("%s le %s", "s1b"), $status, $userBook->getReadingDate()->format(__("d/m/Y", "s1b")));
                 }
             }
             $rowTpl->set("status", $status);
             $rating = $userBook->getRating();
             if ($rating || $rating == 0) {
                 $ratingCssClass = "rating-" . $rating;
                 $rowTpl->set("ratingCssClass", "stars " . $ratingCssClass);
             } else {
                 $rowTpl->set("ratingCssClass", "");
             }
             if ($userBook->getIsBlowOfHeart()) {
                 $rowTpl->set("bohCssClass", "boh");
             } else {
                 $rowTpl->set("bohCssClass", "");
             }
             $editLink = HTTPHelper::Link(Urls::USER_BOOK_EDIT, array("ubid" => $userBook->getId()));
             $deleteLink = HTTPHelper::Link(Urls::USER_BOOK_DELETE, array("ubid" => $userBook->getId()));
             $viewLink = HTTPHelper::Link($book->getLink());
             // Showing "Borrow this book" link only if:
             // - friend ownes the book
             // - book is not lent
             $borrowLink = null;
             if ($this->friendLibrary && $userBook->getIsOwned() && !$userBook->getActiveLending()) {
                 $borrowLink = \Sb\Helpers\HTTPHelper::Link(Urls::USER_BOOK_BORROW, array("ubid" => $userBook->getId()));
             }
             $rowTpl->setVariables(array("addSep" => $addSep, "friendLibrary" => $this->friendLibrary, "editLink" => $editLink, "deleteLink" => $deleteLink, "viewLink" => $viewLink, "borrowLink" => $borrowLink, "bookId" => $book->getId()));
             $booksTemplates[] = $rowTpl;
             $lineIdx++;
             unset($addSep);
             unset($book);
             unset($rowTpl);
             unset($pictos);
             unset($cssClass);
             unset($img);
             unset($status);
             unset($rating);
             unset($ratingCssClass);
             unset($editLink);
             unset($deleteLink);
             unset($viewLink);
             unset($borrowLink);
             unset($userBook);
         }
     }
     $bookListTpl = new \Sb\Templates\Template("bookList/bookTable");
     if ($booksTemplates) {
         // Get row header template
         $headerTpl = new \Sb\Templates\Template("bookList/bookTableHeader");
         // Assignation des classe pour afficher le petit picto indiquant le sens de tri
         if ($this->listOptions) {
             if ($this->listOptions->getSorting()) {
                 if ($this->listOptions->getSorting()->getField() == \Sb\Helpers\BooksHelper::SORTING_FIELD_AUTHOR) {
                     $headerTpl->set("titlesortingdirection", "");
                     $headerTpl->set("ratingsortingdirection", "");
                     $headerTpl->set("authorsortingdirection", $this->listOptions->getSorting()->getDirection());
                     $headerTpl->set("statesortingdirection", "");
                 }
                 if ($this->listOptions->getSorting()->getField() == \Sb\Helpers\BooksHelper::SORTING_FIELD_RATING) {
                     $headerTpl->set("titlesortingdirection", "");
                     $headerTpl->set("ratingsortingdirection", $this->listOptions->getSorting()->getDirection());
                     $headerTpl->set("authorsortingdirection", "");
                     $headerTpl->set("statesortingdirection", "");
                 }
                 if ($this->listOptions->getSorting()->getField() == \Sb\Helpers\BooksHelper::SORTING_FIELD_TITLE) {
                     $headerTpl->set("titlesortingdirection", $this->listOptions->getSorting()->getDirection());
                     $headerTpl->set("ratingsortingdirection", "");
                     $headerTpl->set("authorsortingdirection", "");
                     $headerTpl->set("statesortingdirection", "");
                 }
                 if ($this->listOptions->getSorting()->getField() == \Sb\Helpers\BooksHelper::SORTING_FIELD_STATE) {
                     $headerTpl->set("titlesortingdirection", "");
                     $headerTpl->set("ratingsortingdirection", "");
                     $headerTpl->set("authorsortingdirection", "");
                     $headerTpl->set("statesortingdirection", $this->listOptions->getSorting()->getDirection());
                 }
             }
         }
         $headerTpl->setVariables(array("friendLibrary" => $this->friendLibrary));
         $bookListTpl->set("tableHeader", $headerTpl->output());
         $booksToShow = \Sb\Templates\Template::merge($booksTemplates);
         $bookListTpl->set("booksToShow", $booksToShow);
         $links = $this->pagerLinks;
         $bookListTpl->set("links", $links['all']);
         $bookListTpl->set("first", $this->firstItemIdx);
         $bookListTpl->set("last", $this->lastItemIdx);
         $bookListTpl->set("nbItemsTot", $this->nbItemsTot);
         $listSearchDefValue = __("Un titre, un auteur, ISBN dans ma bibliothèque", "s1b");
         $bookListTpl->set("listSearchDefValue", $listSearchDefValue);
         if ($this->searchValue) {
             $bookListTpl->set("listSearchValue", $this->searchValue);
         } else {
             $bookListTpl->set("listSearchValue", $listSearchDefValue);
         }
         $key = \Sb\Helpers\ArrayHelper::getSafeFromArray($_GET, "key", null);
         $bookListTpl->set("key", $key);
         $selectedAuthorLetter = null;
         $selectedTitleLetter = null;
         $filtertype = \Sb\Helpers\ArrayHelper::getSafeFromArray($_GET, "filtertype", null);
         if ($filtertype == \Sb\Lists\FilteringType::AUTHOR_FIRST_LETTER) {
             $selectedAuthorLetter = \Sb\Helpers\ArrayHelper::getSafeFromArray($_GET, "filter", null);
         } elseif ($filtertype == \Sb\Lists\FilteringType::TITLE_FIRST_LETTER) {
             $selectedTitleLetter = \Sb\Helpers\ArrayHelper::getSafeFromArray($_GET, "filter", null);
         }
         $bookListTpl->setVariables(array("authorsFirstLetters" => $this->authorsFirstLetters, "titlesFirstLetters" => $this->titlesFirstLetters, "selectedTitleLetter" => $selectedTitleLetter, "selectedAuthorLetter" => $selectedAuthorLetter, "emptyList" => false));
     } else {
         $bookListTpl->setVariables(array("emptyList" => true));
     }
     return $bookListTpl->output();
 }
 public function get()
 {
     $tpl = new Template("bookPressReviews");
     $tpl->setVariables(array("pressReviews" => $this->pressReviews));
     return $tpl->output();
 }
 public function get()
 {
     $tpl = new Template("pushedChronicles");
     $tpl->setVariables(array("title" => $this->title, "chronicles" => $this->chronicles, "typeCSS" => $this->typeCSS, "link" => $this->link, "textLink" => $this->textLink));
     return $tpl->output();
 }
Beispiel #19
0
 /**
  * @return mixed|string
  */
 public function get()
 {
     $lineIdx = 0;
     foreach (array_values($this->shownResults) as $book) {
         $lineIdx++;
         $addSep = true;
         if ($lineIdx == 1) {
             $addSep = false;
         }
         $bk = $book;
         $language = urlencode($bk->getLanguage());
         if ($bk->getImageUrl()) {
             $imgSrc = $bk->getImageUrl();
         } else {
             $imgSrc = $this->defImg;
         }
         // Utilisation de urlencode à la place htmlspecialchars car ce dernier pose des pbs qd la valeur est ensuite passée en post
         $title = $bk->getTitle();
         $titleEsc = urlencode($bk->getTitle());
         // encodé
         $author = $bk->getOrderableContributors();
         $authorEsc = urlencode($bk->getOrderableContributors());
         // encodé
         $id = $bk->getId();
         $isbn10 = $bk->getISBN10();
         $isbn13 = $bk->getISBN13();
         $asin = $bk->getASIN();
         $desc = StringHelper::tronque($bk->getDescription(), 350);
         $descEsc = urlencode($bk->getDescription());
         // encodé
         $smallImg = $bk->getSmallImageUrl();
         $img = $bk->getImageUrl();
         $largeImg = $bk->getLargeImageUrl();
         $pubEsc = "";
         $pubInfo = "";
         if ($bk->getPublisher()) {
             $pubEsc = urlencode($bk->getPublisher()->getName());
             // encodé
             $pubInfo = $bk->getPublicationInfo();
         }
         $pubDtStr = "";
         if ($book->getPublishingDate()) {
             $pubDtStr = $book->getPublishingDate()->format("Y-m-d H:i:s");
         }
         $amazonUrl = $book->getAmazonUrl();
         $nbOfPages = $book->getNb_of_pages();
         $cssClass = $lineIdx % 2 ? "lineA" : "lineB";
         $viewBookLink = null;
         $bookInDB = false;
         if ($bk->getId()) {
             $viewBookLink = HTTPHelper::Link($bk->getLink());
             $bookInDB = true;
         }
         $resultTpl = new Template('searchBook/resultRow');
         $resultTpl->setVariables(array('addSep' => $addSep, 'viewBookLink' => $viewBookLink, 'bookInDB' => $bookInDB, 'cssClass' => $cssClass . ' ' . ($bookInDB ? 'indb' : ''), 'title' => $title, 'publisher' => $pubInfo, 'author' => $author, 'id' => $id, 'isbn10' => $isbn10, 'isbn13' => $isbn13, 'asin' => $asin, 'titleEsc' => $titleEsc, 'descEsc' => $descEsc, 'desc' => $desc, 'smallImg' => $smallImg, 'img' => $img, 'largeImg' => $largeImg, 'imgSrc' => $imgSrc, 'authorEsc' => $authorEsc, 'pubEsc' => $pubEsc, 'pubDtStr' => $pubDtStr, 'amazonUrl' => $amazonUrl, 'language' => $language, 'nbOfPages' => $nbOfPages));
         $resultTplArr[] = $resultTpl;
     }
     $results = Template::merge($resultTplArr);
     $resultsTpl = new Template('searchBook/results');
     $resultsTpl->set("resultRows", $results);
     $links = $this->pagerLinks;
     $resultsTpl->set("links", $links['all']);
     $resultsTpl->set("first", $this->firstItemIdx);
     $resultsTpl->set("last", $this->lastItemIdx);
     $resultsTpl->set("nbItemsTot", $this->nbItemsTot);
     return $resultsTpl->output();
 }
 private function showTableSummary($title, $books, \Sb\Context\Model\Context $context)
 {
     $tplRows = array();
     $idx = 0;
     foreach ($books as $book) {
         $idx++;
         $tplRow = new \Sb\Templates\Template("import/tableRow");
         $tplRow->set("isbn", $book->getISBN10());
         $tplRow->set("title", $book->getTitle());
         $tplRow->set("index", $idx);
         $tplRows[] = $tplRow;
     }
     $rows = \Sb\Templates\Template::merge($tplRows);
     $tpl = new \Sb\Templates\Template("import/table");
     $tpl->set("rows", $rows);
     $tpl->set("tableTitle", $title);
     return $tpl->output();
 }
 public function get()
 {
     $tpl = new Template("chroniclesBlock");
     $tpl->setVariables(array("chronicles" => $this->chronicles, "title" => $this->title));
     return $tpl->output();
 }
 public function get()
 {
     $tpl = new Template("otherChroniclesSameType");
     $tpl->setVariables(array("chronicles" => $this->chronicles, "title" => __("Chroniques similaires", "s1b")));
     return $tpl->output();
 }