Load parameters dynamically when creating a new trial
When creating a project we read the available parameters from the database.
This commit is contained in:
@@ -13,6 +13,7 @@ class Trials extends CI_Controller {
|
|||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('trial');
|
$this->load->model('trial');
|
||||||
|
$this->load->model('program');
|
||||||
$this->load->model('project');
|
$this->load->model('project');
|
||||||
|
|
||||||
// load language file
|
// load language file
|
||||||
@@ -26,6 +27,9 @@ 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>');
|
||||||
|
|
||||||
|
// Get the parameters for a specific program
|
||||||
|
$parameters = $this->program->getParameters('28dc3aeef315080ee26524cf515f763187f52601');
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
array(
|
array(
|
||||||
'field' => 'name',
|
'field' => 'name',
|
||||||
@@ -44,7 +48,8 @@ class Trials extends CI_Controller {
|
|||||||
|
|
||||||
if ($this->form_validation->run() == FALSE)
|
if ($this->form_validation->run() == FALSE)
|
||||||
{
|
{
|
||||||
$this->load->view('trial/new');
|
$tpl['parameters'] = $parameters;
|
||||||
|
$this->load->view('trial/new', $tpl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<label>3D-Modell</label><br />
|
<label>3D-Modell</label><br />
|
||||||
<?
|
<?
|
||||||
|
$defaultmodel = "foo";
|
||||||
if(isset($defaultmodel)):
|
if(isset($defaultmodel)):
|
||||||
?>
|
?>
|
||||||
<label class="note"><strong>Für dieses Projekt ist ein Standardmodell vorhanden.</strong><br />
|
<label class="note"><strong>Für dieses Projekt ist ein Standardmodell vorhanden.</strong><br />
|
||||||
@@ -50,15 +51,16 @@
|
|||||||
|
|
||||||
<h3>Parameter für die Berechnung</h3>
|
<h3>Parameter für die Berechnung</h3>
|
||||||
<?
|
<?
|
||||||
if(isset($defaultmodel)):
|
$defaultconfig = "foo";
|
||||||
|
if(isset($defaultconfig)):
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
Für dieses Projekt ist eine Standardkonfiguration vorhanden.<br />
|
<strong>Für dieses Projekt ist eine Standardkonfiguration vorhanden.</strong><br />
|
||||||
Das folgende Formular enthält die Standardparameter. Diese können für diesen Versuch nach belieben angepasst werden. <br />
|
Das folgende Formular enthält die Standardparameter. Diese können für diesen Versuch nach Belieben angepasst werden. <br />
|
||||||
Die Standardkonfiguration wird dabei nicht verändert.
|
Die Standardkonfiguration wird dabei nicht verändert.
|
||||||
</p>
|
</p>
|
||||||
<?
|
<?
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -69,21 +71,17 @@ endif;
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<?
|
||||||
|
foreach($parameters as $param):
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Wellenlänge</td>
|
<td><abbr title="<?=$param['description']?>"><?=$param['readable']?></abbr></td>
|
||||||
<td><input type="text" name="lambda" class="short text" value="<?=set_value('lambda')?>"><?=form_error('lambda')?></td>
|
<td><input type="text" name="<?=$param['fieldname']?>" class="short text" value="<?=set_value($param['fieldname'])?>"><?=form_error($param['fieldname'])?></td>
|
||||||
<td>nm</td>
|
<td><?=$param['unit']?></td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Lichtrichtung</td>
|
|
||||||
<td><input type="text" name="angle" class="short text" value="<?=set_value('angle')?>"><?=form_error('angle')?></td>
|
|
||||||
<td>°</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Parameter #3</td>
|
|
||||||
<td><input type="text" name="foobar1" class="short text" value="<?=set_value('foobar1')?>"><?=form_error('foobar1')?></td>
|
|
||||||
<td>foo</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<?
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user