Пример #1
0
 /**
  * @Route("/get_user_notification_count")
  * @Method({"GET"})
  *
  * @return array
  */
 public function getUserNotificationsCount()
 {
     $result['posts_timeline_count'] = $this->post_service->getTimelineCount();
     $result['answers_timeline_count'] = $this->question_service->getAnswerTimelineCount();
     $result['new_answers_count'] = $this->question_service->getNewAnswersCount();
     return $result;
 }
Пример #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
 /**
  * @Route("/get_unanswered_question")
  * @Method({"GET"})
  */
 public function getUnansweredQuestionsAction()
 {
     return $this->service->getUnansweredQuestions();
 }