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(); }
public function __construct() { $this->setBaseDirectory(BASE_PATH); $this->setBaseUrl(BASE_URL); $this->setDefaultImage(\Sb\Helpers\BookHelper::getDefaultImage()); // Set context param user $userId = \Sb\Authentification\Service\AuthentificationSvc::getInstance()->getConnectedUserId(); if ($userId) { $user = \Sb\Db\Dao\UserDao::getInstance()->get($userId); $this->setConnectedUser($user); } }
public function get() { $tplBook = new \Sb\Templates\Template("pushedBooks/pushedBook"); // préparation des champs pour le template // Prepare variables $avgRating = $this->book->getAverageRating(); $roundedRating = floor($avgRating); $ratingCss = "rating-" . $roundedRating; $viewBookLink = \Sb\Helpers\HTTPHelper::Link($this->book->getLink()); $img = \Sb\Helpers\BookHelper::getMediumImageTag($this->book, $this->defImg); $bookTitle = $this->book->getTitle(); $bookDescription = \Sb\Helpers\StringHelper::tronque($this->book->getDescription(), 250); $bookPublication = $this->book->getPublicationInfo(); $bookAuthors = ""; if ($this->book->getContributors()) { $bookAuthors = sprintf("Auteur(s) : %s", $this->book->getOrderableContributors()); } $nbRatings = $this->book->getNbRatedUserBooks(); $nbBlowOfHearts = $this->book->getNbOfBlowOfHearts(); // Set variables $tplBook->setVariables(array("averageRating" => round($avgRating, 2), "ratingCss" => $ratingCss, "isBlowOfHeart" => $this->boh, "nbBlowOfHearts" => $nbBlowOfHearts, "roundedRating" => $roundedRating, "bookTitle" => $bookTitle, "bookDescription" => $bookDescription, "bookPublication" => $bookPublication, "bookAuthors" => $bookAuthors, "viewBookLink" => $viewBookLink, "image" => $img, "nbRatings" => $nbRatings)); return $tplBook->output(); }
public function get() { $tplBook = new \Sb\Templates\Template("pushedUserBooks/pushedUserBook"); // Prepare variables $rating = $this->userBook->getRating(); $boh = $this->userBook->getIsBlowOfHeart(); $ratingCss = "rating-" . $rating; $viewBookLink = \Sb\Helpers\HTTPHelper::Link($this->book->getLink()); $img = \Sb\Helpers\BookHelper::getMediumImageTag($this->book, $this->defImg); $bookTitle = $this->book->getTitle(); $bookDescription = mb_substr($this->book->getDescription(), 0, 250, "utf-8") . "..."; $bookPublication = $this->book->getPublicationInfo(); if ($this->book->getContributors()) { $bookAuthors = sprintf(__("Auteur(s) : %s", "s1b"), $this->book->getOrderableContributors()); } if ($this->userBook->getReadingState()) { $readingStateLabel = $this->userBook->getReadingState()->getLabel(); } $isOwned = $this->userBook->getIsOwned(); $isWished = $this->userBook->getIsWished(); // Set variables $tplBook->setVariables(array("rating" => $rating, "ratingCss" => $ratingCss, "isBlowOfHeart" => $boh, "bookTitle" => $bookTitle, "bookDescription" => $bookDescription, "bookPublication" => $bookPublication, "bookAuthors" => $bookAuthors, "viewBookLink" => $viewBookLink, "image" => $img, "readingStateLabel" => $readingStateLabel, "isOwned" => $isOwned, "isWished" => $isWished, "showingConnectedUserBook" => $this->showingConnectedUserBook)); return $tplBook->output(); }
public function addFromPost(\Sb\Db\Model\User $user, \Sb\Config\Model\Config $config) { $bookForm = new \Sb\Form\Book($_POST); // Testing if book can be found in db by id $book = null; if ($bookForm->getId()) { $book = BookDao::getInstance()->get($bookForm->getId()); } // Testing if book can be found in db by isbn10, isbn13, asin if (!$book) { $book = BookDao::getInstance()->getOneByCodes($bookForm->getISBN10(), $bookForm->getISBN13(), $bookForm->getASIN()); } // Testing if we need to add the book first if (!$book) { // Getting book from POST $book = new \Sb\Db\Model\Book(); \Sb\Db\Mapping\BookMapper::map($book, $_POST, "book_"); // Completing Book data by calling google in needed if (!$book->IsComplete()) { \Sb\Helpers\BookHelper::completeInfos($book); } $book->setCreationDate(new \DateTime()); $book->setLastModificationDate(new \DateTime()); BookDao::getInstance()->add($book); // Updating the book in cache to make it available for adding a userbook on form (borrowfromfriends, etc...) \Sb\Cache\ZendFileCache::getInstance()->save($book, \Sb\Entity\Constants::BOOK_TO_ADD_PREFIX . session_id()); } if ($book) { return $this->addUserBook($book, $user, $config); } else { Trace::addItem("Erreur lors de l'ajout d'un livre"); return __("Une erreur s'est produite lors de l'ajout du libre", "s1b"); } }
function __construct() { $this->defImg = \Sb\Helpers\BookHelper::getDefaultImage(); }
public function get() { $globalContext = new \Sb\Context\Model\Context(); $tplEvent = new \Sb\Templates\Template("userEvents/userEvent"); $friend = $this->userEvent->getUser(); $friendImg = UserHelper::getSmallImageTag($friend); if ($friendImg == "") { $friendImg = UserHelper::getSmallImageTag($friend); } $friendName = $friend->getUserName(); $friendProfileLink = HTTPHelper::Link(Urls::USER_PROFILE, array("uid" => $friend->getId())); $userBookRelated = false; $friendRelated = false; // used for cases of new friend event $additionalContent = ""; $friendId = null; $friendFriendImg = null; $friendFriendProfileLink = null; switch ($this->userEvent->getType_id()) { case EventTypes::USERBOOK_ADD: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a ajouté un livre.", $friendProfileLink, $friendName); $userBookRelated = true; break; case EventTypes::USERBOOK_RATING_CHANGE: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $newRating = $this->userEvent->getNew_value(); $resume = sprintf("<div class=\"ue-rating-label\"><a href=\"%s\" class=\"link\">%s</a> a noté.</div> <div class=\"rating rating-" . $newRating . "\"></div>", $friendProfileLink, $friendName); $userBookRelated = true; break; case EventTypes::USERBOOK_BLOWOFHEART_CHANGE: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $isBoh = $this->userEvent->getNew_value(); $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a supprimé son coup de coeur.", $friendProfileLink, $friendName); if ($isBoh) { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a marqué comme coup de coeur.", $friendProfileLink, $friendName); } $userBookRelated = true; break; case EventTypes::USERBOOK_REVIEW_CHANGE: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $oldReview = $this->userEvent->getOld_value(); $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a modifié son commentaire.", $friendProfileLink, $friendName); if ($oldReview == "") { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a ajouté un commentaire.", $friendProfileLink, $friendName); } $additionalContent = StringHelper::tronque(strip_tags($this->userEvent->getNew_value()), 120); $userBookRelated = true; break; case EventTypes::USERBOOK_HYPERLINK_CHANGE: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $oldHyperLink = $this->userEvent->getOld_value(); $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a modifié son lien hypertexte.", $friendProfileLink, $friendName); if ($oldHyperLink == "") { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a ajouté un lien hypertexte.", $friendProfileLink, $friendName); } $hyperLink = "http://" . $this->userEvent->getNew_value(); $truncatedHyperLink = \Sb\Helpers\StringHelper::tronque($hyperLink, 100); $additionalContent = sprintf(__("<a href=\"%s\" target=\"_blank\" class=\"hyperlink link\" >%s</a>", "s1b"), $hyperLink, $truncatedHyperLink); $userBookRelated = true; break; case EventTypes::USERBOOK_READINGSTATE_CHANGE: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $newReadingSateId = $this->userEvent->getNew_value(); switch ($newReadingSateId) { case ReadingStates::NOTREAD: $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a marqué non lu.", $friendProfileLink, $friendName); break; case ReadingStates::READING: $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> lit actuellement.", $friendProfileLink, $friendName); break; case ReadingStates::READ: $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a lu.", $friendProfileLink, $friendName); break; } $userBookRelated = true; break; case EventTypes::USERBOOK_WISHEDSTATE_CHANGE: $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->get($this->userEvent->getItem_id()); $newWishedSateValue = $this->userEvent->getNew_value(); $oldWishedSateValue = $this->userEvent->getOld_value(); if ($newWishedSateValue) { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a marqué comme souhaité.", $friendProfileLink, $friendName); } elseif ($oldWishedSateValue) { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> ne souhaite plus.", $friendProfileLink, $friendName); } $userBookRelated = true; break; case EventTypes::USER_ADD_FRIEND: $friendNewFriendProfileLink = null; $newFriendId = $this->userEvent->getNew_value(); if ($this->getContext()->getConnectedUser() && $newFriendId == $this->getContext()->getConnectedUser()->getId()) { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> est ami avec moi.", $friendProfileLink, $friendName); $friendFriendImg = UserHelper::getXSmallImageTag($this->getContext()->getConnectedUser()); } else { $friendNewFriend = UserDao::getInstance()->get($newFriendId); $friendNewFriendProfileLink = HTTPHelper::Link(Urls::USER_PROFILE, array("uid" => $friendNewFriend->getId())); $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> est ami avec <a class=\"link\" href=\"%s\">%s</a>.", $friendProfileLink, $friendName, $friendNewFriendProfileLink, $friendNewFriend->getUserName()); $friendFriendImg = UserHelper::getXSmallImageTag($friendNewFriend); } $friendId = $newFriendId; $friendFriendProfileLink = $friendNewFriendProfileLink; $friendRelated = true; break; case EventTypes::USER_BORROW_USERBOOK: $lendingId = $this->userEvent->getNew_value(); $lending = LendingDao::getInstance()->get($lendingId); $userBookBorrowed = $lending->getUserBook(); $userBook = $userBookBorrowed; $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a emprunté le livre à %s.", $friendProfileLink, $friendName, $userBookBorrowed->getUser()->getUserName()); if ($this->getContext()->getConnectedUser()) { if ($userBookBorrowed->getUser()->getId() == $this->getContext()->getConnectedUser()->getId()) { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> m'a emprunté le livre.", $friendProfileLink, $friendName); } } $userBookRelated = true; break; case EventTypes::USER_LEND_USERBOOK: $lendingId = $this->userEvent->getNew_value(); $lending = LendingDao::getInstance()->get($lendingId); $userBookLended = $lending->getBorrower_UserBook(); $userBook = $userBookLended; $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> a prêté le livre à %s.", $friendProfileLink, $friendName, $userBookLended->getUser()->getUserName()); if ($this->getContext()->getConnectedUser()) { if ($userBookLended->getUser()->getId() == $this->getContext()->getConnectedUser()->getId()) { $resume = sprintf("<a href=\"%s\" class=\"link\">%s</a> m'a prêté le livre.", $friendProfileLink, $friendName); } } $userBookRelated = true; break; default: break; } $creationDate = $this->userEvent->getCreation_date()->format(__("d/m/Y à H:m", "s1b")); $bookImageUrl = null; $bookLink = null; $bookTitle = null; $bookAuthor = null; $bookId = null; $bookImgTag = null; if ($userBookRelated) { $bookImageUrl = $userBook->getBook()->getSmallImageUrl(); $bookImgTag = BookHelper::getSmallImageTag($userBook->getBook(), $this->getContext()->getDefaultImage()); $bookLink = HTTPHelper::Link($userBook->getBook()->getLink()); $bookTitle = $userBook->getBook()->getTitle(); $bookAuthor = $userBook->getBook()->getOrderableContributors(); $bookId = $userBook->getBook()->getId(); } $showAddButton = false; if ($globalContext->getConnectedUser()) { $showAddButton = true; } // Set variables $tplEvent->setVariables(array("friendImg" => $friendImg, "friendName" => $friendName, "resume" => $resume, "bookImageUrl" => $bookImageUrl, "bookImgTag" => $bookImgTag, "friendProfileLink" => $friendProfileLink, "friendId" => $friendId, "bookTitle" => $bookTitle, "bookId" => $bookId, "bookAuthor" => $bookAuthor, "creationDate" => $creationDate, "bookLink" => $bookLink, "additionalContent" => $additionalContent, "userBookRelated" => $userBookRelated, "userFriendRelated" => $friendRelated, "friendFriendImg" => $friendFriendImg, "friendFriendProfileLink" => $friendFriendProfileLink, "showOwner" => $this->showOwner, "showAddButton" => $showAddButton)); return $tplEvent->output(); }
public function get() { $tpl = new \Sb\Templates\Template("book"); $isInLibrary = false; $averageRating = $this->book->getAverageRating(); $ratingCss = null; if ($averageRating) { $ratingCss = "rating-" . floor($averageRating); } $nbRatings = $this->book->getNbRatedUserBooks(); $rating = null; $isBlowOfHeart = null; $readingStateLabel = null; $lendingText = null; $lendingLink = null; $editBookLink = null; $recommandLink = null; $owned = null; $requestBorrowLink = null; // testing if book is view while a user is connected if ($this->getContext()->getConnectedUser()) { $isConnected = true; // testing if the connected user has the book and if some additionnal informations can be shown $userBook = \Sb\Db\Dao\UserBookDao::getInstance()->getByBookIdAndUserId($this->getContext()->getConnectedUser()->getId(), $this->book->getId()); if ($userBook && !$userBook->getIs_deleted()) { $isInLibrary = true; $rating = $userBook->getRating(); $isBlowOfHeart = $userBook->getIsBlowOfHeart(); if ($userBook->getReadingState()) { $readingStateLabel = $userBook->getReadingState()->getLabel(); } if ($rating) { $ratingCss = "rating-" . $rating; } $lendingLink = ""; if ($userBook->getIsOwned()) { $lendingLink = HTTPHelper::Link(Urls::LENDING_EDIT, array("ubid" => $userBook->getId())); } $lendingText = __("Prêter à un ami", "s1b"); if ($userBook->getActiveLending()) { $lendingText = __("Prêt", "s1b"); } $editBookLink = HTTPHelper::Link(Urls::USER_BOOK_EDIT, array("ubid" => $userBook->getId())); $owned = $userBook->getIsOwned(); $requestBorrowLink = ""; $recommandLink = HTTPHelper::Link(Urls::USER_MAILBOX_RECOMMAND, array("id" => $this->book->getId())); } else { $requestBorrowLink = HTTPHelper::Link(\Sb\Entity\Urls::USER_BOOK_BORROW_FROM_FRIENDS, array("bid" => $this->book->getId())); } } else { $isConnected = false; } $image = \Sb\Helpers\BookHelper::getMediumImageTag($this->book, $this->defImg, true); $bookTitle = $this->book->getTitle(); $bookDescription = $this->book->getDescription(); $bookPublication = $this->book->getPublicationInfo(); $bookAuthors = $this->book->getOrderableContributors(); $titleEsc = ""; $authorEsc = ""; $isbn10 = ""; $isbn13 = ""; $asin = ""; $id = ""; $smallImg = ""; $img = ""; $largeImg = ""; $pubEsc = ""; $pubDtStr = ""; $amazonUrl = ""; $booksUsersAlsoLikedShelf = ""; $booksWithSameTagsShelf = ""; $descEsc = ""; if ($this->addHiddenFields) { $titleEsc = urlencode($this->book->getTitle()); // encodé $authorEsc = urlencode($this->book->getOrderableContributors()); // encodé $id = $this->book->getId(); $isbn10 = $this->book->getISBN10(); $isbn13 = $this->book->getISBN13(); $asin = $this->book->getASIN(); $descEsc = urlencode($this->book->getDescription()); // encodé $smallImg = $this->book->getSmallImageUrl(); $img = $this->book->getImageUrl(); $largeImg = $this->book->getLargeImageUrl(); if ($this->book->getPublisher()) { $pubEsc = urlencode($this->book->getPublisher()->getName()); } // encodé $pubDtStr = ""; if ($this->book->getPublishingDate()) { $pubDtStr = $this->book->getPublishingDate()->format("Y-m-d H:i:s"); } $amazonUrl = $this->book->getAmazonUrl(); } // book reviews $reviews = ""; $nbOfReviewsPerPage = 5; if ($this->reviewedUserBooks) { $paginatedList = new \Sb\Lists\PaginatedList($this->reviewedUserBooks, $nbOfReviewsPerPage); $reviewsView = new \Sb\View\BookReviews($paginatedList, $this->book->getId()); $reviews = $reviewsView->get(); } if ($this->addRecommendations) { // Books users also liked $booksUsersAlsoLikedShelf = ""; if ($this->booksAlsoLiked && count($this->booksAlsoLiked) > 0) { $booksUsersAlsoLikedShelfView = new BookShelf($this->booksAlsoLiked, __("<strong>Les membres</strong> qui ont lu ce livre <strong>ont aussi aimé</strong>", "s1b")); $booksUsersAlsoLikedShelf = $booksUsersAlsoLikedShelfView->get(); } // Books with same tags $booksWithSameTagsShelf = ""; if ($this->booksWithSameTags && count($this->booksWithSameTags) > 0) { $booksWithSameTagsShelfView = new BookShelf($this->booksWithSameTags, __("Les livres <strong>dans la même catégorie</strong>", "s1b")); $booksWithSameTagsShelf = $booksWithSameTagsShelfView->get(); } } $tpl->setVariables(array("isConnected" => $isConnected, "isInLibrary" => $isInLibrary, "rating" => $rating, "nbRatings" => $nbRatings, "averageRating" => $averageRating, "isBlowOfHeart" => $isBlowOfHeart, "readingStateLabel" => $readingStateLabel, "ratingCss" => $ratingCss, "lendingText" => $lendingText, "lendingLink" => $lendingLink, "editBookLink" => $editBookLink, "requestBorrowLink" => $requestBorrowLink, "recommandLink" => $recommandLink, "image" => $image, "bookTitle" => $bookTitle, "bookDescription" => $bookDescription, "bookPublication" => $bookPublication, "bookAuthors" => $bookAuthors, "owned" => $owned, "addReviews" => $this->addReviews, "addButtons" => $this->addButtons, "reviews" => $reviews, "addHiddenFields" => $this->addHiddenFields, "titleEsc" => $titleEsc, "authorEsc" => $authorEsc, "id" => $id, "isbn10" => $isbn10, "isbn13" => $isbn13, "asin" => $asin, "descEsc" => $descEsc, "smallImg" => $smallImg, "img" => $img, "largeImg" => $largeImg, "pubEsc" => $pubEsc, "pubDtStr" => $pubDtStr, "amazonUrl" => $amazonUrl, "isInForm" => $this->isInForm, "booksUsersAlsoLikedShelf" => $booksUsersAlsoLikedShelf, "booksWithSameTagsShelf" => $booksWithSameTagsShelf)); return $tpl->output(); }
/** * Store book to add in cache and redirect to correct page */ public function prepareAddAction() { try { $globalContext = new \Sb\Context\Model\Context(); // checking if book is already in DB $isBookInDb = false; $bookInUserLib = false; if ($globalContext->getIsShowingFriendLibrary()) { Flash::addItem(__("Vous ne pouvez pas ajouter un livre à la bibliothèque d'un ami.", "s1b")); } $destination = HTTPHelper::Link(Urls::USER_BOOK_ADD_CHOICE, null, false, false); if (ArrayHelper::getSafeFromArray($_POST, Constants::BORROW_FROM_FRIENDS, null)) { $destination = HTTPHelper::Link(Urls::USER_BOOK_BORROW_FROM_FRIENDS, null, false, false); } // Remove book to add in cache ZendFileCache::getInstance()->remove(Constants::BOOK_TO_ADD_PREFIX . session_id()); // Get Book from POST $book = new Book(); BookMapper::map($book, $_POST, "book_"); if ($book->getId()) { $isBookInDb = true; } else { $bookInDb = BookDao::getInstance()->getOneByCodes($book->getISBN10(), $book->getISBN13(), $book->getASIN()); if ($bookInDb) { $isBookInDb = true; $book = $bookInDb; } } // Si le livre existe déjà en base // Vérification de l'existence du livre pour l'utilisateur // et si oui redirection vers la page d'édition if ($isBookInDb) { $userBook = UserBookDao::getInstance()->getByBookIdAndUserId($globalContext->getConnectedUser()->getId(), $book->getId()); if ($userBook && !$userBook->getIs_deleted()) { $bookInUserLib = true; // If the user is trying to borrow the book we display a flash message if (ArrayHelper::getSafeFromArray($_POST, Constants::BORROW_FROM_FRIENDS, null)) { Flash::addItem(__("Vous avez déjà ce livre dans votre bibliothèque.", "s1b")); } } } // On complète les infos qui manquent éventuellement if (!$book->IsComplete()) { Trace::addItem('Requêtage de Google.'); BookHelper::completeInfos($book); } if (!$book->IsValid()) { Flash::addItem('Il manque certaines données pour ajouter ce livre à notre base de données.'); HTTPHelper::redirectToReferer(); } else { ZendFileCache::getInstance()->save($book, Constants::BOOK_TO_ADD_PREFIX . session_id()); } if ($isBookInDb) { if ($bookInUserLib) { HTTPHelper::redirectToUrl(HTTPHelper::Link($book->getLink())); } else { HTTPHelper::redirectToUrl($destination); } } else { HTTPHelper::redirectToUrl($destination); } } 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"); } }