public function executeShow() { $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); $c = new Criteria(); $c->add(SolutionPeer::QUESTION_ID, $this->question->getId()); $c->addDescendingOrderByColumn(SolutionPeer::CREATED_AT); $this->solutions = SolutionPeer::doSelect($c); $this->forward404Unless($this->question); }
public function executeInterested() { $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($this->question); $user = $this->getUser()->getSubscriber(); $interest = new Interest(); $interest->setQuestion($this->question); $interest->setUser($user); $interest->save(); }
public function executeAdd() { // disable web debug toolbar sfConfig::set('sf_web_debug', false); $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('question_id')); $this->forward404Unless($this->question); $userId = $this->getUser()->getSubscriberId(); $phrase = $this->getRequestParameter('tag'); $this->question->addTagsForUser($phrase, $userId); $this->tags = $this->question->getTags(); // clear the question tag list fragment in cache if (sfConfig::get('sf_cache')) { $this->getContext()->getViewCacheManager()->remove('@question?stripped_title=' . $this->question->getStrippedTitle(), 'fragment_question_tags'); } }
public function executeAdd() { if ($this->getRequest()->getMethod() == sfRequest::POST) { if (!$this->getRequestParameter('body')) { return sfView::NONE; } $question = QuestionPeer::retrieveByPk($this->getRequestParameter('question_id')); $this->forward404Unless($question); // user or anonymous coward $user = $this->getUser()->isAuthenticated() ? $this->getUser()->getSubscriber() : UserPeer::getUserFromNickname('anonymous'); // create answer $this->answer = new Answer(); $this->answer->setQuestion($question); $this->answer->setBody($this->getRequestParameter('body')); $this->answer->setUser($user); $this->answer->save(); return sfView::SUCCESS; } $this->forward404(); }
public function executeReportQuestion() { $this->question = QuestionPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($this->question); $spam = new ReportQuestion(); $spam->setQuestionId($this->question->getId()); $spam->setUserId($this->getUser()->getSubscriberId()); $spam->save(); }