diff --git a/application/controllers/trials.php b/application/controllers/trials.php index 2ad5928..1086c79 100644 --- a/application/controllers/trials.php +++ b/application/controllers/trials.php @@ -13,9 +13,58 @@ class Trials extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('trial'); + $this->load->model('project'); // load language file // $this->lang->load(strtolower($this->router->class)); } + /** + * Create a new project. + */ + public function create() { + $this->load->library('form_validation'); + $this->form_validation->set_error_delimiters('', ''); + + $config = array( + array( + 'field' => 'name', + 'label' => 'Projektname', + 'rules' => 'trim|required|min_length[3]|max_length[100]|xss_clean', + ), + array( + 'field' => 'description', + 'label' => 'Beschreibung', + 'rules' => 'trim|required|xss_clean', + ), + ); + + $this->form_validation->set_rules($config); + + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('trial/new'); + } + else + { + // TODO: handle file upload + + $data = array( + 'name' => $this->input->post('name'), + 'description' => $this->input->post('description'), + 'defaultmodel' => "todo", + 'defaultconfig' => "todo", + ); + + $result = $this->trial->create($data); + if($result) + redirect('/trial/detail/' . $result, 'refresh'); + else { + $tpl['error'][] = "Der Versuch konnte nicht gespeichert werden."; + $this->load->view('trial/new', $tpl); + } + } + + } } \ No newline at end of file diff --git a/application/views/trial/new.php b/application/views/trial/new.php new file mode 100644 index 0000000..c0486fa --- /dev/null +++ b/application/views/trial/new.php @@ -0,0 +1,94 @@ +load->view('header'); ?> + +
+ +
+

Neuen Versuch erstellen

+
+ +
+
+ + +

Erforderliche Angaben zum Versuch

+ +
    +
  • + +
    + + +
    +
  • +
  • +
    + +
    + + +
    +
  • +
  • +
    + + + +
    + + +
    +
  • +
+
+ +
+ +

Parameter für die Berechnung

+ +

+ Für dieses Projekt ist eine Standardkonfiguration vorhanden.
+ Das folgende Formular enthält die Standardparameter. Diese können für diesen Versuch nach belieben angepasst werden.
+ Die Standardkonfiguration wird dabei nicht verändert. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterWertEinheit
Wellenlängenm
Lichtrichtung°
Parameter #3foo
+
+
+ +
+ +load->view('footer'); ?>