diff --git a/agents/intermediate/QrAgent.inc b/agents/intermediate/QrAgent.inc new file mode 100644 index 00000000..89314a46 --- /dev/null +++ b/agents/intermediate/QrAgent.inc @@ -0,0 +1,38 @@ + + * @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 + */ + 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) + { + } + + } + +?> diff --git a/controllers/QrController.inc b/controllers/QrController.inc new file mode 100644 index 00000000..2e391f14 --- /dev/null +++ b/controllers/QrController.inc @@ -0,0 +1,67 @@ + + * @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 + */ + 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'] + ))); + } + + } + +?> diff --git a/views/html/qr/cgqs.tpl b/views/html/qr/cgqs.tpl new file mode 100644 index 00000000..e69de29b