Code: Select all
public function addAction()
{
if (!$this->_isLoggedIn()) return; // make sure user is logged in
$project = $this->_session->Project;
$action = 'question';
if ($pos = $this->_processId($this->_post->getRaw('question_id')))
{
$project->goto($pos);
$action = 'review'; // change where we're forwarding
}
$answer = $this->_validateAnswer();
$project->addAnswer($answer);
/**
* If there were any issues with adding the answer, _validateAnswer
* will have already taken care of the error messages, etc. so
* it is safe to simply forward the user to the question action now
*/
$this->_forward('project', $action);
return;
}Code: Select all
public function addAction()
{
if (!$this->_isLoggedIn()) return; // make sure user is logged in
$project = $this->_session->Project;
$action = 'question';
if ($pos = $this->_processId($this->_post->getRaw('question_id')))
{
$project->goto($pos);
$action = 'review'; // change where we're forwarding
}
$answer = $this->_validateAnswer();
$project->addAnswer($answer);
if ($this->_ajax)
{
// output ajax response
return;
}
/**
* If there were any issues with adding the answer, _validateAnswer
* will have already taken care of the error messages, etc. so
* it is safe to simply forward the user to the question action now
*/
$this->_forward('project', $action);
return;
}