handle empty Quests

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

View file

@ -252,7 +252,13 @@
$questtype = $this->Questtypes->getQuesttypeById($quest['questtype_id']);
// 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?

View file

@ -45,19 +45,21 @@
</section>
<?php endif ?>
<?php if(!is_null($task)) : ?>
<?php if($questtexttype['type'] == 'Prolog') : ?>
<section>
<?php if(!is_null($task)) : ?>
<h1 id="task"><?=_('Task')?></h1>
<p><?=\hhu\z\Utils::t($quest['task'])?></p>
<?=$task?>
<?php endif ?>
<?php if($solved) : ?>
<?php if($solved && !is_null($task)) : ?>
<p><?=_('Task already successfully solved')?>:</p>
<?php endif ?>
<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>
</ul>
<?php endif ?>
</section>
<?php endif ?>