Implement project deletion + some clean-up
This commit is contained in:
@@ -37,7 +37,17 @@ class Projects extends MY_Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new project.
|
||||
* Shows a list of all projects.
|
||||
*/
|
||||
public function index() {
|
||||
$projects = $this->project->getAll();
|
||||
|
||||
$tpl['projects'] = $projects;
|
||||
$this->load->view('project/list', $tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows users to create a new project.
|
||||
*/
|
||||
public function create() {
|
||||
$this->load->library('form_validation');
|
||||
@@ -98,18 +108,16 @@ class Projects extends MY_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$projects = $this->project->getAll();
|
||||
|
||||
$tpl['projects'] = $projects;
|
||||
$this->load->view('project/list', $tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the project details
|
||||
*
|
||||
* @param integer $prj_id The ID of the project to show
|
||||
*/
|
||||
public function detail($prj_id) {
|
||||
$project = $this->project->getById($prj_id);
|
||||
if (!$project) {
|
||||
$this->messages->add('Das Projekt konnte nicht geladen werden.', 'error');
|
||||
redirect('/projects/', 301);
|
||||
redirect('projects', 301);
|
||||
}
|
||||
|
||||
$this->session->set_userdata('active_project', $prj_id);
|
||||
@@ -121,4 +129,16 @@ class Projects extends MY_Controller {
|
||||
$this->load->view('project/detail', $tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows users to delete a project.
|
||||
*
|
||||
* @param unknown_type $projectId
|
||||
*/
|
||||
public function delete($projectId) {
|
||||
$this->project->delete($projectId);
|
||||
$this->session->unset_userdata('active_project');
|
||||
$this->messages->add("Das Projekt wurde gelöscht.", 'notice');
|
||||
redirect('projects');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<div class="box">
|
||||
<h3>Versuche</h3>
|
||||
<table>
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Versuch</th>
|
||||
@@ -50,7 +50,7 @@
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<table>
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Versuch</th>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<td><a href="<?=site_url('projects/detail/' . $project['id'])?>"><abbr title="<?=$project['description']?>"><?=$project['name']?></abbr></a></td>
|
||||
<td><?=$project['firstname'] . " " . $project['lastname']?></td>
|
||||
<td><span class="active">Erfolgreich abgeschlossen</span></td>
|
||||
<td><a href="#">Ergebnisse anzeigen</a> | <a href="#">Entfernen</a></td>
|
||||
<td><a href="#">Ergebnisse anzeigen</a> | <?=anchor('projects/delete/' . $project['id'], "Entfernen");?></td>
|
||||
</tr>
|
||||
<?
|
||||
endforeach;
|
||||
|
||||
Reference in New Issue
Block a user