handle empty Quests

This commit is contained in:
coderkun 2014-04-16 11:54:20 +02:00
commit 0a05f0360e
2 changed files with 13 additions and 5 deletions

View file

@ -252,7 +252,13 @@
$questtype = $this->Questtypes->getQuesttypeById($quest['questtype_id']); $questtype = $this->Questtypes->getQuesttypeById($quest['questtype_id']);
// Render task // Render task
$task = $this->renderTask($questtype['classname'], $seminary, $questgroup, $quest, $character); if(!is_null($questtype['classname'])) {
$task = $this->renderTask($questtype['classname'], $seminary, $questgroup, $quest, $character);
}
else {
// Mark Quest as solved
$this->Quests->setQuestSolved($quest['id'], $character['id']);
}
} }
// Has Character solved quest? // Has Character solved quest?

View file

@ -45,19 +45,21 @@
</section> </section>
<?php endif ?> <?php endif ?>
<?php if(!is_null($task)) : ?> <?php if($questtexttype['type'] == 'Prolog') : ?>
<section> <section>
<?php if(!is_null($task)) : ?>
<h1 id="task"><?=_('Task')?></h1> <h1 id="task"><?=_('Task')?></h1>
<p><?=\hhu\z\Utils::t($quest['task'])?></p> <p><?=\hhu\z\Utils::t($quest['task'])?></p>
<?=$task?> <?=$task?>
<?php endif ?>
<?php if($solved) : ?> <?php if($solved && !is_null($task)) : ?>
<p><?=_('Task already successfully solved')?>:</p> <p><?=_('Task already successfully solved')?>:</p>
<?php endif ?>
<ul> <ul>
<li><a href="<?=$linker->link(null,0,false,array('show-answer'=>'true'),true,'task')?>"><?=_('Show answer')?></a></li> <?php if(!is_null($task)) : ?><li><a href="<?=$linker->link(null,0,false,array('show-answer'=>'true'),true,'task')?>"><?=_('Show answer')?></a></li><?php endif ?>
<li><a href="<?=$linker->link('Epilog',5)?>">Aufgabe Überspringen</a></l> <li><a href="<?=$linker->link('Epilog',5)?>">Aufgabe Überspringen</a></l>
</ul> </ul>
<?php endif ?>
</section> </section>
<?php endif ?> <?php endif ?>