implement CRUD for Questgroupshierarchy
This commit is contained in:
parent
13f5364d18
commit
4e09241db5
11 changed files with 737 additions and 4 deletions
|
|
@ -19,9 +19,17 @@
|
|||
<?php endif ?>
|
||||
|
||||
<?php if(!is_null($childquestgroupshierarchy)) : ?>
|
||||
<?php foreach($childquestgroupshierarchy as &$hierarchy) : ?>
|
||||
<?php if(count($hierarchy['questgroups']) > 0) : ?>
|
||||
<?php foreach($childquestgroupshierarchy as $hierarchyIndex => &$hierarchy) : ?>
|
||||
<?php if(count($hierarchy['questgroups']) > 0 || count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
|
||||
<h3><?=$hierarchy['title_plural']?></h3>
|
||||
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
|
||||
<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']),0,true,array('referer'=>$questgroup['id']))?>">↑</a></li><?php endif ?>
|
||||
<?php if($hierarchyIndex < count($childquestgroupshierarchy)-1) : ?><li><a href="<?=$linker->link(array('questgroupshierarchy','movedown',$seminary['url'],$hierarchy['url']),0,true,array('referer'=>$questgroup['id']))?>">↓</a></li><?php endif ?>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
<ul class="qg">
|
||||
<?php foreach($hierarchy['questgroups'] as &$group) : ?>
|
||||
<li class="cf">
|
||||
|
|
@ -51,6 +59,13 @@
|
|||
</ul>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<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="hidden" name="parent" value="<?=$questgroup['hierarchy']['url']?>" />
|
||||
<input type="submit" name="create" value="<?=_('Add new Questgroupshierarchy')?>" />
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if(isset($quests) && !is_null($quests) && count($quests) > 0) : ?>
|
||||
|
|
|
|||
64
views/html/questgroupshierarchy/create.tpl
Normal file
64
views/html/questgroupshierarchy/create.tpl
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php if(!is_null($seminary['seminarymedia_id'])) : ?>
|
||||
<div class="moodpic">
|
||||
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url']))?>" />
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||
<li><i class="fa fa-chevron-right fa-fw"></i><?=_('Questgroupshierarchy')?></li>
|
||||
</ul>
|
||||
|
||||
<h1><?=_('Create Questgroupshierarchy')?></h1>
|
||||
<?php if($validation !== true) : ?>
|
||||
<ul>
|
||||
<?php foreach($validation as $field => &$settings) : ?>
|
||||
<li>
|
||||
<ul>
|
||||
<?php foreach($settings as $setting => $value) : ?>
|
||||
<li>
|
||||
<?php switch($field) {
|
||||
case 'titleSingular':
|
||||
switch($setting) {
|
||||
case 'minlength': printf(_('Title (singular) is too short (min. %d chars)'), $value);
|
||||
break;
|
||||
case 'maxlength': printf(_('Title (singular) is too long (max. %d chars)'), $value);
|
||||
break;
|
||||
case 'exist': echo _('Title (singular) already exists');
|
||||
break;
|
||||
default: echo _('Title (singular) invalid');
|
||||
}
|
||||
break;
|
||||
case 'titlePlural':
|
||||
switch($setting) {
|
||||
case 'minlength': printf(_('Title (plural) is too short (min. %d chars)'), $value);
|
||||
break;
|
||||
case 'maxlength': printf(_('Title (plural) is too long (max. %d chars)'), $value);
|
||||
break;
|
||||
case 'exist': echo _('Title (plural) already exists');
|
||||
break;
|
||||
default: echo _('Title (plural) invalid');
|
||||
}
|
||||
break;
|
||||
} ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
<form method="post" class="logreg">
|
||||
<fieldset>
|
||||
<label for="title_singular"><?=_('Title (singular)')?>:</label>
|
||||
<input type="text" name="title_singular" placeholder="<?=_('Title (singular)')?>" value="<?=$titleSingular?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" <?=(array_key_exists('titleSingular', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||
<label for="title_plural"><?=_('Title (plural)')?>:</label>
|
||||
<input type="text" name="title_plural" placeholder="<?=_('Title (plural)')?>" value="<?=$titlePlural?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" <?=(array_key_exists('titlePlural', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||
<select name="parent">
|
||||
<option value="null"><?=$seminary['title']?></option>
|
||||
<?php foreach($parentQuestgroupshierarchy as &$hierarchy) : ?>
|
||||
<option value="<?=$hierarchy['url']?>" <?php if(array_key_exists('selected', $hierarchy) && $hierarchy['selected']) : ?>selected="selected"<?php endif ?>><?=$hierarchy['title_singular']?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</fieldset>
|
||||
<input type="submit" name="create" value="<?=_('create')?>" />
|
||||
</form>
|
||||
16
views/html/questgroupshierarchy/delete.tpl
Normal file
16
views/html/questgroupshierarchy/delete.tpl
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php if(!is_null($seminary['seminarymedia_id'])) : ?>
|
||||
<div class="moodpic">
|
||||
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url']))?>">
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||
<li><i class="fa fa-chevron-right fa-fw"></i><?=_('Questgroupshierarchy')?></li>
|
||||
</ul>
|
||||
|
||||
<h1><?=_('Delete Questgroupshierarchy')?></h1>
|
||||
<?=sprintf(_('Should the Questgroupshierarchy “%s” really be deleted?'), $questgroupshierarchy['title_singular'])?>
|
||||
<form method="post">
|
||||
<input type="submit" name="delete" value="<?=_('delete')?>" />
|
||||
<input type="submit" name="not-delete" value="<?=_('cancel')?>" />
|
||||
</form>
|
||||
58
views/html/questgroupshierarchy/edit.tpl
Normal file
58
views/html/questgroupshierarchy/edit.tpl
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php if(!is_null($seminary['seminarymedia_id'])) : ?>
|
||||
<div class="moodpic">
|
||||
<img src="<?=$linker->link(array('media','seminarymoodpic',$seminary['url']))?>">
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="<?=$linker->link(array('seminaries',$seminary['url']))?>"><?=$seminary['title']?></a></li>
|
||||
<li><i class="fa fa-chevron-right fa-fw"></i><?=_('Questgroupshierarchy')?></li>
|
||||
</ul>
|
||||
|
||||
<h1><?=_('Edit Questgroupshierarchy')?></h1>
|
||||
<?php if($validation !== true) : ?>
|
||||
<ul>
|
||||
<?php foreach($validation as $field => &$settings) : ?>
|
||||
<li>
|
||||
<ul>
|
||||
<?php foreach($settings as $setting => $value) : ?>
|
||||
<li>
|
||||
<?php switch($field) {
|
||||
case 'titleSingular':
|
||||
switch($setting) {
|
||||
case 'minlength': printf(_('Title (singular) is too short (min. %d chars)'), $value);
|
||||
break;
|
||||
case 'maxlength': printf(_('Title (singular) is too long (max. %d chars)'), $value);
|
||||
break;
|
||||
case 'exist': echo _('Title (singular) already exists');
|
||||
break;
|
||||
default: echo _('Title (singular) invalid');
|
||||
}
|
||||
break;
|
||||
case 'titlePlural':
|
||||
switch($setting) {
|
||||
case 'minlength': printf(_('Title (plural) is too short (min. %d chars)'), $value);
|
||||
break;
|
||||
case 'maxlength': printf(_('Title (plural) is too long (max. %d chars)'), $value);
|
||||
break;
|
||||
case 'exist': echo _('Title (plural) already exists');
|
||||
break;
|
||||
default: echo _('Title (plural) invalid');
|
||||
}
|
||||
break;
|
||||
} ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
<form method="post" class="logreg">
|
||||
<fieldset>
|
||||
<label for="title_singular"><?=_('Title (singular)')?>:</label>
|
||||
<input type="text" name="title_singular" placeholder="<?=_('Title (singular)')?>" value="<?=$titleSingular?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" <?=(array_key_exists('titleSingular', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||
<label for="title_plural"><?=_('Title (plural)')?>:</label>
|
||||
<input type="text" name="title_plural" placeholder="<?=_('Title (plural)')?>" value="<?=$titlePlural?>" required="required" maxlength="<?=$validationSettings['title']['maxlength']?>" <?=(array_key_exists('titlePlural', $validation)) ? 'class="invalid"' : null?> /><br />
|
||||
</fieldset>
|
||||
<input type="submit" name="edit" value="<?=_('edit')?>" />
|
||||
</form>
|
||||
0
views/html/questgroupshierarchy/movedown.tpl
Normal file
0
views/html/questgroupshierarchy/movedown.tpl
Normal file
0
views/html/questgroupshierarchy/moveup.tpl
Normal file
0
views/html/questgroupshierarchy/moveup.tpl
Normal file
|
|
@ -20,8 +20,17 @@
|
|||
</nav>
|
||||
<?php endif ?>
|
||||
<p><?=\hhu\z\Utils::t($seminary['description'])?></p>
|
||||
<?php foreach($questgroupshierarchy as &$hierarchy) : ?>
|
||||
<h2><?=$hierarchy['title_plural']?></h2>
|
||||
<?php foreach($questgroupshierarchy as $hierarchyIndex => &$hierarchy) : ?>
|
||||
<h2 id="<?=$hierarchy['url']?>"><?=$hierarchy['title_plural']?></h2>
|
||||
<?php if(count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\SeminaryController::$character['characterroles'])) > 0) : ?>
|
||||
<nav class="admin">
|
||||
<li><a href="<?=$linker->link(array('questgroupshierarchy','edit',$seminary['url'],$hierarchy['url']))?>"><?=_('Edit Questgrouphierarchy')?></a></li>
|
||||
<li><a href="<?=$linker->link(array('questgroupshierarchy','delete',$seminary['url'],$hierarchy['url']))?>"><?=_('Delete Questgrouphierarchy')?></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 ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
<ul class="questgroups cf">
|
||||
<?php foreach($hierarchy['questgroups'] as &$group) : ?>
|
||||
<li>
|
||||
|
|
@ -46,3 +55,10 @@
|
|||
<?php endforeach?>
|
||||
</ul>
|
||||
<?php endforeach ?>
|
||||
|
||||
<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)')?>" /></h2>
|
||||
<?=_('Title (plural)')?>: <input type="text" name="title_plural" placeholder="<?=_('Title (plural)')?>" /></h2>
|
||||
<input type="submit" name="create" value="<?=_('Add new Questgroupshierarchy')?>" />
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue