Beispiel #1
0
 public static function getAllAuthorsByFirstLetter()
 {
     list(, $result) = parent::executeQuery("select {0}\nfrom authors\ngroup by substr (upper (sort), 1, 1)\norder by substr (upper (sort), 1, 1)", "substr (upper (sort), 1, 1) as title, count(*) as count", "", array(), -1);
     $entryArray = array();
     while ($post = $result->fetchObject()) {
         array_push($entryArray, new Entry($post->title, Author::getEntryIdByLetter($post->title), str_format(localize("authorword", $post->count), $post->count), "text", array(new LinkNavigation("?page=" . parent::PAGE_AUTHORS_FIRST_LETTER . "&id=" . rawurlencode($post->title))), "", $post->count));
     }
     return $entryArray;
 }
Beispiel #2
0
 public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL)
 {
     $columns = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
     $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name';
     list($totalNumber, $result) = parent::executeQuery($sql, $columns, "", array('%' . $query . '%'), $n, $database, $numberPerPage);
     $entryArray = array();
     while ($post = $result->fetchObject()) {
         $tag = new Tag($post);
         array_push($entryArray, new Entry($tag->name, $tag->getEntryId(), str_format(localize("bookword", $post->count), $post->count), "text", array(new LinkNavigation($tag->getUri()))));
     }
     return array($entryArray, $totalNumber);
 }
Beispiel #3
0
 public static function getEntryArray($query, $params)
 {
     list(, $result) = parent::executeQuery($query, self::RATING_COLUMNS, "", $params, -1);
     $entryArray = array();
     while ($post = $result->fetchObject()) {
         $ratingObj = new Rating($post->id, $post->rating);
         $rating = $post->rating / 2;
         $rating = str_format(localize("ratingword", $rating), $rating);
         array_push($entryArray, new Entry($rating, $ratingObj->getEntryId(), str_format(localize("bookword", $post->count), $post->count), "text", array(new LinkNavigation($ratingObj->getUri())), "", $post->count));
     }
     return $entryArray;
 }
Beispiel #4
0
 public static function getEntryArray($query, $params, $n, $database = NULL, $numberPerPage = NULL)
 {
     list($totalNumber, $result) = parent::executeQuery($query, self::BOOK_COLUMNS, self::getFilterString(), $params, $n, $database, $numberPerPage);
     $entryArray = array();
     while ($post = $result->fetchObject()) {
         $book = new Book($post);
         array_push($entryArray, $book->getEntry());
     }
     return array($entryArray, $totalNumber);
 }