evolve QuesttypeAgents with fixed Actions and Character submission handling
This commit is contained in:
parent
844a048074
commit
4ab600fb6d
22 changed files with 724 additions and 140 deletions
|
|
@ -189,6 +189,34 @@
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answers of a Character for a Quest.
|
||||
*
|
||||
* @param int $questId ID of Quest to save answers for
|
||||
* @param int $characterId ID of Character to save answers of
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function saveAnswersOfCharacter($questId, $characterId, $answers)
|
||||
{
|
||||
$this->controller->saveAnswersOfCharacter($questId, $characterId, $answers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if answers of a Character for a Quest match the correct ones.
|
||||
*
|
||||
* @param int $questId ID of Quest to match answers for
|
||||
* @param int $characterId ID of Character to match answers of
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function matchAnswersOfCharacter($questId, $characterId, $answers)
|
||||
{
|
||||
return $this->controller->matchAnswersOfCharacter($questId, $characterId, $answers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Controller of this Agent.
|
||||
*
|
||||
|
|
@ -216,7 +244,11 @@
|
|||
}
|
||||
|
||||
// Determine Action
|
||||
$action = \nre\configs\CoreConfig::$defaults['action'];
|
||||
$action = $this->response->getParam(2);
|
||||
if(is_null($action)) {
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
$this->response->addParam($action);
|
||||
}
|
||||
|
||||
|
||||
// Load Controller
|
||||
|
|
|
|||
|
|
@ -29,6 +29,52 @@
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answers of a Character for a Quest.
|
||||
*
|
||||
* @param int $questId ID of Quest to save answers for
|
||||
* @param int $characterId ID of Character to save answers of
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public abstract function saveAnswersOfCharacter($questId, $characterId, $answers);
|
||||
|
||||
|
||||
/**
|
||||
* Check if answers of a Character for a Quest match the correct ones.
|
||||
*
|
||||
* @param int $questId ID of Quest to match answers for
|
||||
* @param int $characterId ID of Character to match answers of
|
||||
* @param array $answers Character answers for the Quest
|
||||
* @return boolean True/false for a right/wrong answer or null for moderator evaluation
|
||||
*/
|
||||
public abstract function matchAnswersOfCharacter($questId, $characterId, $answers);
|
||||
|
||||
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
* Show the task of a Quest.
|
||||
*
|
||||
* @param int $questId ID of Quest to show
|
||||
* @param int $characterId ID of Character
|
||||
*/
|
||||
public abstract function quest($questId, $characterId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: submission.
|
||||
*
|
||||
* Show the submission of a Character for a Quest.
|
||||
*
|
||||
* @param int $questId ID of Quest to show submission for
|
||||
* @param int $characterId ID of Character to show submission of
|
||||
*/
|
||||
public abstract function submission($questId, $characterId);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a QuesttypeController.
|
||||
*
|
||||
|
|
@ -255,7 +301,7 @@
|
|||
$character = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']);
|
||||
|
||||
// Set solved
|
||||
$this->Quests->setQuestSolved($quest['id'], $character['id']);
|
||||
$this->Quests->setQuestSolved($quest['id'], $character['id']);
|
||||
|
||||
|
||||
// Redirect
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue