diff --git a/agents/bottomlevel/QuestgroupspictureAgent.inc b/agents/bottomlevel/QuestgroupspictureAgent.inc deleted file mode 100644 index 8cdca7cd..00000000 --- a/agents/bottomlevel/QuestgroupspictureAgent.inc +++ /dev/null @@ -1,35 +0,0 @@ - - * @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\bottomlevel; - - - /** - * Agent to display the picture of a Questgroup. - * - * @author Oliver Hanraths - */ - class QuestgroupspictureAgent extends \nre\agents\BottomlevelAgent - { - - - - - /** - * Action: index. - */ - public function index(\nre\core\Request $request, \nre\core\Response $response) - { - } - - } - -?> diff --git a/agents/intermediate/QuestgroupsAgent.inc b/agents/intermediate/QuestgroupsAgent.inc index 860fd177..52ecd4e1 100644 --- a/agents/intermediate/QuestgroupsAgent.inc +++ b/agents/intermediate/QuestgroupsAgent.inc @@ -29,7 +29,6 @@ public function questgroup(\nre\core\Request $request, \nre\core\Response $response) { $this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4)); - $this->addSubAgent('Questgroupspicture', 'index', $request->getParam(3), $request->getParam(4), true); } } diff --git a/agents/intermediate/QuestsAgent.inc b/agents/intermediate/QuestsAgent.inc index 1a823fa6..273a47ab 100644 --- a/agents/intermediate/QuestsAgent.inc +++ b/agents/intermediate/QuestsAgent.inc @@ -29,7 +29,6 @@ public function quest(\nre\core\Request $request, \nre\core\Response $response) { $this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true); - $this->addSubAgent('Questgroupspicture', 'index', $request->getParam(3), $request->getParam(4), true); } @@ -39,7 +38,6 @@ public function submissions(\nre\core\Request $request, \nre\core\Response $response) { $this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true); - $this->addSubAgent('Questgroupspicture', 'index', $request->getParam(3), $request->getParam(4), true); } @@ -49,7 +47,6 @@ public function submission(\nre\core\Request $request, \nre\core\Response $response) { $this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true); - $this->addSubAgent('Questgroupspicture', 'index', $request->getParam(3), $request->getParam(4), true); } } diff --git a/controllers/QuestgroupsController.inc b/controllers/QuestgroupsController.inc index 8a04d0bd..b89c98a6 100644 --- a/controllers/QuestgroupsController.inc +++ b/controllers/QuestgroupsController.inc @@ -24,7 +24,7 @@ * * @var array */ - public $models = array('seminaries', 'questgroupshierarchy', 'questgroups', 'quests', 'questtexts'); + public $models = array('seminaries', 'questgroupshierarchy', 'questgroups', 'quests', 'questtexts', 'media'); /** * User permissions * @@ -105,6 +105,13 @@ // Get Character XPs $questgroup['character_xps'] = $this->Questgroups->getAchievedXPsForQuestgroup($questgroup['id'], $character['id']); + + // Media + $picture = null; + if(!is_null($questgroup['questgroupspicture_id'])) + { + $picture = $this->Media->getMediaById($questgroup['questgroupspicture_id']); + } // Get Quests @@ -133,6 +140,7 @@ $this->set('questgroup', $questgroup); $this->set('childquestgroupshierarchy', $childQuestgroupshierarchy); $this->set('texts', $questgroupTexts); + $this->set('picture', $picture); $this->set('quests', $quests); } diff --git a/controllers/QuestgroupspictureController.inc b/controllers/QuestgroupspictureController.inc deleted file mode 100644 index 7810869b..00000000 --- a/controllers/QuestgroupspictureController.inc +++ /dev/null @@ -1,65 +0,0 @@ - - * @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 QuestgroupspictureAgent to display the picture of a - * Questgroups. - * - * @author Oliver Hanraths - */ - class QuestgroupspictureController extends \hhu\z\Controller - { - /** - * Required models - * - * @var array - */ - public $models = array('seminaries', 'questgroups', 'media'); - - - - - /** - * Action: index. - * - * Show the picture of a Questgroup. - * - * @param string $seminaryUrl URL-Title of a Seminary - * @param string $questgroupUrl URL-Title of a Questgroup - */ - public function index($seminaryUrl, $questgroupUrl) - { - // Get Seminary - $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); - - // Get Questgroup - $questgroup = $this->Questgroups->getQuestgroupByUrl($seminary['id'], $questgroupUrl); - - // Get Picture - $picture = null; - try { - $picture = $this->Media->getMediaById($questgroup['questgroupspicture_id']); - } - catch(\nre\exceptions\IdNotFoundException $e) { - } - - - // Pass data to view - $this->set('seminary', $seminary); - $this->set('picture', $picture); - } - - } - -?> diff --git a/controllers/QuestsController.inc b/controllers/QuestsController.inc index 03caa466..f0829c54 100644 --- a/controllers/QuestsController.inc +++ b/controllers/QuestsController.inc @@ -68,6 +68,11 @@ // Get Questgroup $questgroup = $this->Questgroups->getQuestgroupByUrl($seminary['id'], $questgroupUrl); + $questgroup['picture'] = null; + if(!is_null($questgroup['questgroupspicture_id'])) { + $questgroup['picture'] = $this->Media->getMediaById($questgroup['questgroupspicture_id']); + } + // Get Quest $quest = $this->Quests->getQuestByUrl($seminary['id'], $questgroup['id'], $questUrl); diff --git a/views/html/questgroups/questgroup.tpl b/views/html/questgroups/questgroup.tpl index f1c2842b..f4c9b002 100644 --- a/views/html/questgroups/questgroup.tpl +++ b/views/html/questgroups/questgroup.tpl @@ -1,8 +1,8 @@ +
- +
- - +

diff --git a/views/html/questgroupspicture/index.tpl b/views/html/questgroupspicture/index.tpl deleted file mode 100644 index d8c7b32c..00000000 --- a/views/html/questgroupspicture/index.tpl +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/views/html/quests/quest.tpl b/views/html/quests/quest.tpl index 79ee88d3..6045f06a 100644 --- a/views/html/quests/quest.tpl +++ b/views/html/quests/quest.tpl @@ -1,7 +1,11 @@ + +
+ +
+

-