assign Character titles via QR-codes (implements #118)
This commit is contained in:
parent
9097e8ab70
commit
45e7821363
6 changed files with 101 additions and 3 deletions
|
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'achievements', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations', 'charactergroupsachievements');
|
||||
public $models = array('seminaries', 'achievements', 'charactertitles', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations', 'charactergroupsachievements');
|
||||
|
||||
|
||||
|
||||
|
|
@ -103,6 +103,47 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: ct.
|
||||
*
|
||||
* Trigger a Character title by a hash typically provided via a QR-code.
|
||||
*
|
||||
* @param $titleHash Hash value of Character title
|
||||
*/
|
||||
public function ct($titleHash)
|
||||
{
|
||||
// Get Character title
|
||||
$title = $this->Charactertitles->getTitleByHash($titleHash);
|
||||
|
||||
// Get Seminary
|
||||
$seminary = $this->Seminaries->getSeminaryById($title['seminary_id']);
|
||||
|
||||
// Get Character
|
||||
$character = $this->Characters->getCharacterForUserAndSeminary(
|
||||
self::$user['id'],
|
||||
$seminary['id']
|
||||
);
|
||||
|
||||
// Assign title to Character
|
||||
$this->Charactertitles->assignTitleToCharacter(
|
||||
$title['id'],
|
||||
$character['id']
|
||||
);
|
||||
|
||||
// Redirect
|
||||
$this->redirect(
|
||||
$this->linker->link(
|
||||
array(
|
||||
'characters',
|
||||
'character',
|
||||
$seminary['url'],
|
||||
$character['url']
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: cgqs.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue