Improve form for creating new trials

This commit is contained in:
Karsten Heiken
2011-08-01 13:18:03 +02:00
parent fe500af54b
commit 428e384b08
2 changed files with 28 additions and 14 deletions

View File

@@ -49,8 +49,11 @@ class Trials extends CI_Controller {
$this->load->library('form_validation'); $this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<span class="error">', '</span>'); $this->form_validation->set_error_delimiters('<span class="error">', '</span>');
$programs = $this->program->getAll();
// Get the parameters for a specific program // Get the parameters for a specific program
$parameters = $this->program->getParameters('28dc3aeef315080ee26524cf515f763187f52601'); foreach($programs as $program)
$parameters[$program['id']] = $this->program->getParameters($program['id']);
$config = array( $config = array(
array( array(
@@ -71,6 +74,7 @@ class Trials extends CI_Controller {
if ($this->form_validation->run() == FALSE) if ($this->form_validation->run() == FALSE)
{ {
$tpl['parameters'] = $parameters; $tpl['parameters'] = $parameters;
$tpl['programs'] = $programs;
$this->load->view('trial/new', $tpl); $this->load->view('trial/new', $tpl);
} }
else else

View File

@@ -64,14 +64,22 @@
<? <?
endif; endif;
?> ?>
<p>Bitte wählen Sie zunächst das Programm aus, mit dem Sie eine Berechnung durchführen möchten:</p> <h4>Programm zur Berechnung</h4>
<ul class="tabs"> <p>
<li class="active"><a href="#tab1">Ultimate Scattering Tool</a></li> <?
<li><a href="#tab2">Crazy Little Simulator</a></li> foreach($programs as $program):
</ul> ?><a class="button" onclick="$('.program-parameters').hide();$('#<?=$program['id']?>-params').show();$('.button').removeClass('locked');$(this).addClass('locked');return false;" href="#"><?=$program['name']?></a>
<?
endforeach;
?>
</p>
<?
foreach($programs as $program):
?>
<div class="tab_container"> <div class="program-parameters" id="<?=$program['id']?>-params" style="display:none">
<div id="tab1" class="tab_content"> <h4>Parameter für <?=$program['name']?></h4>
<p>
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -82,7 +90,7 @@
</thead> </thead>
<tbody> <tbody>
<? <?
foreach($parameters as $param): foreach($parameters[$program['id']] as $param):
?> ?>
<tr> <tr>
<td><abbr title="<?=$param['description']?>"><?=$param['readable']?></abbr></td> <td><abbr title="<?=$param['description']?>"><?=$param['readable']?></abbr></td>
@@ -94,13 +102,15 @@
?> ?>
</tbody> </tbody>
</table> </table>
</p>
</div> </div>
<div id="tab2" class="tab_content"> <?
<p>foobar</p> endforeach;
?>
<div id="mlcm-params" style="display:none">
<p>Verwende MLCM</p>
</div> </div>
</div> </div>
</div>
</form> </form>
</div> </div>