add QR-codes for Character groups Achievements (implements #124)
This commit is contained in:
parent
dd2b15bbd7
commit
bdfd021673
4 changed files with 73 additions and 2 deletions
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations');
|
||||
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations', 'charactergroupsachievements');
|
||||
|
||||
|
||||
|
||||
|
@ -62,6 +62,39 @@
|
|||
)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: cga.
|
||||
*
|
||||
* Redirect to a Character groups Achievements
|
||||
*
|
||||
* @param string $achievementHash Hash of Character groups Achievement
|
||||
*/
|
||||
public function cga($achievementHash)
|
||||
{
|
||||
// Get Achievement
|
||||
$achievement = $this->Charactergroupsachievements->getAchievementByHash($achievementHash);
|
||||
|
||||
// Get Character groups-group
|
||||
$groupsgroup = $this->Charactergroups->getGroupsgroupById($achievement['charactergroupsgroup_id']);
|
||||
|
||||
// Get seminary
|
||||
$seminary = $this->Seminaries->getSeminaryById($groupsgroup['seminary_id']);
|
||||
|
||||
// Redirect
|
||||
$this->redirect(
|
||||
$this->linker->link(
|
||||
array(
|
||||
'charactergroupsachievements',
|
||||
'achievement',
|
||||
$seminary['url'],
|
||||
$groupsgroup['url'],
|
||||
$achievement['hash']
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations');
|
||||
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations', 'charactergroupsachievements');
|
||||
|
||||
|
||||
|
||||
|
@ -84,6 +84,43 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: charactergroupsachievements
|
||||
*
|
||||
* Display a QR-code for a Character groups Achievement
|
||||
*
|
||||
* @throws \nre\exceptions\IdNotFoundException
|
||||
* @param string $seminaryUrl URL-Title of a Seminary
|
||||
* @param string $groupsgroupUrl URL-Title of a Character groups-group
|
||||
* @param string $achievementUrl URL of Achievement
|
||||
*/
|
||||
public function charactergroupsachievements($seminaryUrl, $groupsgroupUrl, $achievementUrl, $size=1)
|
||||
{
|
||||
// Get seminary
|
||||
$seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
|
||||
|
||||
// Get Character groups-group
|
||||
$groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
|
||||
|
||||
// Get Achievement
|
||||
$achievement = $this->Charactergroupsachievements->getAchievementByUrl(
|
||||
$groupsgroup['id'],
|
||||
$achievementUrl
|
||||
);
|
||||
|
||||
// Generate QR-code
|
||||
$url = $this->linker->link(array('qr', 'cga', $achievement['hash']), 0, true, null, true, null, true);
|
||||
$file = $this->generateQRcode($url, $size);
|
||||
if(is_null($file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Pass data to view
|
||||
$this->set('file', $file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
1
views/binary/qrcodes/charactergroupsachievements.tpl
Normal file
1
views/binary/qrcodes/charactergroupsachievements.tpl
Normal file
|
@ -0,0 +1 @@
|
|||
<?=$file?>
|
0
views/html/qr/cga.tpl
Normal file
0
views/html/qr/cga.tpl
Normal file
Loading…
Reference in a new issue