add namespaces to docstring types

This commit is contained in:
coderkun 2015-03-06 12:19:07 +01:00
commit 969887da58
98 changed files with 632 additions and 555 deletions

View file

@ -93,7 +93,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{
@ -227,6 +227,23 @@
*/
public function edittask($seminary, $questgroup, $quest)
{
$fight = $this->Bossfight->getBossFight($quest['id']);
/*
if(!is_null($fight['boss_seminarymedia_id'])) {
$fight['bossmedia'] = $this->Media->getSeminaryMediaById($fight['boss_seminarymedia_id']);
}
*/
// Get stages
$stage = $this->Bossfight->getFirstStage($quest['id']);
$stage['childs'] = $this->getChildStages($stage['id']);
// Pass data to view
$this->set('seminary', $seminary);
$this->set('fight', $fight);
$this->set('stages', $stage);
//print_r($stage);
}
@ -249,6 +266,26 @@
$_SESSION['quests'][$questId]['stages'] = array();
}
}
/**
* Get all child-stages of a parent-stage.
*
* @param int $stageId ID of parent-stage
* @return array List of child-stages
*/
private function getChildStages($stageId)
{
$childStages = $this->Bossfight->getChildStages($stageId);
if(!empty($childStages)) {
foreach($childStages as &$stage) {
$stage['childs'] = $this->getChildStages($stage['id']);
}
}
return $childStages;
}
}

View file

@ -26,7 +26,7 @@
/**
* Get a Boss-Fight.
*
* @throws IdNotFoundException
* @throws \nre\exceptions\IdNotFoundException
* @param int $questId ID of Quest
* @return array Boss-Fight data
*/

View file

@ -1 +1,41 @@
<p>TODO</p>
<form method="post" enctype="multipart/form-data">
<fieldset>
<legend><?=_('Boss-Fight')?></legend>
<label><?=_('Boss name')?></label>
<input type="text" name="bossname" value="<?=$fight['bossname']?>" /><br />
<label><?=_('Boss image')?></label>
<input type="file" name="bossimage" /><br />
<label><?=_('Boss lives')?></label>
<input type="number" name="lives_boss" value="<?=$fight['lives_boss']?>" /><br />
<label><?=_('Character lives')?></label>
<input type="number" name="lives_character" value="<?=$fight['lives_character']?>" />
</fieldset>
<fieldset>
<legend><?=_('Stages')?></legend>
<?php renderStage($stages, $fight['lives_boss'], $fight['lives_character']); ?>
</fieldset>
<input type="submit" name="save" value="<?=_('save')?>" />
</form>
<?php function renderStage($stage, $livesBoss, $livesCharacter, $level=0, $indices=array()) { ?>
<div style="margin-left:<?=$level?>em">
<h2><?=implode('.', $indices)?></h2>
<?php if(!empty($stage['question'])) : ?>
<p><?=$stage['question']?></p>
<?php endif ?>
<p><?=_('Character')?> <?=$livesCharacter?> vs. <?=$livesBoss?> <?=_('Boss')?></p>
<p><?=$stage['text']?></p>
<?php foreach($stage['childs'] as $index => &$childStage) : ?>
<?php $childIndices = $indices; ?>
<?php $childIndices[] = $index+1; ?>
<?php renderStage($childStage, $livesBoss+$childStage['livedrain_boss'], $livesCharacter+$childStage['livedrain_character'], $level+1, $childIndices); ?>
<?php endforeach ?>
<?php if($livesBoss == 0 && $livesCharacter == 0) : ?>
Bedie verloren
<?php elseif($livesBoss == 0) : ?>
Boss verloren, Character gewonnen
<?php elseif($livesCharacter == 0) : ?>
Boss gewonnen, Character verloren
<?php endif ?>
</div>
<?php } ?>

View file

@ -110,7 +110,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{

View file

@ -169,7 +169,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{

View file

@ -125,7 +125,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{

View file

@ -138,7 +138,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{

View file

@ -32,7 +32,7 @@
/**
* Save the answers of a Character for a Quest.
*
* @throws SubmissionNotValidException
* @throws \hhu\z\exceptions\SubmissionNotValidException
* @param array $seminary Current Seminary data
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
@ -137,7 +137,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{

View file

@ -110,7 +110,7 @@
* @param array $questgroup Current Questgroup data
* @param array $quest Current Quest data
* @param array $character Current Character data
* @param Exception $exception Character submission exception
* @param \Exception $exception Character submission exception
*/
public function quest($seminary, $questgroup, $quest, $character, $exception)
{