server/onyx/tpl/bootstrap/admin/exercice.tpl

98 lines
3.9 KiB
Smarty

{extends file="admin/layout.tpl"}
{block name=content}
{if isset($ex)}
<h2>{$theme->name} <small>{$ex->id}</small></h2>
<form role="form" method="post" action="/{$SALT_ADMIN}/ex/{$theme->id}-{$theme->name}/{$ex->id}">
<div class="form-group">
<label for="title">Titre</label>
<input type="text" class="form-control" value="{$ex->title|escape}" name="title" id="title">
</div>
<div class="form-group">
<label for="desc">Description</label>
<textarea class="form-control" name="desc" id="desc">{$ex->statement|escape}</textarea>
</div>
<div class="form-group">
<label for="points">Points</label>
<input type="text" class="form-control" value="{$ex->points|escape}" name="points" id="points">
</div>
<div class="form-group">
<label for="require">D&eacute;pendance</label>
<input type="text" class="form-control" value="{$ex->require|escape}" name="require" id="require">
</div>
<div class="form-group">
<label for="level">Niveau de difficult&eacute;</label>
<input type="text" class="form-control" value="{$ex->level}" name="level" id="level">
</div>
{foreach from=$ex->keys item=key key=k}
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Clef {$k}</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label for="k{$k}_type">Type</label>
<select name="k{$k}_type" id="k{$k}_type" class="form-control">
{html_options options=$fortyp selected=$key.format}
</select>
</div>
<div class="form-group">
<label for="k{$k}_value">Valeur</label>
<input type="text" class="form-control" value="{$key.value|escape}" name="k{$k}_value" id="k{$k}_value">
</div>
</div>
</div>
{/foreach}
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">Nouvelle clef</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label for="k{$k+1}_type">Type</label>
<select name="k{$k+1}_type" id="k{$k+1}_type" class="form-control">
{html_options options=$fortyp selected=$key.format}
</select>
</div>
<div class="form-group">
<label for="k{$k+1}_value">Valeur</label>
<input type="text" class="form-control" name="k{$k+1}_value" id="k{$k+1}_value" placeholder="Clef">
</div>
</div>
</div>
{foreach from=$ex->files item=file key=k}
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">Fichier</h3>
</div>
<div class="panel-body">
<div class="form-group">
<label for="f{$k}_name">Nom du affich&eacute; fichier</label>
<input type="text" class="form-control" name="f{$k}_name" id="f{$k}_name" value="{$file.name|escape}">
</div>
<div class="form-group">
<label for="f{$k}_path">Chemin</label> <span class="label {if !is_file($file.path)}label-danger">File not found{else}label-success">File found{/if}</span>
<input type="text" class="form-control" name="f{$k}_path" id="f{$k}_path" value="{$file.path_orig|escape}">
</div>
<div class="form-group">
<label for="f{$k}_sha1">SHA-1</label>{if is_file($file.path)} Calculated from {$file.path}: {sha1_file($file.path)} <span class="label {if sha1_file($file.path) != $file.sha1}label-danger">pas bon{else}label-success">ok{/if}</span>{/if}
<input type="text" class="form-control" name="f{$k}_sha1" id="f{$k}_sha1" value="{$file.sha1|escape}">
</div>
</div>
</div>
{/foreach}
<div class="form-group">
<button type="submit" class="btn btn-success">Modifier</button>
</div>
</form>
{else}
<h2>{$theme->name}</h2>
<p>
<ul>
{foreach from=$theme->get_exercices_ordered() item=ex}
<li><a href="/{$SALT_ADMIN}/ex/{$theme->id}-{$theme->name}/{$ex->id}">{$ex->get_title()}</a></li>
{/foreach}
</ul>
</p>
{/if}
{/block}