public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); $author_phid = $user->getPHID(); $object_phids = array($author_phid); $handles = $this->loadViewerHandles($object_phids); $question = new PonderQuestion(); $question->setContent($request->getStr('content')); $question->setAuthorPHID($author_phid); $view = new PonderPostBodyView(); $view->setQuestion($question)->setTarget($question)->setPreview(true)->setUser($user)->setHandles($handles)->setAction(self::VERB_ASKED); return id(new AphrontAjaxResponse())->setContent($view->render()); }
public function render() { require_celerity_resource('ponder-post-css'); $question = $this->question; $user = $this->user; $handles = $this->handles; $panel = id(new AphrontPanelView())->addClass("ponder-panel")->setHeader("Responses:"); foreach ($this->answers as $cur_answer) { $view = new PonderPostBodyView(); $view->setQuestion($question)->setTarget($cur_answer)->setAction(PonderConstants::ANSWERED_LITERAL)->setHandles($handles)->setUser($user); $commentview = new PonderCommentListView(); $commentview->setUser($user)->setHandles($handles)->setComments($cur_answer->getComments())->setTarget($cur_answer->getPHID())->setQuestionID($question->getID())->setActionURI(new PhutilURI('/ponder/comment/add/')); $panel->appendChild($view); $panel->appendChild($commentview); $panel->appendChild('<div style="height: 40px; clear : both"></div>'); } return $panel->render(); }
public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); $question_id = $request->getInt('question_id'); $question = PonderQuestionQuery::loadSingle($user, $question_id); if (!$question) { return new Aphront404Response(); } $author_phid = $user->getPHID(); $object_phids = array($author_phid); $handles = $this->loadViewerHandles($object_phids); $answer = new PonderAnswer(); $answer->setContent($request->getStr('content')); $answer->setAuthorPHID($author_phid); $view = new PonderPostBodyView(); $view->setQuestion($question)->setTarget($answer)->setPreview(true)->setUser($user)->setHandles($handles)->setAction(PonderConstants::ANSWERED_LITERAL); return id(new AphrontAjaxResponse())->setContent($view->render()); }