fix labels and text editors for Quest creation

This commit is contained in:
oliver 2016-01-15 12:33:07 +01:00
commit 476c18b6a9
4278 changed files with 1196345 additions and 0 deletions

View file

View file

@ -0,0 +1,114 @@
<?=$moodpic?>
<ul class="breadcrumbs">
<li><a href="<?=$linker->link('index',1)?>"><?=_('Seminaries')?></a></li>
</ul>
<h1><?=_('Copy seminary')?></h1>
<?php if(!is_null($exception)) : ?>
<p class="error">
<?php if($exception instanceof \hhu\z\exceptions\FileCopyException) : ?>
<?=sprintf(_('Copying of files failed: “%s”'), $exception->getNestedError()['message'])?>
<?php elseif($exception instanceof \Exception) : ?>
<?=sprintf(_('Copying of Seminary failed: “%s”'), $exception->getMessage())?>
<?php endif ?>
</p>
<?php endif ?>
<?php if($validation !== true && !empty($validation)) : ?>
<ul class="validation">
<?php foreach($validation as $field => &$settings) : ?>
<li>
<ul>
<?php foreach($settings as $setting => $value) : ?>
<li>
<?php switch($field) {
case 'moodpic':
switch($setting) {
case 'error': printf(_('Error during moodpic upload: %s'), $value);
break;
case 'mimetype': printf(_('Moodpic has wrong type “%s”'), $value);
break;
case 'size': echo _('Moodpic exceeds size maximum');
break;
default: echo _('Moodpic invalid');
}
break;
case 'title':
switch($setting) {
case 'minlength': printf(_('Title is too short (min. %d chars)'), $value);
break;
case 'maxlength': printf(_('Title is too long (max. %d chars)'), $value);
break;
case 'regex': echo _('Title contains illegal characters');
break;
case 'exist': echo _('Title already exists');
break;
default: echo _('Title invalid');
}
break;
case 'course':
switch($setting) {
case 'maxlength': printf(_('Course is too long (max. %d chars)'), $value);
break;
default: echo _('Course invalid');
}
break;
} ?>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
<form method="post" class="logreg" enctype="multipart/form-data">
<fieldset>
<label for="title"><?=_('Title')?>:</label>
<input type="text" id="title" name="title" placeholder="<?=_('Title')?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=($validation !== true && array_key_exists('title', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="course"><?=_('Course')?>:</label>
<input type="text" id="course" name="course" placeholder="<?=_('Course')?>" maxlength="<?=$validationSettings['course']['maxlength']?>" value="<?=$course?>" <?=($validation !== true && array_key_exists('course', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="description"><?=_('Description')?>:<br />
<textarea id="description" name="description" placeholder="<?=_('Description')?>"><?=$description?></textarea><br />
</fieldset>
<fieldset>
<legend><?=_('Elements')?></legend>
<input type="checkbox" id="elements_seminaryfields" name="elements[seminaryfields]" <?php if(array_key_exists('seminaryfields', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_seminaryfields"><?=_('Seminary fields')?></label>
<input type="checkbox" id="elements_media" name="elements[media]" <?php if(array_key_exists('media', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_media"><?=_('Media')?></label>
<input type="checkbox" id="elements_questgroupshierarchy" name="elements[questgroupshierarchy]" <?php if(array_key_exists('questgroupshierarchy', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_questgroupshierarchy"><?=_('Questgroupshierarchy')?></label>
<div class="cond">
<input type="checkbox" id="elements_questgroups" name="elements[questgroups]" <?php if(array_key_exists('questgroups', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_questgroups"><?=_('Questgroups')?></label>
<div class="cond">
<input type="checkbox" id="elements_quests" name="elements[quests]" <?php if(array_key_exists('quests', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_quests"><?=_('Quests')?></label>
<div class="cond">
<input type="checkbox" id="elements_questtopics" name="elements[questtopics]" <?php if(array_key_exists('questtopics', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_questtopics"><?=_('Library')?></label>
</div>
</div>
</div>
<input type="checkbox" id="elements_charactertypes" name="elements[charactertypes]" <?php if(array_key_exists('charactertypes', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_charactertypes"><?=_('Charactertypes')?></label>
<div class="cond">
<input type="checkbox" id="elements_xplevels" name="elements[xplevels]" <?php if(array_key_exists('xplevels', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_xplevels"><?=_('XP-Levels')?></label>
<div class="cond">
<input type="checkbox" id="elements_avatars" name="elements[avatars]" <?php if(array_key_exists('avatars', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_avatars"><?=_('Avatars')?></label>
</div>
</div>
<input type="checkbox" id="elements_achievements" name="elements[achievements]" <?php if(array_key_exists('achievements', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_achievements"><?=_('Achievements')?></label>
<input type="checkbox" id="elements_charactergroupsgroups" name="elements[charactergroupsgroups]" <?php if(array_key_exists('charactergroupsgroups', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_charactergroupsgroups"><?=_('Character Groups')?></label>
<div class="cond">
<input type="checkbox" id="elements_charactergroupsquests" name="elements[charactergroupsquests]" <?php if(array_key_exists('charactergroupsquests', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_charactergroupsquests"><?=_('Character Groups Quests')?></label>
</div>
<input type="checkbox" id="elements_map" name="elements[map]" <?php if(array_key_exists('map', $elements)) : ?>checked="checked"<?php endif ?> />
<label for="elements_map"><?=_('Map')?></label>
</fieldset>
<input type="submit" name="edit" value="<?=_('copy')?>" />
</form>

View file

@ -0,0 +1,74 @@
<?=$moodpic?>
<ul class="breadcrumbs">
<li><a href="<?=$linker->link('index',1)?>"><?=_('Seminaries')?></a></li>
</ul>
<h1><?=_('New seminary')?></h1>
<?php if($validation !== true && !empty($validation)) : ?>
<ul class="validation">
<?php foreach($validation as $field => &$settings) : ?>
<li>
<ul>
<?php foreach($settings as $setting => $value) : ?>
<li>
<?php switch($field) {
case 'moodpic':
switch($setting) {
case 'error': printf(_('Error during moodpic upload: %s'), $value);
break;
case 'mimetype': printf(_('Moodpic has wrong type “%s”'), $value);
break;
case 'size': echo _('Moodpic exceeds size maximum');
break;
default: echo _('Moodpic invalid');
}
break;
case 'title':
switch($setting) {
case 'minlength': printf(_('Title is too short (min. %d chars)'), $value);
break;
case 'maxlength': printf(_('Title is too long (max. %d chars)'), $value);
break;
case 'regex': echo _('Title contains illegal characters');
break;
case 'exist': echo _('Title already exists');
break;
default: echo _('Title invalid');
}
break;
case 'course':
switch($setting) {
case 'maxlength': printf(_('Course is too long (max. %d chars)'), $value);
break;
default: echo _('Course invalid');
}
break;
} ?>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
<form method="post" class="logreg" enctype="multipart/form-data">
<fieldset>
<legend><?=_('Moodpic')?></legend>
<input type="file" name="moodpic" accept="<?=implode(',', array_map(function($m) { return $m['mimetype']; }, $mimetypes))?>" />
<p><?=_('Allowed file types')?>:</p>
<ul>
<?php foreach($mimetypes as &$mimetype) : ?>
<li><?=sprintf(_('%s-files'), strtoupper(explode('/',$mimetype['mimetype'])[1]))?> <?php if($mimetype['size'] > 0) : ?>(<?=_('max.')?> <?=round($mimetype['size']/(1024*1024),2)?>MiB)<?php endif ?></li>
<?php endforeach ?>
</ul>
</fieldset>
<fieldset>
<label for="title"><?=_('Title')?>:</label>
<input type="text" name="title" placeholder="<?=_('Title')?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=(array_key_exists('title', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="course"><?=_('Course')?>:</label>
<input type="text" name="course" placeholder="<?=_('Course')?>" maxlength="<?=$validationSettings['course']['maxlength']?>" value="<?=$course?>" <?=(array_key_exists('course', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="description"><?=_('Description')?>:<br />
<textarea name="description" placeholder="<?=_('Description')?>"><?=$description?></textarea><br />
</fieldset>
<input type="submit" name="create" value="<?=_('create')?>" />
</form>

View file

@ -0,0 +1,11 @@
<?=$moodpic?>
<ul class="breadcrumbs">
<li><a href="<?=$linker->link('index',1)?>"><?=_('Seminaries')?></a></li>
</ul>
<h1><?=_('Delete seminary')?></h1>
<?=sprintf(_('Should the seminary “%s” really be deleted?'), $seminary['title'])?>
<form method="post">
<input type="submit" name="delete" value="<?=_('delete')?>" />
<input type="submit" name="not-delete" value="<?=_('cancel')?>" />
</form>

View file

@ -0,0 +1,74 @@
<?=$moodpic?>
<ul class="breadcrumbs">
<li><a href="<?=$linker->link('index',1)?>"><?=_('Seminaries')?></a></li>
</ul>
<h1><?=_('Edit seminary')?></h1>
<?php if($validation !== true && !empty($validation)) : ?>
<ul class="validation">
<?php foreach($validation as $field => &$settings) : ?>
<li>
<ul>
<?php foreach($settings as $setting => $value) : ?>
<li>
<?php switch($field) {
case 'moodpic':
switch($setting) {
case 'error': printf(_('Error during moodpic upload: %s'), $value);
break;
case 'mimetype': printf(_('Moodpic has wrong type “%s”'), $value);
break;
case 'size': echo _('Moodpic exceeds size maximum');
break;
default: echo _('Moodpic invalid');
}
break;
case 'title':
switch($setting) {
case 'minlength': printf(_('Title is too short (min. %d chars)'), $value);
break;
case 'maxlength': printf(_('Title is too long (max. %d chars)'), $value);
break;
case 'regex': echo _('Title contains illegal characters');
break;
case 'exist': echo _('Title already exists');
break;
default: echo _('Title invalid');
}
break;
case 'course':
switch($setting) {
case 'maxlength': printf(_('Course is too long (max. %d chars)'), $value);
break;
default: echo _('Course invalid');
}
break;
} ?>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
<form method="post" class="logreg" enctype="multipart/form-data">
<fieldset>
<legend><?=_('Moodpic')?></legend>
<input type="file" name="moodpic" accept="<?=implode(',', array_map(function($m) { return $m['mimetype']; }, $mimetypes))?>" />
<p><?=_('Allowed file types')?>:</p>
<ul>
<?php foreach($mimetypes as &$mimetype) : ?>
<li><?=sprintf(_('%s-files'), strtoupper(explode('/',$mimetype['mimetype'])[1]))?> <?php if($mimetype['size'] > 0) : ?>(<?=_('max.')?> <?=round($mimetype['size']/(1024*1024),2)?>MiB)<?php endif ?></li>
<?php endforeach ?>
</ul>
</fieldset>
<fieldset>
<label for="title"><?=_('Title')?>:</label>
<input type="text" name="title" placeholder="<?=_('Title')?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" value="<?=$title?>" <?=(array_key_exists('title', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="course"><?=_('Course')?>:</label>
<input type="text" name="course" placeholder="<?=_('Course')?>" maxlength="<?=$validationSettings['course']['maxlength']?>" value="<?=$course?>" <?=(array_key_exists('course', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="description"><?=_('Description')?>:<br />
<textarea name="description" placeholder="<?=_('Description')?>"><?=$description?></textarea><br />
</fieldset>
<input type="submit" name="edit" value="<?=_('edit')?>" />
</form>

View file

@ -0,0 +1,51 @@
<?=$moodpic?>
<h1><?=_('Seminaries')?></h1>
<?php if(count(array_intersect(array('admin','moderator'),\hhu\z\controllers\IntermediateController::$user['roles'])) > 0) : ?>
<nav class="admin">
<li><a href="<?=$linker->link('create', 1)?>"><?=_('Create new seminary')?></a></li>
</nav>
<?php endif ?>
<ul class="questgroups cf">
<?php foreach($seminaries as &$seminary) : ?>
<li>
<?php if(!is_null($seminary['seminarymedia_id'])) : ?>
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url']))?>" />
<?php endif ?>
<section>
<p class="fwb">
<?php if(array_key_exists('usercharacter', $seminary) && count($seminary['usercharacter']['characterroles']) > 0) : ?>
<a href="<?=$linker->link(array('seminary', $seminary['url']), 1)?>"><?=$seminary['title']?></a>
<?php else : ?>
<?=$seminary['title']?>
<?php endif ?>
</p>
<?php if(array_key_exists('usercharacter', $seminary)) : ?>
<div class="cf">
<div class="xpbar">
<span style="width:<?=($seminary['xps'] > 0) ? round($seminary['usercharacter']['xps'] * 100 / $seminary['xps']) : 0?>%"></span>
</div>
<p class="xpnumeric"><?=$seminary['usercharacter']['xps']?> / <?=sprintf(_('%dXPs'), $seminary['xps'])?></p>
</div>
<?php endif ?>
<p><?=\hhu\z\Utils::t($seminary['description'])?></p>
<p><small><?=sprintf(_('created by %s on %s'), $seminary['creator']['username'], $dateFormatter->format(new \DateTime($seminary['created'])))?></small></p>
<?php if(!array_key_exists('usercharacter', $seminary)) : ?>
<?php if($seminary['created_user_id'] == \hhu\z\controllers\IntermediateController::$user['id']) : ?>
<a class="cta orange" href="<?=$linker->link(array('xplevels','manage',$seminary['url']))?>"><?=_('Manage XP-levels')?></a>
<?php if(count($seminary['xplevels']) > 0) : ?>
<a class="cta orange" href="<?=$linker->link(array('charactertypes','index',$seminary['url']))?>"><?=_('Manage Charactertypes')?></a>
<?php endif ?>
<?php endif ?>
<?php if(count($seminary['charactertypes']) > 0) : ?>
<a class="cta orange" href="<?=$linker->link(array('characters','register',$seminary['url']))?>"><?=_('Create a Character')?></a>
<?php endif ?>
<?php elseif(count($seminary['usercharacter']['characterroles']) == 0) : ?>
<p><?=sprintf(_('Your Character “%s” has not been activated yet'), $seminary['usercharacter']['name'])?></p>
<?php endif ?>
</section>
</li>
<?php endforeach ?>
</ul>

View file

@ -0,0 +1,80 @@
<?=$moodpic?>
<h1><?=$seminary['title']?></h1>
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
<?php if(in_array('admin', \hhu\z\controllers\SeminaryController::$character['characterroles'])) : ?>
<nav class="admin">
<li><a href="<?=$linker->link('edit', 3)?>"><?=_('Edit seminary')?></a></li>
<li><a href="<?=$linker->link('copy', 3)?>"><?=_('Copy seminary')?></a></li>
<li><a href="<?=$linker->link('delete', 3)?>"><?=_('Delete seminary')?></a></li>
</nav>
<?php endif ?>
<nav class="admin">
<li><a href="<?=$linker->link(array('quests','index',$seminary['url']))?>"><?=_('Show Quests')?></a></li>
<li><a href="<?=$linker->link(array('calculatexps',$seminary['url']),1)?>"><?=_('Recalculate XPs')?></a></li>
</nav>
<?php endif ?>
<p><?=\hhu\z\Utils::t($seminary['description'])?></p>
<?php foreach($questgroupshierarchy as $hierarchyIndex => &$hierarchy) : ?>
<h2 id="<?=$hierarchy['url']?>"><?=$hierarchy['title_plural']?></h2>
<?php if(in_array('admin', \hhu\z\controllers\SeminaryController::$character['characterroles'])) : ?>
<nav class="admin">
<li><a href="<?=$linker->link(array('questgroupshierarchy','edit',$seminary['url'],$hierarchy['url']))?>"><?=_('Edit Questgroupshierarchy')?></a></li>
<li><a href="<?=$linker->link(array('questgroupshierarchy','delete',$seminary['url'],$hierarchy['url']))?>"><?=_('Delete Questgroupshierarchy')?></a></li>
<?php if($hierarchyIndex > 0) : ?><li><a href="<?=$linker->link(array('questgroupshierarchy','moveup',$seminary['url'],$hierarchy['url']))?>">↑</a></li><?php endif ?>
<?php if($hierarchyIndex < count($questgroupshierarchy)-1) : ?><li><a href="<?=$linker->link(array('questgroupshierarchy','movedown',$seminary['url'],$hierarchy['url']))?>">↓</a></li><?php endif ?>
</nav>
<?php endif ?>
<ul class="questgroups cf">
<?php foreach($hierarchy['questgroups'] as $questgroupIndex => &$group) : ?>
<li>
<?php if(!is_null($group['picture'])) : ?>
<img src="<?=$linker->link(array('media','seminary',$seminary['url'],$group['picture']['url']))?>">
<?php endif ?>
<section>
<div class="qgorder">
<?php if($questgroupIndex > 0) : ?><a href="<?=$linker->link(array('questgroups','moveup',$seminary['url'],$group['url']))?>">↑</a><?php endif ?>
<?php if($questgroupIndex < count($hierarchy['questgroups'])-1) : ?><a href="<?=$linker->link(array('questgroups','movedown',$seminary['url'],$group['url']))?>">↓</a><?php endif ?>
</div>
<div>
<p class="fwb"><?=$hierarchy['title_singular']?> <?=$group['pos']?>:
<a href="<?=$linker->link(array('questgroups','questgroup',$seminary['url'],$group['url']))?>"><?=$group['title']?></a></p>
</div>
<div class="cf">
<div class="xpbar">
<span style="width:<?=($group['achievable_xps'] > 0) ? round($group['character_xps']*100/$group['achievable_xps']) : 0?>%"></span>
</div>
<p class="xpnumeric"><?=$group['character_xps']?> / <?=$group['achievable_xps']?> XP</p>
</div>
<?php if(array_key_exists('text', $group)) : ?>
<p><?=$group['text']?></p>
<?php endif ?>
<a href="<?=$linker->link(array('questgroups','questgroup',$seminary['url'],$group['url']))?>" class="cta orange"><?=_('Lets go')?></a>
<?php if(in_array('admin', \hhu\z\controllers\SeminaryController::$character['characterroles'])) : ?>
<?php endif ?>
</section>
</li>
<?php endforeach?>
<?php if(in_array('admin', \hhu\z\controllers\SeminaryController::$character['characterroles'])) : ?>
<li>
<section>
<form method="post" action="<?=$linker->link(array('questgroups','create',$seminary['url']))?>" enctype="multipart/form-data">
<input type="hidden" name="questgroupshierarchy" value="<?=$hierarchy['url']?>" />
<input type="file" name="moodpic" />
<?=$hierarchy['title_singular']?> <?=count($hierarchy['questgroups'])+1?>:
<input type="text" name="title" value="" placeholder="<?=_('Title')?>" />
<input type="submit" name="create" value="<?=_('Add new Questgroup')?>" />
</form>
</section>
</li>
<?php endif ?>
</ul>
<?php endforeach ?>
<?php if(in_array('admin', \hhu\z\controllers\SeminaryController::$character['characterroles'])) : ?>
<form method="post" action="<?=$linker->link(array('questgroupshierarchy','create',$seminary['url']))?>">
<h2><?=_('New Questgroupshierarchy')?></h2>
<?=_('Title (singular)')?>: <input type="text" name="title_singular" placeholder="<?=_('Title (singular)')?>" />
<?=_('Title (plural)')?>: <input type="text" name="title_plural" placeholder="<?=_('Title (plural)')?>" />
<input type="submit" name="create" value="<?=_('Add new Questgroupshierarchy')?>" />
</form>
<?php endif ?>