add QrAgent for short URLs used in QR codes

This commit is contained in:
oliver 2015-12-25 16:44:47 +01:00
parent c424cfe30c
commit 939cf7b08e
3 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<?php
/**
* The Legend of Z
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://bitbucket.org/coderkun/the-legend-of-z
*/
namespace hhu\z\agents\intermediate;
/**
* Agent to redirect to a page from a (short) QR-code link.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class QrAgent extends \nre\agents\IntermediateAgent
{
/**
* Action: index.
*
* @param \nre\core\Request $request Current request
* @param \nre\core\Response $response Current response
*/
public function index(\nre\core\Request $request, \nre\core\Response $response)
{
}
}
?>

View file

@ -0,0 +1,67 @@
<?php
/**
* The Legend of Z
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://bitbucket.org/coderkun/the-legend-of-z
*/
namespace hhu\z\controllers;
/**
* Controller of the QrAgent to redirect to a page from a (short) QR-code
* link.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class QrController extends \hhu\z\controllers\SeminaryController
{
/**
* Required models
*
* @var array
*/
public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'charactergroupsqueststations');
/**
* Action: cgqs.
*
* Redirect to a Character groups Quest Station.
*
* @param int $stationId ID of Character groups Quest Station
*/
public function cgqs($stationId)
{
// Get station
$station = $this->Charactergroupsqueststations->getStationById($stationId);
// Get Character groups Quests
$quest = $this->Charactergroupsquests->getQuestById($station['charactergroupsquest_id']);
// Get Character groups-group
$groupsgroup = $this->Charactergroups->getGroupsgroupById($quest['charactergroupsgroup_id']);
// Get seminary
$seminary = $this->Seminaries->getSeminaryById($groupsgroup['seminary_id']);
// Redirect
$this->redirect($this->linker->link(array(
'charactergroupsqueststations',
'station',
$seminary['url'],
$groupsgroup['url'],
$quest['url'],
$station['url']
)));
}
}
?>

0
views/html/qr/cgqs.tpl Normal file
View file