diff --git a/application/controllers/admin/parameters.php b/application/controllers/admin/parameters.php index a92f218..3061083 100644 --- a/application/controllers/admin/parameters.php +++ b/application/controllers/admin/parameters.php @@ -52,11 +52,11 @@ class Parameters extends Admin_Controller { } if ($this->form_validation->run('parameters/create') === true) { - $paramName = $this->input->post('name'); + $parameter = $this->input->post('name'); $data = array( 'program_id' => $program['id'], - 'name' => $paramName, + 'name' => $parameter, 'readable' => $this->input->post('readable'), 'unit' => $this->input->post('unit'), 'description' => $this->input->post('description'), @@ -65,7 +65,7 @@ class Parameters extends Admin_Controller { ); if ($this->parameter->create($data)) { - $this->messages->add(sprintf(_("The parameter '%s' has been successfully created."), $paramName), 'success'); + $this->messages->add(sprintf(_("The parameter "%s" has been created successfully."), $parameter), 'success'); redirect('admin/programs/edit/' . $program['id'], 303); } } @@ -148,13 +148,14 @@ class Parameters extends Admin_Controller { ); if ($this->parameter->update($data, $id)) { - $this->messages->add(sprintf(_("The parameter '%s' has been successfully updated."), $parameter['name']), 'success'); - redirect('admin/programs/edit/' . $parameter['program_id'], 303); + $this->messages->add(sprintf(_("The parameter "%s" has been updated successfully."), $parameter['name']), 'success'); } + redirect('admin/programs/edit/' . $parameter['program_id'], 303); } $data = array(); // empty the data array $data['types'] = $this->parameter->getTypes(); + $data['program'] = $this->program->getByID($parameter['program_id']); $data['parameter'] = $parameter; $this->load->view('admin/parameters/edit', $data); @@ -172,7 +173,7 @@ class Parameters extends Admin_Controller { show_404(); } else { if ($this->parameter->delete($parameter['id'])) { - $this->messages->add(_('The selected parameter has been successfully deleted.'), 'success'); + $this->messages->add(_("The selected parameter has been deleted successfully."), 'success'); } redirect('admin/programs/edit/' . $parameter['program_id'], 303); } diff --git a/application/controllers/admin/programs.php b/application/controllers/admin/programs.php index 3c491a7..9aa154f 100644 --- a/application/controllers/admin/programs.php +++ b/application/controllers/admin/programs.php @@ -52,10 +52,10 @@ class Programs extends Admin_Controller { * * @param string $id */ - public function edit($id = '') { - $program = $this->program->getByID($id); + public function edit($programId = '') { + $program = $this->program->getByID($programId); - if (empty($id) || !isset($program['id'])){ + if (empty($programId) || !isset($program['id'])){ show_404(); } @@ -64,12 +64,13 @@ class Programs extends Admin_Controller { 'name' => $this->input->post('name'), 'config_template' => $_POST['config_template'], ); - if ($this->program->update($data, $id)) { - $this->messages->add(sprintf(_("The program '%s' has been updated successfully"), $this->input->post('name')), 'success'); - redirect('admin/programs', 303); + if ($this->program->update($data, $programId)) { + $this->messages->add(sprintf(_("The program "%s" has been updated successfully"), $this->input->post('name')), 'success'); + redirect('admin/programs/edit/' . $program['id'], 303); } } + $data = array(); // empty data array $data['program'] = $program; $data['parameters'] = $this->parameter->getAll($program['id']); diff --git a/application/views/admin/parameters/create.php b/application/views/admin/parameters/create.php index 2aca436..1d1b811 100644 --- a/application/views/admin/parameters/create.php +++ b/application/views/admin/parameters/create.php @@ -3,28 +3,45 @@