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() {
|
public function create() {
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
@@ -98,18 +108,16 @@ class Projects extends MY_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
/**
|
||||||
$projects = $this->project->getAll();
|
* Shows the project details
|
||||||
|
*
|
||||||
$tpl['projects'] = $projects;
|
* @param integer $prj_id The ID of the project to show
|
||||||
$this->load->view('project/list', $tpl);
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
public function detail($prj_id) {
|
public function detail($prj_id) {
|
||||||
$project = $this->project->getById($prj_id);
|
$project = $this->project->getById($prj_id);
|
||||||
if (!$project) {
|
if (!$project) {
|
||||||
$this->messages->add('Das Projekt konnte nicht geladen werden.', 'error');
|
$this->messages->add('Das Projekt konnte nicht geladen werden.', 'error');
|
||||||
redirect('/projects/', 301);
|
redirect('projects', 301);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->session->set_userdata('active_project', $prj_id);
|
$this->session->set_userdata('active_project', $prj_id);
|
||||||
@@ -121,4 +129,16 @@ class Projects extends MY_Controller {
|
|||||||
$this->load->view('project/detail', $tpl);
|
$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">
|
<div class="box">
|
||||||
<h3>Versuche</h3>
|
<h3>Versuche</h3>
|
||||||
<table>
|
<table class="tableList">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Versuch</th>
|
<th scope="col">Versuch</th>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<table>
|
<table class="tableList">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Versuch</th>
|
<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><a href="<?=site_url('projects/detail/' . $project['id'])?>"><abbr title="<?=$project['description']?>"><?=$project['name']?></abbr></a></td>
|
||||||
<td><?=$project['firstname'] . " " . $project['lastname']?></td>
|
<td><?=$project['firstname'] . " " . $project['lastname']?></td>
|
||||||
<td><span class="active">Erfolgreich abgeschlossen</span></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>
|
</tr>
|
||||||
<?
|
<?
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|||||||
Reference in New Issue
Block a user