Пример #1
0
 public function test_lists()
 {
     $as = XAppSession::begin();
     $authorService = new AuthorService();
     $authorList = $authorService->lists();
     $as->commit();
     $this->logger->info("Author list number: " . count($authorList));
     $sameAuthorList = DDA::ins()->list_Author_by_status(Constants::USING);
     $this->assertTrue(count($authorList) == count($sameAuthorList));
     $as = null;
 }
Пример #2
0
 /**
  * @Route("/get")
  * @Method({"GET"})
  *
  * @return array
  */
 public function get(Request $request)
 {
     $posts = $this->postservice->getAllPosts();
     foreach ($posts as $post) {
         $data = ['id' => 'post_' . $post->getId(), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/#post/' . $post->getId(), 'image' => '', 'subtype' => 'post', 'sumtext' => trim(strip_tags($post->getPreview())) . ' ' . trim(strip_tags($post->getText())), 'tags' => '"Posts"', 'body' => trim(strip_tags($post->getText())), 'date' => date('Y-m-d\\TH:i:s', $post->getDate()->getTimestamp()), 'title' => trim(strip_tags($post->getCaption()))];
         $this->allf->indexistoQueryAdd($data);
     }
     $authors = $this->service->getAllAuthors();
     foreach ($authors as $author) {
         $data = ['id' => 'author_' . $author->getId(), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/#author/' . $author->getId() . '/posts', 'image' => '', 'subtype' => 'users', 'sumtext' => trim(strip_tags($author->getDescription())) . ' ' . trim(strip_tags($author->getInterest())), 'tags' => '"Authors"', 'body' => trim(strip_tags($author->getDescription())), 'date' => date('Y-m-d\\TH:i:s', $author->getPublicationDate()->getTimestamp()), 'title' => trim(strip_tags($author->getName()))];
         $this->allf->indexistoQueryAdd($data);
     }
     $questions = $this->questionservice->getQuestionsToSearch();
     foreach ($questions as $question) {
         $data = ['id' => 'questions_' . $question->getId(), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/#author/' . $question->getAuthorId() . '/questions', 'image' => '', 'subtype' => 'questions', 'sumtext' => trim(strip_tags($question->getAnswer())), 'tags' => '"Questions"', 'body' => trim(strip_tags($question->getAnswer())), 'date' => date('Y-m-d\\TH:i:s', $question->getDate()->getTimestamp()), 'title' => trim(strip_tags($question->getText()))];
         $this->allf->indexistoQueryAdd($data);
     }
     return [];
 }
Пример #3
0
 public function _run($request, $xcontext)
 {
     $authorService = new AuthorService();
     $xcontext->authorList = $authorService->lists();
     $this->logger->info("Get all authors " . count($xcontext->authorList));
     $this->logger->info("Show add book page.");
     return XNext::useTpl("book/add.html");
 }
Пример #4
0
 public function _run($request, $xcontext)
 {
     $authorService = new AuthorService();
     $xcontext->authorList = $authorService->lists();
     $xcontext->nodeletion = $request->nodeletion;
     $this->logger->info("List all authors " . count($xcontext->authorList));
     return XNext::useTpl("author/list.html");
 }