implement QuestgroupspictureAgent to include the picture of a Questgroup
This commit is contained in:
parent
77c2e9d2a9
commit
fd89f0e3f8
3 changed files with 98 additions and 0 deletions
35
agents/bottomlevel/QuestgroupspictureAgent.inc
Normal file
35
agents/bottomlevel/QuestgroupspictureAgent.inc
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?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\bottomlevel;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agent to display the picture of a Questgroup.
|
||||||
|
*
|
||||||
|
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||||
|
*/
|
||||||
|
class QuestgroupspictureAgent extends \nre\agents\BottomlevelAgent
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action: index.
|
||||||
|
*/
|
||||||
|
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
60
controllers/QuestgroupspictureController.inc
Normal file
60
controllers/QuestgroupspictureController.inc
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?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 QuestgroupspictureAgent to display the picture of a
|
||||||
|
* Questgroups.
|
||||||
|
*
|
||||||
|
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||||
|
*/
|
||||||
|
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 = $this->Media->getMediaById($questgroup['questgroupspicture_id']);
|
||||||
|
|
||||||
|
|
||||||
|
// Pass data to view
|
||||||
|
$this->set('seminary', $seminary);
|
||||||
|
$this->set('picture', $picture);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
3
views/html/questgroupspicture/index.tpl
Normal file
3
views/html/questgroupspicture/index.tpl
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php if(!is_null($picture)) : ?>
|
||||||
|
<img src="<?=$linker->link(array('media','index',$seminary['url'],$picture['url']))?>" />
|
||||||
|
<?php endif ?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue