/**
  * Action called for unsubscription to press reviews
  */
 public function unsubscribeAction()
 {
     try {
         $email = $this->getParam("email", null);
         if (!$email) {
             Flash::addItem(__("Requête invalide", "s1b"));
         } else {
             $email = trim($email);
             /* @var $pressReviewsSubscriber PressReviewsSubscriber */
             $pressReviewsSubscriber = PressReviewsSubscriberDao::getInstance()->getByEmail($email);
             if ($pressReviewsSubscriber) {
                 // Mark the press review subscriber as deleted
                 $pressReviewsSubscriber->setIs_deleted(true);
                 PressReviewsSubscriberDao::getInstance()->update($pressReviewsSubscriber);
                 Flash::addItem(__("Votre désinscription a bien été pris en compte.", "s1b"));
             } else {
                 Flash::addItem(__("Il n'y a pas d'abonné correspondant à l'email fourni.", "s1b"));
             }
         }
         HTTPHelper::redirectToHome();
     } 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");
     }
 }
 public function disableAction()
 {
     $dest = HTTPHelper::getReferer() ? HTTPHelper::getReferer() : HTTPHelper::Link();
     $id = $this->_getParam('ubgid', -1);
     if ($id > 0) {
         // Getting the userbook gift item
         $userbookGift = UserBookGiftDao::getInstance()->get($id);
         if ($userbookGift) {
             // Checking if the connected user is the offerer
             $globalContext = new \Sb\Context\Model\Context();
             $connectedUser = $globalContext->getConnectedUser();
             if ($userbookGift->getOfferer()->getId() == $connectedUser->getId()) {
                 $userbookGift->setIs_active(false);
                 $userbookGift->setLast_modification_date(new \DateTime());
                 if (UserBookGiftDao::getInstance()->update($userbookGift)) {
                     Flash::addItem(__("L'option d'achat a été annulée correctement.", "s1b"));
                     $this->_redirect($dest);
                     exit;
                 }
             }
         }
     }
     Flash::addItem(__("une erreur s'est produite lors de l'anulation de l'option d'achat.", "s1b"));
     $this->_redirect($dest);
     exit;
 }
Пример #3
0
 public static function newCommentPosted($comment, $book)
 {
     $body = __("Bonjour<br/>Un commentaire a été posté sur la critique que vous avez émise sur le livre <a href=\"%s\">%s</a>.<br/><strong>Commentaire :</strong> %s<br/><br/><strong>L'équipe %s</strong>", "s1b");
     $body .= '<br/>' . self::getProfileEditSettingLine();
     $body = sprintf($body, HTTPHelper::Link($book->getLink()), $book->getTitle(), $comment, \Sb\Entity\Constants::SITENAME);
     return $body;
 }
Пример #4
0
 public function get()
 {
     $referer = HTTPHelper::getReferer();
     $tpl = new \Sb\Templates\Template("book/buttonsBar");
     $tpl->setVariables(array("buttonText" => $this->buttonText, "addButton" => $this->addButton, "referer" => $referer));
     return $tpl->output();
 }
 public function searchListAction()
 {
     // Check the form validity
     $form = new WishListSearchForm();
     if (!$form->isValid($_GET)) {
         Flash::addItems($form->getFailureMessages());
         HTTPHelper::redirectToReferer();
     } else {
         $searchTerm = $this->_getParam('wishedListSearchTerm', "");
         Trace::addItem($searchTerm);
         $users = UserDao::getInstance()->getListByKeywordAndWishedUserBooks($searchTerm);
         // Remove connected user and admin user
         $cleanedUsers = $this->cleanUsersList($users);
         // Display specific message when connected user found in list
         if ($this->connectedUSerFound) {
             Flash::addItem(__("Si vous cherchez votre liste, c'est raté ;-) La surprise n'en sera que plus grande.", "s1b"));
         }
         if (count($cleanedUsers) == 0) {
             // Getting user without wish list
             $usersWithoutWishList = UserDao::getInstance()->getListByKeyword($searchTerm);
             $cleanedUsersWithoutWishList = $this->cleanUsersList($usersWithoutWishList);
             if (count($cleanedUsersWithoutWishList) != 0) {
                 Flash::addItem(sprintf(__("Aucun utilisateur '%s' n'a créé de liste d'envies ou bien sa liste est privée.", "s1b"), $searchTerm));
             } else {
                 Flash::addItem(__("Aucun utilisateur ne correspond à votre recherche.", "s1b"));
             }
             HTTPHelper::redirectToReferer();
         }
         $this->view->users = $cleanedUsers;
         $this->view->form = $form;
     }
 }
Пример #6
0
 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();
 }
Пример #7
0
 /**
  * Check if a user is connected in session and otherwise set a flash message, persist request url in session and redirect to homepage
  */
 public function checkUserIsConnected()
 {
     if (!$this->getIsConnected()) {
         $_SESSION[\Sb\Entity\SessionKeys::RETURN_URL_AFTER_LOGIN] = $_SERVER["REQUEST_URI"];
         Flash::addItem(__("Vous devez être connecté pour accéder à cette page.", "s1b"));
         HTTPHelper::redirectToHome();
     }
 }
Пример #8
0
 /**
  * Get a HeaderInformation from a book object : used on book pages
  * @param \Sb\Service\Sb\Db\Model\Book $book a book object
  * @return \Sb\Model\HeaderInformation HeaderInformation object for book pages
  */
 public function get(Book $book)
 {
     try {
         $result = new HeaderInformation();
         // Set url canonical
         $result->setUrlCanonical(HTTPHelper::Link($book->getLink()));
         // Set title tag
         $publisherName = "";
         if ($book->getPublisher()) {
             $publisherName = $book->getPublisher()->getName();
         }
         //
         // Get if book is an ebook
         $bookIsEbook = !$book->getISBN10() && substr($book->getASIN(), 0, 1) == "B";
         // For tag title, maximum length recommended is 60
         $titlePrefix = "";
         if ($bookIsEbook) {
             $titlePrefix = "ebook ";
         }
         //
         $title = StringHelper::tronque(sprintf(__("%s de %s par %s", "s1b"), $book->getTitle(), $book->getOrderableContributors(), $publisherName), 60 - strlen("...") - strlen($titlePrefix));
         $title = $titlePrefix . $title;
         $result->setTitle($title);
         // Set description
         // For meta description, maximum length recommended is 160
         $descriptionSuffix = "";
         if ($bookIsEbook) {
             $descriptionSuffix = " | numérique";
         }
         //
         $description = StringHelper::tronque($book->getDescription(), 160 - strlen("...") - strlen($descriptionSuffix));
         $description .= $descriptionSuffix;
         // Remove double quotes
         $result->setDescription(str_replace("\"", "", $description));
         // Set keywords
         // Get 2 first tags for keywords
         $bookTags = TagSvc::getInstance()->getTagsForBooks(array($book));
         $tags = "";
         if ($bookTags && count($bookTags) > 0) {
             $firstTags = array_slice($bookTags, 0, 5);
             $firstTagNames = array_map(array(&$this, "getTagName"), $firstTags);
             $tags = implode(" | ", $firstTagNames);
         }
         $keywords = sprintf(__("%s | %s | %s", "s1b"), $book->getTitle(), $book->getOrderableContributors(), $publisherName);
         if ($tags != "") {
             $keywords = sprintf(__("%s | %s | %s | %s", "s1b"), $book->getTitle(), $book->getOrderableContributors(), $publisherName, $tags);
         }
         //
         // Remove double quotes
         $keywords = str_replace("\"", "", $keywords);
         $result->setKeywords($keywords);
         // Set page image
         $result->setPageImage($book->getImageUrl());
         return $result;
     } catch (\Exception $exc) {
         $this->logException(get_class(), __FUNCTION__, $exc);
     }
 }
 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();
 }
Пример #10
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();
 }
Пример #11
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();
 }
Пример #12
0
 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();
 }
Пример #13
0
 public function createWelcomeMessage($userId)
 {
     $siteName = \Sb\Entity\Constants::SITENAME;
     $title = __("Bienvenue au sein de la communauté", "s1b") . " " . $siteName;
     $body = __("Bonjour,", "s1b") . "<br/><br/>";
     $body .= __("Merci d'avoir rejoint", "s1b") . " " . $siteName . "<br/>";
     $body .= __("Toute l'équipe espère que vous profiterez pleinement des fonctionnalités du site, à savoir:", "s1b") . "<br/>";
     $body .= __("* partager vos lectures avec vos amis", "s1b") . "<br/>";
     $body .= __("* leurs recommander un coup de coeur", "s1b") . "<br/>";
     $body .= __("* trouver vos prochaines lectures grâce à leurs conseils", "s1b") . "<br/>";
     $body .= __("* suivre les livres que vous prêtez ou que vous avez emprunté", "s1b") . "<br/>";
     $body .= __("* utiliser les bibliothèques de vos amis, surtout leurs envies de lecture, pour leurs faire un cadeau réussi", "s1b") . "<br/><br/>";
     $body .= __("Bref, cette liste n'est pas exhaustive et nous espérons que vous nous aiderez à continuer à vous proposer de nouvelles fonctionnalités, par exemple en proposant à vos amis de rejoindre", "s1b") . " " . $siteName . "." . "<br/>";
     $body .= '<a href=' . \Sb\Helpers\HTTPHelper::Link(\Sb\Entity\Urls::USER_FRIENDS_FIND) . ' onclick="newInvite(); return false;">' . __("Inviter vos amis de Facebook à rejoindre", "s1b") . " " . $siteName . '</a>' . "<br/>";
     $body .= __("Bonne expérience.", "s1b") . "<br/><br/>";
     $body .= __("L'équipe", "s1b") . " " . $siteName;
     $message = new \Sb\Db\Model\Message();
     $message->setMessage($body);
     $message->setTitle($title);
     $message->setIs_read(false);
     $message->setRecipient(\Sb\Db\Dao\UserDao::getInstance()->get($userId));
     $message->setSender(\Sb\Db\Dao\UserDao::getInstance()->get(1));
     return \Sb\Db\Dao\MessageDao::getInstance()->add($message);
 }
Пример #14
0
 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();
 }
Пример #15
0
 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();
 }
Пример #16
0
 private function addUserBook(\Sb\Db\Model\Book $book, \Sb\Db\Model\User $user, \Sb\Config\Model\Config $config)
 {
     $userBookDao = UserBookDao::getInstance();
     $userBook = $userBookDao->getByBookIdAndUserId($user->getId(), $book->getId());
     // Testing if the user :
     // - doesn't already have that book or
     // - have it but is deleted : in this case we will undelete the book
     if ($userBook && !$userBook->getIs_deleted()) {
         $returnMsg = __("Vous avez déjà ce livre dans votre bibliothèque.", "s1b");
     } else {
         // Getting current user current nb userbooks in libary
         $userNbUserBooks = count($user->getNotDeletedUserBooks());
         if ($userNbUserBooks >= $config->getMaximumNbUserBooksForPublic()) {
             $returnMsg = sprintf(__("Vous ne pouvez pas avoir plus de %s livres dans votre bibliothèque.", "s1b"), $config->getMaximumNbUserBooksForPublic());
         } else {
             // Ajout du UserBook
             $existingUserBook = false;
             $userBook = UserBookDao::getInstance()->getByBookIdAndUserId($user->getId(), $book->getId());
             // testing if the user already had the book but deleted it :
             // if yes, then the userbook is undeleted
             if ($userBook && $userBook->getIs_deleted()) {
                 $userBook->setIs_deleted(false);
                 $existingUserBook = true;
             } else {
                 // Création du UserBoook
                 $userBook = new \Sb\Db\Model\UserBook();
                 $userBook->setCreationDate(new \DateTime());
             }
             // Updating userbook data
             $userBook->setLastModificationDate(new \DateTime());
             $userBook->setUser($user);
             $userBook->setBook($book);
             $bookLink = \Sb\Helpers\HTTPHelper::Link($book->getLink());
             // Persisting userbook in DB
             $addOk = false;
             if ($existingUserBook) {
                 if (UserBookDao::getInstance()->update($userBook)) {
                     $editUserBookLink = \Sb\Helpers\HTTPHelper::Link(\Sb\Entity\Urls::USER_BOOK_EDIT, array("ubid" => $userBook->getId()));
                     $returnMsg = sprintf(__("Vous aviez déjà le livre \"%s\" dans votre bibliothèque mais l'aviez supprimé. Il a été rajouté.<br/><a class=\"link\" href=\"%s\">Remplir votre fiche de lecture</a> ou <a class=\"link\" href=\"%s\">Voir ce livre</a>", "s1b"), $book->getTitle(), $editUserBookLink, $bookLink);
                     $addOk = true;
                 }
             } else {
                 if (UserBookDao::getInstance()->add($userBook)) {
                     $editUserBookLink = \Sb\Helpers\HTTPHelper::Link(\Sb\Entity\Urls::USER_BOOK_EDIT, array("ubid" => $userBook->getId()));
                     $returnMsg = sprintf(__("Le livre \"%s\" a été ajouté à votre bibliothèque.<br/><a class=\"link\" href=\"%s\">Remplir votre fiche de lecture</a> ou <a class=\"link\" href=\"%s\">Voir ce livre</a>", "s1b"), $book->getTitle(), $editUserBookLink, $bookLink);
                     $addOk = true;
                 }
             }
             if ($addOk) {
                 try {
                     $userEvent = new \Sb\Db\Model\UserEvent();
                     $userEvent->setItem_id($userBook->getId());
                     $userEvent->setType_id(\Sb\Entity\EventTypes::USERBOOK_ADD);
                     $userEvent->setUser($user);
                     \Sb\Db\Dao\UserEventDao::getInstance()->add($userEvent);
                 } catch (\Exception $exc) {
                     Trace::addItem("Une erreur s'est produite lors de l'ajout de l'événement suite à l'ajout d'un livre " . $exc->getMessage());
                 }
             }
         }
     }
     return $returnMsg;
 }
Пример #17
0
 public function replyAction()
 {
     return;
     try {
         $globalContext = new \Sb\Context\Model\Context();
         $messageId = ArrayHelper::getSafeFromArray($_GET, 'mid', null);
         $redirect = false;
         if ($messageId) {
             $message = MessageDao::getInstance()->get($messageId);
             $this->view->message = $message;
             if ($message->getRecipient()->getId() != $globalContext->getConnectedUser()->getId()) {
                 Flash::addItem(__("Vous ne pouvez pas répondre à ce message car il ne vous est pas destiné.", "s1b"));
                 $redirect = true;
             }
         } else {
             Flash::addItem(__("Le message auquel vous tentez de répondre n'existe pas.", "s1b"));
             $redirect = true;
         }
         if ($_POST) {
             $title = htmlspecialchars($_POST['Title']);
             $messageContent = htmlspecialchars($_POST['Message']);
             /* test if form is not empty */
             if (!empty($title) && !empty($messageContent)) {
                 // create new message in db
                 $reply = new Message();
                 $reply->setRecipient($message->getSender());
                 $replySender = $globalContext->getConnectedUser();
                 $reply->setSender($replySender);
                 $reply->setDate(new \DateTime());
                 $reply->setTitle($title);
                 $reply->setMessage($messageContent);
                 $reply->setIs_read(false);
                 MessageDao::getInstance()->add($reply);
                 if ($message->getSender()->getSetting()->getEmailMe() == 'Yes') {
                     // send a email to warn the origianl sender of the email
                     $body = MailHelper::newMessageArrivedBody($replySender->getUserName());
                     MailSvc::getInstance()->send($message->getSender()->getEmail(), sprintf(__("Un message vous a été envoyé depuis le site %s", "s1b"), Constants::SITENAME), $body);
                 }
                 Flash::addItem(__("Message envoyé.", "s1b"));
                 $redirect = true;
             } else {
                 Flash::addItem(__("Vous devez renseigné le titre et le contenu du message.", "s1b"));
             }
         }
         if ($redirect) {
             HTTPHelper::redirect(Urls::USER_MAILBOX);
         }
     } 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");
     }
 }
Пример #18
0
 /**
  * Get detail page link for chronicle
  * @return string the detail page link
  */
 public function getDetailLink()
 {
     if ($this->getTitle()) {
         return HTTPHelper::Link("chronique/" . StringHelper::sanitize(StringHelper::cleanHTML($this->getTitle())) . "-" . $this->getId());
     } else {
         return HTTPHelper::Link("chronique/chronique-" . $this->getId());
     }
 }
Пример #19
0
 /**
  * Show pending friends request and allow to accepet or refuse it
  */
 public function pendingRequestsAction()
 {
     try {
         $globalContext = new \Sb\Context\Model\Context();
         $user = $globalContext->getConnectedUser();
         $this->view->user = $user;
         // Show pending requests
         if (!$_POST) {
             $totalPendingRequests = $user->getPendingFriendShips();
             if ($totalPendingRequests && count($totalPendingRequests) > 0) {
                 // Preparing pagination
                 $paginatedList = new PaginatedList($totalPendingRequests, 6);
                 $this->view->firstItemIdx = $paginatedList->getFirstPage();
                 $this->view->lastItemIdx = $paginatedList->getLastPage();
                 $this->view->nbItemsTot = $paginatedList->getTotalPages();
                 $this->view->navigation = $paginatedList->getNavigationBar();
                 $this->view->pendingRequests = $paginatedList->getItems();
             }
         } else {
             $friendShipId = ArrayHelper::getSafeFromArray($_POST, 'friendShipId', null);
             $Title = ArrayHelper::getSafeFromArray($_POST, 'Title', null);
             $Message = ArrayHelper::getSafeFromArray($_POST, 'Message', null);
             $Refused = ArrayHelper::getSafeFromArray($_POST, 'Refused', null);
             if ($friendShipId) {
                 if ($Refused == 0) {
                     // Update the requested friendship
                     $friendShip = FriendShipDao::getInstance()->get($friendShipId);
                     if ($friendShip) {
                         $friendShip->setAccepted(true);
                         $friendShip->setValidated(true);
                         if (FriendShipDao::getInstance()->update($friendShip)) {
                             // Add the userEvent
                             try {
                                 $userEvent = new UserEvent();
                                 $userEvent->setNew_value($user->getId());
                                 $userEvent->setType_id(EventTypes::USER_ADD_FRIEND);
                                 $userEvent->setUser($friendShip->getUser_source());
                                 UserEventDao::getInstance()->add($userEvent);
                             } catch (\Exception $exc) {
                                 Trace::addItem("Erreur lors de l'ajout de l'événement : " . $exc->getMEssage());
                             }
                         }
                     }
                     // Create a friendship on the other side
                     $inverseFriendShip = new FriendShip();
                     $inverseFriendShip->setAccepted(true);
                     $inverseFriendShip->setValidated(true);
                     $inverseFriendShip->setCreationDate(new \DateTime());
                     $inverseFriendShip->setUser_source($user);
                     $inverseFriendShip->setUser_target($friendShip->getUser_source());
                     if (FriendShipDao::getInstance()->add($inverseFriendShip)) {
                         // Add the userEvent
                         try {
                             $userEvent = new UserEvent();
                             $userEvent->setNew_value($friendShip->getUser_source()->getId());
                             $userEvent->setType_id(EventTypes::USER_ADD_FRIEND);
                             $userEvent->setUser($user);
                             UserEventDao::getInstance()->add($userEvent);
                         } catch (\Exception $exc) {
                             Trace::addItem("Erreur lors de l'ajout de l'événement : " . $exc->getMEssage());
                         }
                     }
                     // Send email to the requesting user
                     MailSvc::getInstance()->send($friendShip->getUser_source()->getEmail(), __("Demande d'ami", "s1b"), MailHelper::friendShipAcceptationEmailBody($user->getFirstName() . " " . $user->getLastName()));
                     // add a message in requesting user internal mailbox
                     $message = new \Sb\Db\Model\Message();
                     $message->setDate(new \DateTime());
                     $message->setMessage($Message);
                     $message->setTitle($Title);
                     $message->setRecipient($friendShip->getUser_source());
                     $message->setSender($user);
                     MessageDao::getInstance()->add($message);
                     // redirect to pending request page
                     Flash::addItem("Demande acceptée.");
                     HTTPHelper::redirect(Urls::USER_FRIENDS_PENDING_REQUEST);
                 } elseif ($Refused == 1) {
                     // update the requested friendship
                     $friendShip = FriendShipDao::getInstance()->get($friendShipId);
                     if ($friendShip) {
                         $friendShip->setAccepted(false);
                         $friendShip->setValidated(true);
                         FriendShipDao::getInstance()->update($friendShip);
                     }
                     // send email to the requesting user
                     MailSvc::getInstance()->send($friendShip->getUser_source()->getEmail(), __("Votre demande d'ami a été refusée", "s1b"), MailHelper::friendShipDenyEmailBody($user->getFirstName() . " " . $user->getLastName()));
                     // add a message in requesting user internal mailbox
                     $message = new Message();
                     $message->setDate(new \DateTime());
                     $message->setMessage($Message);
                     $message->setTitle($Title);
                     $message->setRecipient($friendShip->getUser_source());
                     $message->setSender($user);
                     MessageDao::getInstance()->add($message);
                     // redirect to pending request page
                     Flash::addItem(__("Demande refusée.", "s1b"));
                     HTTPHelper::redirect(Urls::USER_FRIENDS_PENDING_REQUEST);
                 }
             } else {
                 Flash::addItem(__("Vous devez sélectionner une demande d'ami.", "s1b"));
                 HTTPHelper::redirect(Urls::USER_FRIENDS_PENDING_REQUEST);
             }
         }
     } 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");
     }
 }
Пример #20
0
 /**
  * Get a chronicle as ChronicleViewModel object for chronicle detail page
  * @param int $nbSimilarChronicles the number of similar chronicles to return , if not passed (null), then no similar chronicles will be returned
  * @param int $nbSameAuthorChronicles number of same author chronicles to return
  * @param int $nbPressReviews number of press reviews to return
  * @param boolean flag to tell to use cache or not
  * @return \Sb\Model\ChronicleViewModel a chronicle as a ChronicleViewModel object
  */
 public function getAsChronicleViewModel($nbSimilarChronicles = null, $nbSameAuthorChronicles = null, $nbPressReviews = null, $useCache = true)
 {
     /* @var $chronicle ChronicleViewModel */
     $chronicleViewModel = new ChronicleViewModel();
     // Set common members
     $this->setChronicleViewModelLight($chronicleViewModel);
     $chronicleViewModel->setText($this->chronicle->getText());
     $chronicleViewModel->setUserName($this->chronicle->getUser()->getUserName());
     $chronicleViewModel->setUserProfileLink(HTTPHelper::Link(Urls::USER_PROFILE, array("uid" => $this->chronicle->getUser()->getId())));
     $chronicleViewModel->setUserImage(UserHelper::getMediumImageTag($this->chronicle->getUser(), __("image chroniqueur", "s1b")));
     $chronicleViewModel->setSource($this->chronicle->getSource());
     // Set book
     $chronicleViewModel->setChronicleHasBook(false);
     if ($this->chronicle->getBook()) {
         $chronicleViewModel->setChronicleHasBook(true);
         $chronicleViewModel->setBook($this->chronicle->getBook());
     }
     // Set link info
     $chronicleViewModel->setLinkCss("chr-link-other");
     $chronicleViewModel->setLinkText(__("En savoir plus", "s1b"));
     switch ($this->chronicle->getLink_type()) {
         case ChronicleLinkType::IMAGE:
             $chronicleViewModel->setLinkCss("chr-link-image");
             $chronicleViewModel->setLinkText(__("Voir la photo", "s1b"));
             break;
         case ChronicleLinkType::PODCAST:
             $chronicleViewModel->setLinkCss("chr-link-podcast");
             $chronicleViewModel->setLinkText(__("Ecouter le podcast", "s1b"));
             break;
         case ChronicleLinkType::PRESS:
             $chronicleViewModel->setLinkCss("chr-link-press");
             $chronicleViewModel->setLinkText(__("Lire l'article", "s1b"));
             break;
         case ChronicleLinkType::URL:
             $chronicleViewModel->setLinkCss("chr-link-url");
             $chronicleViewModel->setLinkText(__("En savoir plus", "s1b"));
             break;
         case ChronicleLinkType::VIDEO:
             $chronicleViewModel->setLinkCss("chr-link-video");
             $linkText = __("Regarder la video", "s1b");
             break;
     }
     // Set type label
     $chronicleViewModel->setTypeLabel(ChronicleHelper::getTypeLabel($this->chronicle->getType_id()));
     // Set similar chronicles or same author chronicles
     if ($nbSimilarChronicles || $nbSameAuthorChronicles) {
         $chroniclesAdapter = new ChronicleListAdapter();
         // Set the similar chronicles
         if ($nbSimilarChronicles) {
             $chroniclesAdapter->setChronicles($this->getSimilarChronicles($nbSimilarChronicles, $useCache));
             $chronicleViewModel->setSimilarChronicles($chroniclesAdapter->getAsChronicleViewModelList());
         }
         // Set the same author chronicles
         if ($nbSameAuthorChronicles) {
             $chroniclesAdapter->setChronicles($this->getSameAuthorChronicles($nbSameAuthorChronicles, $useCache));
             $chronicleViewModel->setSameAuthorChronicles($chroniclesAdapter->getAsChronicleViewModelList());
         }
     }
     // Set press reviews
     if ($nbPressReviews) {
         $pressReviews = null;
         // Get press review with same tag
         if ($this->chronicle->getTag()) {
             $pressReviews = PressReviewSvc::getInstance()->getList(array("tag" => array(true, "=", $this->chronicle->getTag()), "is_validated" => array(false, "=", 1)), $nbPressReviews, $useCache);
         }
         // Get press review with same keywords
         if ((!$pressReviews || count($pressReviews) < $nbPressReviews) && $this->chronicle->getKeywords()) {
             $keyWords = explode(",", $this->chronicle->getKeywords());
             foreach ($keyWords as $keyWord) {
                 // Get press review with same keywords
                 $criteria = array("keywords" => array(false, "LIKE", $keyWord));
                 $pressReviewsWithKeywords = PressReviewSvc::getInstance()->getList($criteria, $nbPressReviews, $useCache);
                 if ($pressReviewsWithKeywords) {
                     if (!$pressReviews) {
                         $pressReviews = $pressReviewsWithKeywords;
                     } else {
                         $pressReviews = EntityHelper::mergeEntities($pressReviews, $pressReviewsWithKeywords);
                     }
                     if (count($pressReviews) >= $nbPressReviews) {
                         break;
                     }
                 }
             }
             if ($pressReviews) {
                 $pressReviews = array_slice($pressReviews, 0, $nbPressReviews);
             }
         }
         $chronicleViewModel->setPressReviews($pressReviews);
     }
     return $chronicleViewModel;
 }
Пример #21
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();
 }
Пример #22
0
 private static function getProfileEditSettingLine()
 {
     return '<h5>' . __("Si vous souhaitez ne plus recevoir par email les alertes modifiez les paramètres de votre profil dans", "s1b") . " " . "<a href='" . \Sb\Helpers\HTTPHelper::Link(\Sb\Entity\Urls::USER_PROFILE_SETTINGS) . "'>" . __("Mes paramètres", "s1b") . "</a>" . '</h5>';
 }
Пример #23
0
 /**
  * Set a cookie for name and value with a 24 hours life time
  * @param String $cookieName
  * @param String $cookieValue
  */
 private function setChronicleSeenCookie($cookieName, $cookieValue)
 {
     $this->getResponse()->setRawHeader(new Zend_Http_Header_SetCookie($cookieName, $cookieValue, time() + 3600 * 24, '/', HTTPHelper::getHostBase(), false, true));
 }
Пример #24
0
 /**
  * Called when submitting profile settings form
  */
 public function submitSettingsAction()
 {
     try {
         $globalContext = new \Sb\Context\Model\Context();
         /* @var $user \Sb\Db\Model\User */
         $user = $globalContext->getConnectedUser();
         $userSettings = $user->getSetting();
         if (!empty($_POST)) {
             $settings_DisplayProfile = $_POST['settings_DisplayProfile'];
             $settings_DisplayEmail = $_POST['settings_DisplayEmail'];
             $settings_SendMessages = $_POST['settings_SendMessages'];
             $settings_DisplayBirthDay = $_POST['settings_DisplayBirthDay'];
             $settings_DisplayWishList = $_POST['settings_DisplayWishList'];
             $settings_AllowFollowers = $_POST['settings_AllowFollowers'];
             $settings_EmailMe = $_POST['settings_EmailMe'];
             $settings_AcceptNewsletter = $_POST['settings_AcceptNewsletter'] == 1 ? true : false;
             $userSettings->setDisplayProfile($settings_DisplayProfile);
             $userSettings->setDisplayEmail($settings_DisplayEmail);
             $userSettings->setSendMessages($settings_SendMessages);
             $userSettings->setDisplayBirthday($settings_DisplayBirthDay);
             $userSettings->setDisplay_wishlist($settings_DisplayWishList);
             $userSettings->setAllowFollowers($settings_AllowFollowers);
             $userSettings->setEmailMe($settings_EmailMe);
             $userSettings->setAccept_newsletter($settings_AcceptNewsletter);
             UserSettingDao::getInstance()->update($userSettings);
             Flash::addItem(__("Vos modifications ont bien été enregistrées", "s1b"));
         }
         // Redirect to settings action
         HTTPHelper::redirect(Urls::USER_PROFILE_SETTINGS);
     } 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");
     }
 }
Пример #25
0
 public function friendLibraryAction()
 {
     try {
         // Set friend library data
         $this->setFriendLibaryData();
         $key = $this->getListKey();
         // Get the list key (allBooks, wishedBooks, etc...)
         $fullKey = $this->formateListKey($key);
         // Reset the list options (sorting, searching, paging, filtering) if requested
         if (ArrayHelper::getSafeFromArray($_GET, "reset", false)) {
             $this->resetListOption($fullKey);
         }
         $filteringOrSearching = array_key_exists("searchvalue", $_GET) || array_key_exists("filter", $_GET) && array_key_exists("filtertype", $_GET);
         // Get the books
         $books = UserBookSvc::getInstance()->getUserBooks($key, $this->getContext()->getLibraryUserId(), $filteringOrSearching);
         // Set list meta data if getting list first time
         if (!$filteringOrSearching) {
             $this->setListMetaData($books, $fullKey);
         }
         // Set filtering and searching options
         if ($filteringOrSearching) {
             $this->setFilteringAndSearching($fullKey);
         }
         $booksTableView = $this->createBookTableView($key, $books, false);
         $this->view->list = new BookListView($key, $booksTableView, $key);
         $this->view->header = new LibraryHeader($this->getContext()->getLibraryUserId(), $key);
         $this->view->friendLibrary = $this->getContext()->getIsShowingFriendLibrary();
     } catch (\Exception $e) {
         Flash::addItem($e->getMessage());
         HTTPHelper::redirectToReferer();
     }
 }
Пример #26
0
 public function profileAction()
 {
     $globalContext = new \Sb\Context\Model\Context();
     // Users profile are only accessible for connected users
     AuthentificationSvc::getInstance()->checkUserIsConnected();
     $noUser = true;
     $friendId = $this->_getParam("uid");
     if ($friendId) {
         $friend = UserDao::getInstance()->get($friendId);
         $this->view->friend = $friend;
         if ($friend) {
             $noUser = false;
             if ($friend->getId() == $globalContext->getConnectedUser()->getId()) {
                 Flash::addItem(__("Il s'agit de votre profil!", "s1b"));
                 HTTPHelper::redirectToReferer();
             } else {
                 $requestingUser = $globalContext->getConnectedUser();
                 if (SecurityHelper::IsUserAccessible($friend, $requestingUser)) {
                     $this->view->friendSetting = $friend->getSetting();
                     $this->view->isFriend = UserSvc::getInstance()->areUsersFriends($globalContext->getConnectedUser(), $friend);
                     // getting currently reading or lastly read books
                     $currentlyReading = UserBookDao::getInstance()->getReadingNow($friend->getId());
                     $lastlyReads = UserBookDao::getInstance()->getListLastlyRead($friend->getId());
                     if ($currentlyReading && $lastlyReads) {
                         $this->view->currentlyReadingOrLastlyReadBooks = array_merge(array($currentlyReading), $lastlyReads);
                     } elseif ($lastlyReads) {
                         $this->view->currentlyReadingOrLastlyReadBooks = $lastlyReads;
                     } elseif ($currentlyReading) {
                         $this->view->currentlyReadingOrLastlyReadBooks = array($currentlyReading);
                     }
                     // Getting friend currently reading user books
                     $this->view->allCurrentlyReadingUserBooks = UserBookDao::getInstance()->getCurrentlyReadingsNow($friend->getId());
                     if (count($this->view->allCurrentlyReadingUserBooks) > 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-currentreadings', 298, 190)});</script>\n");
                     }
                     // Getting friend last boh books
                     $bohUserBooks = UserBookDao::getInstance()->getListUserBOH($friend->getId());
                     $this->view->bohBooks = array_map(array($this, "getBook"), $bohUserBooks);
                     // Getting books friend could like
                     $this->view->booksHeCouldLikes = BookSvc::getInstance()->getBooksUserCouldLike($friend->getId());
                     if ($this->view->booksHeCouldLikes && count($this->view->booksHeCouldLikes) > 0) {
                         $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('bookUserCouldLike', 90)});</script>\n");
                     }
                     // Getting friend's friends last reviews
                     $this->view->friendLastReviews = UserEventSvc::getInstance()->getUserLastEventsOfType($friend->getId(), EventTypes::USERBOOK_REVIEW_CHANGE);
                     // Getting friend last friends added events
                     $this->view->friendLastFriendsAddedEvents = UserEventSvc::getInstance()->getUserLastEventsOfType($friend->getId(), EventTypes::USER_ADD_FRIEND);
                     if (count($this->view->friendLastFriendsAddedEvents) > 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-friendlastfriends', 298, 85)});</script>\n");
                     }
                     // Getting friend last events
                     $this->view->friendLastEvents = UserEventSvc::getInstance()->getUserLastEventsOfType($friend->getId(), null, 15);
                     $this->view->placeholder('footer')->append("<script>\n\n                            toInit.push(\"attachUserEventsExpandCollapse()\");\n\n                            function attachUserEventsExpandCollapse() {_attachExpandCollapseBehavior(\"js_userLastEvents\", \"userEvent\", \"Voir moins d'activités\", \"Voir plus d'activités\");}\n\n                        </script>\n");
                 } else {
                     Flash::addItem(__("Vous ne pouvez pas accéder à ce profil.", "s1b"));
                     HTTPHelper::redirectToReferer();
                 }
             }
         }
     }
     if ($noUser) {
         Flash::addItem(__("Cet utilisateur n'existe pas.", "s1b"));
         HTTPHelper::redirectToReferer();
     }
 }
Пример #27
0
 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();
 }
Пример #28
0
 private function redirectToHome()
 {
     Flash::addItem(__("Vos critères de recherche ne nous ont pas permis de trouver de livre.", "s1b"));
     HTTPHelper::redirectToHome();
 }
Пример #29
0
 public function get()
 {
     $baseTpl = "book/bookForm/userBook";
     $readingStateSvc = \Sb\Db\Service\ReadingStateSvc::getInstance();
     $readingStates = $readingStateSvc->getReadingStates();
     $readingStateOptions = "";
     if ($readingStates) {
         foreach ($readingStates as $readingState) {
             $selected = "";
             if ($this->userBook->getReadingState() && $readingState->getId() == $this->userBook->getReadingState()->getId()) {
                 $selected = "selected";
             }
             $readingStateOptions .= "<option value='" . $readingState->getId() . "' {$selected}>" . $readingState->getLabel() . "</option>";
         }
     }
     $readState = $readingStateSvc->getReadSate();
     $tpl = new \Sb\Templates\Template($baseTpl);
     $tpl->set("id", $this->userBook->getId());
     if ($this->userBook->getUser()) {
         $tpl->set("userid", $this->userBook->getUser()->getId());
     } else {
         $tpl->set("userid", "");
     }
     if ($this->userBook->getBook()) {
         $tpl->set("bookid", $this->userBook->getBook()->getId());
     } else {
         $tpl->set("bookid", "");
     }
     if ($this->addMode) {
         $tpl->set("pictos", "");
     } else {
         $tpl->set("pictos", \Sb\Helpers\UserBookHelper::getStatusPictos($this->userBook));
     }
     $tpl->set("readingStateOptions", $readingStateOptions);
     $tpl->set("review", $this->userBook->getReview());
     $rating = $this->userBook->getRating();
     if (isset($rating)) {
         $ratingCssClass = "rating-" . $rating;
     } else {
         $ratingCssClass = "no-rating";
     }
     $tpl->set("ratingCssClass", $ratingCssClass);
     $tpl->set("rating", $rating);
     if ($this->userBook->getReadingState()) {
         $tpl->set("displayReadingDateBlock", $this->userBook->getReadingState()->getId() != \Sb\Entity\ReadingStates::READ ? "noDisplay" : "");
         $displayNbPagesRead = $this->userBook->getReadingState()->getId() != \Sb\Entity\ReadingStates::READING ? "noDisplay" : "";
     } else {
         $tpl->set("displayReadingDateBlock", "noDisplay");
         $displayNbPagesRead = "noDisplay";
     }
     // Getting book total nb of pages
     $nb_of_pages = $this->userBook->getBook()->getNb_of_pages();
     if ($this->userBook->getNb_of_pages()) {
         $nb_of_pages = $this->userBook->getNb_of_pages();
     }
     // Gettign nb of pages read
     $nb_of_pages_read = $this->userBook->getNb_of_pages_read();
     $tpl->set("isBlowOfHeartChecked", $this->userBook->getIsBlowOfHeart() ? "checked" : "");
     if ($this->addMode) {
         $tpl->set("borrow", sprintf("<a href=\"%s\">%s</a>", "", __("Emprunter ce livre", "s1b")));
     } else {
         $tpl->set("borrow", __("", ""));
     }
     $borrowerName = "";
     $lenderName = "";
     $oneActiveLending = false;
     $oneActiveBorrowing = false;
     $lending = $this->userBook->getActiveLending();
     if ($lending) {
         $oneActiveLending = true;
         $borrowerName = $lending->getBorrower_userbook()->getUser()->getFirstName() . " " . $lending->getBorrower_userbook()->getUser()->getLastName();
     }
     $borrowing = $this->userBook->getActiveBorrowing();
     if ($borrowing) {
         $oneActiveBorrowing = true;
         if ($borrowing->getUserBook()) {
             $lenderName = $borrowing->getUserBook()->getUser()->getFirstName() . " " . $borrowing->getUserBook()->getUser()->getLastName();
         } elseif ($borrowing->getGuest()) {
             $lenderName = sprintf(__("%s (invité)", "s1b"), $borrowing->getGuest()->getName());
         }
     }
     $showLending = true;
     if ($this->addMode || !$this->userBook->getIsOwned() && !$oneActiveBorrowing) {
         $showLending = false;
     }
     $tpl->set("editLendingText", __("Prêtez ce livre", "s1b"));
     if (!$oneActiveBorrowing && !$oneActiveLending) {
         $tpl->set("lendingLabel", "");
     } else {
         if ($oneActiveLending) {
             $tpl->set("lendingLabel", sprintf(__("Vous prêtez actuellement ce livre à %s", "s1b"), $borrowerName));
             $tpl->set("editLendingText", __("Détail", "s1b"));
         } else {
             if ($oneActiveBorrowing) {
                 $tpl->set("lendingLabel", sprintf(__("Vous empruntez actuellement ce livre à %s.", "s1b"), $lenderName));
                 $tpl->set("editLendingText", __("Détail", "s1b"));
             } else {
                 $tpl->set("lendingLabel", "");
             }
         }
     }
     $tpl->set("isOwned", $this->userBook->getIsOwned() ? "checked" : "");
     $tpl->set("isWished", $this->userBook->getIsWished() ? "checked" : "");
     $tpl->set("editLendingLink", \Sb\Helpers\HTTPHelper::Link(\Sb\Entity\Urls::LENDING_EDIT, array("ubid" => $this->userBook->getId())));
     $tpl->set("readingDate", $this->userBook->getReadingDate() ? $this->userBook->getReadingDate()->format(__("d/m/Y", "s1b")) : "");
     $tpl->set("hyperlink", $this->userBook->getHyperlink());
     $script = "";
     if ($readState) {
         $script = sprintf("<script>var share1bookAddABookJs = {readstate : \"%s\"}</script>", $readState->getId());
     }
     // Get all the tags
     $labelCol = $this->getTagLabelCol();
     $tags = \Sb\Db\Service\TagSvc::getInstance()->getAllTags($labelCol);
     if (!$this->addMode) {
         // Get the tags assigned to the userbook
         $this->userBookTags = $this->userBook->getTags();
         $tagsExt = array_map(array($this, "isChecked"), $tags);
     }
     $tpl->setVariables(array("addMode" => $this->addMode, "showLending" => $showLending, "tags" => $tags, "tagsExt" => $tagsExt, "nb_of_pages" => $nb_of_pages, "nb_of_pages_read" => $nb_of_pages_read, "displayNbPagesRead" => $displayNbPagesRead));
     return $tpl->output();
 }
Пример #30
0
 /**
  * Show and submit registration page
  */
 public function registerAction()
 {
     try {
         if ($_POST) {
             if ($this->validateRegistrationForm()) {
                 // Test if user already in DB
                 $userInDB = UserDao::getInstance()->getByEmail($_POST['email']);
                 // If yes => show message and redirect to login page
                 if ($userInDB) {
                     if ($userInDB->getDeleted()) {
                         Flash::addItem(__("Un compte correspondant à cet email existe mais il a été supprimé. Merci de nous contacter via le formulaire de contact.", "s1b"));
                     } else {
                         Flash::addItem(__("Vous avez déjà créé un compte avec cet email. Si vous l'avez créé avec Facebook, vous pouvez vous connecter avec Facebook et ajouter un mot de passe dans votre profil section mot de passe. Si ce n'est pas le cas et que vous ne vous souvenez pas du mot de passe, vous pouvez demandez à réinitialiser le mot de passe en cliquant sur le lien \"Mot de passe perdu\"", "s1b"));
                     }
                     HTTPHelper::redirect(\Sb\Entity\Urls::LOGIN);
                 } else {
                     // If Not
                     // ==> create user
                     // ==> send welcome email
                     // ==> create welcome message in internal mailbox
                     //
                     $userFromPost = new User();
                     UserMapper::map($userFromPost, $_POST);
                     $userFromPost->setToken(sha1(uniqid(rand())));
                     $userFromPost->setActivated(false);
                     $userFromPost->setDeleted(false);
                     $userFromPost->setFacebookId("");
                     $userFromPost->setGender("");
                     $userFromPost->setFacebookLanguage("");
                     $userFromPost->setTokenFacebook("");
                     $userFromPost->setPicture("");
                     $userFromPost->setPictureBig("");
                     $setting = new UserSetting();
                     UserSettingHelper::loadDefaultSettings($setting);
                     $userFromPost->setSetting($setting);
                     $userInDB = UserDao::getInstance()->add($userFromPost);
                     // send confirmation email
                     $subject = sprintf(__("Votre compte %s a été créé", "s1b"), Constants::SITENAME);
                     MailSvc::getInstance()->send($userInDB->getEmail(), $subject, MailHelper::validationAccountEmailBody($userInDB->getFirstName(), $userInDB->getToken(), $userInDB->getEmail()));
                     // Send warning email to webmaster
                     MailSvc::getInstance()->send(Constants::WEBMASTER_EMAIL . ", berliozd@gmail.com, rebiffe_olivier@yahoo.fr", __("nouveau user", "s1b"), $userInDB->getEmail());
                     // create message in user internal mailbox
                     MessageSvc::getInstance()->createWelcomeMessage($userInDB->getId());
                     // redirect to user homepage
                     $successMsg = __("Votre compte a été créé correctement. N'oubliez pas de l'activer grâce à l'email que vous avez reçu avant toute première connexion. <strong>Attention cet email pourrait tomber dans vos spams.</strong>", "s1b");
                     Flash::addItem($successMsg);
                     // Testing if the user registering match invitations and set them to validated and accepted if they exist
                     InvitationSvc::getInstance()->setInvitationsAccepted($userInDB->getEmail());
                     HTTPHelper::redirect(Urls::LOGIN);
                 }
             }
         }
     } 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");
     }
 }