Exemplo n.º 1
0
 public function matchingBooks($pdf_url_folder, $search = '')
 {
     $filtered_search = $this->filterSearch($search);
     $initial_pdf_books = $this->sortableTitleKeys($this->pdf_books);
     $authors = new Authors();
     $html_books = array();
     foreach ($initial_pdf_books as $sort_title => $book) {
         if ($this->bookInSearch($book, $filtered_search)) {
             $this->title_html = $this->titleHtml($book['title'], $book['story_link_on_wikipedia']);
             $sort_author_lastname = $authors->lastAuthorName($book['author']);
             $this->author_title_sort = "{$sort_author_lastname}-{$sort_title}";
             $this->author_html = $this->authorHtml($book['author'], $sort_author_lastname);
             $pdfs_book = self::pdfsOnlyList($book);
             $this->pdfs_html = $this->pdfsHtml($pdf_url_folder, $pdfs_book);
             $html_books[] = $this->tableRow($sort_title);
         }
     }
     $html = implode("\n", $html_books);
     return $html;
 }
Exemplo n.º 2
0
 public function testAuthorsLastNames()
 {
     $author_test_names_to_last = array("Madeline L'Engel " => "L'Engel", "Fitz-James O'Brien " => "O'Brien", "Sheridan Le Fanu " => "Le Fanu", "Lester del Rey " => "del Rey", "James De Mille " => "De Mille", "Charles De Vet " => "De Vet", ' Kurt Vonnegut Jr. ' => 'Vonnegut', " Gene Cross aka 'Arthur Jean Cox' " => 'Cox', ' Arthur Quiller-Couch ' => 'Quiller-Couch', ' Sam    Merwin     Jr. ' => 'Merwin', " jim Garis' " => 'Garis', 'Emily Brontë' => 'Brontë', 'Gottfried August Bürger ' => 'Bürger', 'hansen )' => 'hansen', 'Hansen)' => 'Hansen', 'H.G.Wells' => 'Wells', "Robert W.Chambers" => 'Chambers');
     $authors = new Authors();
     foreach ($author_test_names_to_last as $test_name => $expected_last) {
         $found_last = $authors->lastAuthorName($test_name);
         $this->assertEquals($found_last, $expected_last);
     }
 }