Implement in-place editor for project descriptions
This commit is contained in:
@@ -46,4 +46,13 @@ class Ajax extends MY_Controller {
|
||||
$tpl['messages'] = $this->messages->get();
|
||||
$this->load->view('global/notifications', $tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a projects description.
|
||||
*/
|
||||
public function save_project() {
|
||||
$this->load->model('project');
|
||||
$data['description'] = $this->input->post('content');
|
||||
$this->project->update($this->session->userdata('active_project'), $data);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
/**
|
||||
* Configurations are used to store different variations of the same project.
|
||||
*
|
||||
*
|
||||
* @author Karsten Heiken <karsten@disposed.de>
|
||||
*/
|
||||
class Project extends CI_Model {
|
||||
@@ -35,8 +35,7 @@ class Project extends CI_Model {
|
||||
* @return array The user's projects.
|
||||
*/
|
||||
public function getOwn() {
|
||||
// TODO: Session: $query = $this->db->where(array('owner' => $this->session->userdata('user_id')))
|
||||
$query = $this->db->where(array('owner' => '215cd70f310ae6ae'))
|
||||
$query = $this->db->where(array('owner' => $this->session->userdata('user_id')))
|
||||
->order_by('lastaccess', 'desc')
|
||||
->get('projects');
|
||||
return $query->result_array();
|
||||
@@ -65,7 +64,7 @@ class Project extends CI_Model {
|
||||
$query = $this->db->where(array('public' => '1'))
|
||||
->order_by('name', 'asc')
|
||||
->get('projects');
|
||||
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
@@ -79,10 +78,10 @@ class Project extends CI_Model {
|
||||
$this->db->where('id', $project_id)->update('projects', array(
|
||||
'lastaccess' => mysql_now(),
|
||||
));
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all projects from the database.
|
||||
*/
|
||||
@@ -91,8 +90,6 @@ class Project extends CI_Model {
|
||||
->join('users', 'users.id = projects.owner', 'left')
|
||||
->get('projects')->result_array();
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -155,19 +152,33 @@ class Project extends CI_Model {
|
||||
} while ($this->db->where('id', $data['id'])->from('projects')->count_all_results() > 0);
|
||||
|
||||
|
||||
if($this->db->insert('projects', $data))
|
||||
if ($this->db->insert('projects', $data)) {
|
||||
return $data['id'];
|
||||
else
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a project.
|
||||
* Updates a project.
|
||||
*
|
||||
* @param integer $projectId The ID of the project to update
|
||||
* @param array $data Array with data to update
|
||||
*/
|
||||
public function update($projectId, $data) {
|
||||
return $this->db->where('id', $projectId)->update('projects', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a project.
|
||||
*
|
||||
* There is no security check in here to verify if the user has the
|
||||
* rights to do so. This needs to be done in the controller!
|
||||
*
|
||||
* @param integer $projectId The ID of the project to delete
|
||||
*/
|
||||
public function delete($project_id) {
|
||||
return $this->db->delete('projects', array('id' => $project_id));
|
||||
public function delete($projectId) {
|
||||
return $this->db->delete('projects', array('id' => $projectId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,87 +2,80 @@
|
||||
|
||||
<div id="content">
|
||||
|
||||
<div class="title">
|
||||
<h2>Projektinformationen</h2>
|
||||
</div>
|
||||
<div class="title">
|
||||
<h2>Projektinformationen</h2>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3>Versuche</h3>
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Versuch</th>
|
||||
<th scope="col">Berechnungen</th>
|
||||
<th scope="col">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
if(count($trials) > 0):
|
||||
foreach($trials as $trial):
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="<?=site_url('trials/'.$trial['id'])?>"title="Versuch "<?=$trial['name']?>" anzeigen"><?=$trial['name']?></a></td>
|
||||
<td><span class="active">Erfolgreich abgeschlossen</span></td>
|
||||
<td>
|
||||
<a href="<?=site_url('trials/results/'.$trial['id'])?>" title="Ergebnisse zum Versuch "<?=$trial['name']?>" anzeigen">Ergebnisse anzeigen</a> |
|
||||
<a href="<?=site_url('trials/edit/'.$trial['id'])?>" title="Versuch "<?=$trial['name']?>" bearbeiten">Bearbeiten</a> |
|
||||
<a href="<?=site_url('trials/delete/'.$trial['id'])?>" title="Versuch "<?=$trial['name']?>" entfernen">Entfernen</a></td>
|
||||
</tr>
|
||||
<?
|
||||
endforeach;
|
||||
else:
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3">Keine Versuche vorhanden.</td>
|
||||
</tr>
|
||||
<?
|
||||
endif;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="box">
|
||||
<h3>Beschreibung</h3>
|
||||
<div class="editInPlace"><?=nl2br($project['description']);?></div>
|
||||
<p></p>
|
||||
<h3>Versuche</h3>
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Versuch</th>
|
||||
<th scope="col">Berechnungen</th>
|
||||
<th scope="col">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($trials) > 0):?>
|
||||
<?php foreach($trials as $trial):?>
|
||||
<tr>
|
||||
<td><a href="<?=site_url('trials/'.$trial['id'])?>"title="Versuch "<?=$trial['name']?>" anzeigen"><?=$trial['name']?></a></td>
|
||||
<td><span class="active">Erfolgreich abgeschlossen</span></td>
|
||||
<td>
|
||||
<a href="<?=site_url('trials/results/'.$trial['id'])?>" title="Ergebnisse zum Versuch "<?=$trial['name']?>" anzeigen">Ergebnisse anzeigen</a> |
|
||||
<a href="<?=site_url('trials/edit/'.$trial['id'])?>" title="Versuch "<?=$trial['name']?>" bearbeiten">Bearbeiten</a> |
|
||||
<a href="<?=site_url('trials/delete/'.$trial['id'])?>" title="Versuch "<?=$trial['name']?>" entfernen">Entfernen</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
<td colspan="3">Keine Versuche vorhanden.</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><a class="button add" href="<?=site_url('trials/create/'.$project['id'])?>">Neuen Versuch erstellen</a>
|
||||
</div>
|
||||
<p><a class="button add" href="<?=site_url('trials/create/'.$project['id'])?>">Neuen Versuch erstellen</a></p>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<h2>Letzte Berechnungen</h2>
|
||||
</div>
|
||||
<div class="title">
|
||||
<h2>Letzte Berechnungen</h2>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Versuch</th>
|
||||
<th scope="col">Fertiggestellt</th>
|
||||
<th scope="col">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
if(count($jobsDone) > 0):
|
||||
foreach($jobsDone as $job):
|
||||
?>
|
||||
<tr>
|
||||
<td>Versuchsname</td>
|
||||
<td>Heute, 09:32</td>
|
||||
<td>
|
||||
<a href="<?=site_url('trials/results/'.$trial['id'])?>" title="Ergebnisse zum Versuch "<?=$trial['name']?>" anzeigen">Ergebnisse anzeigen</a> |
|
||||
<a href="<?=site_url('trials/edit/'.$trial['id'])?>" title="Versuch "<?=$trial['name']?>" bearbeiten">Bearbeiten</a></td>
|
||||
</tr>
|
||||
<?
|
||||
endforeach;
|
||||
else:
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3">Es wurden noch keine Berechnungen durchgeführt.</td>
|
||||
</tr>
|
||||
<?
|
||||
endif;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box">
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Versuch</th>
|
||||
<th scope="col">Fertiggestellt</th>
|
||||
<th scope="col">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(count($jobsDone) > 0):?>
|
||||
<?php foreach($jobsDone as $job):?>
|
||||
<tr>
|
||||
<td>Versuchsname</td>
|
||||
<td>Heute, 09:32</td>
|
||||
<td>
|
||||
<a href="<?=site_url('trials/results/'.$trial['id'])?>" title="Ergebnisse zum Versuch "<?=$trial['name']?>" anzeigen">Ergebnisse anzeigen</a> |
|
||||
<a href="<?=site_url('trials/edit/'.$trial['id'])?>" title="Versuch "<?=$trial['name']?>" bearbeiten">Bearbeiten</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
<td colspan="3">Es wurden noch keine Berechnungen durchgeführt.</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,75 +1,71 @@
|
||||
<?php $this->load->view('header'); ?>
|
||||
<?php $this->load->view('header');?>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<div class="title">
|
||||
<h2>Projektübersicht</h2>
|
||||
</div>
|
||||
<div class="title">
|
||||
<h2>Projektübersicht</h2>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3>Übersicht aller Projekte</h3>
|
||||
<table class="tableList paginated">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Projekt</th>
|
||||
<th scope="col">Besitzer</th>
|
||||
<th scope="col">Berechnungen</th>
|
||||
<th scope="col">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?
|
||||
foreach($projects as $project):
|
||||
?>
|
||||
<tr>
|
||||
<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> | <?=anchor('projects/delete/' . $project['id'], "Entfernen");?></td>
|
||||
</tr>
|
||||
<?
|
||||
endforeach;
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="closed">Fehlgeschlagen</span></td>
|
||||
<td><a href="#">Fehlerbericht</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="pending">Berechnung im Gange: 20%</span></td>
|
||||
<td><a href="#">Anhalten</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="pending">Berechnung im Gange: 60%</span></td>
|
||||
<td><a href="#">Anhalten</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="pending">Berechnung im Gange: 0%</span></td>
|
||||
<td><a href="#">Anhalten</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="closed">Fehlgeschlagen</span></td>
|
||||
<td><a href="#">Fehlerbericht</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="closed">Fehlgeschlagen</span></td>
|
||||
<td><a href="#">Fehlerbericht</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>Übersicht aller Projekte</h3>
|
||||
<table class="tableList paginated">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Projekt</th>
|
||||
<th scope="col">Besitzer</th>
|
||||
<th scope="col">Berechnungen</th>
|
||||
<th scope="col">Aktion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($projects as $project):?>
|
||||
<tr>
|
||||
<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> | <?=anchor('projects/delete/' . $project['id'], "Entfernen");?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="closed">Fehlgeschlagen</span></td>
|
||||
<td><a href="#">Fehlerbericht</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="pending">Berechnung im Gange: 20%</span></td>
|
||||
<td><a href="#">Anhalten</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="pending">Berechnung im Gange: 60%</span></td>
|
||||
<td><a href="#">Anhalten</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="pending">Berechnung im Gange: 0%</span></td>
|
||||
<td><a href="#">Anhalten</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="closed">Fehlgeschlagen</span></td>
|
||||
<td><a href="#">Fehlerbericht</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#"><abbr title="Beschreibung des Projekts">Blutkörperchen</abbr></a></td>
|
||||
<td>Karsten Heiken</td>
|
||||
<td><span class="closed">Fehlgeschlagen</span></td>
|
||||
<td><a href="#">Fehlerbericht</a> | <a href="#">Entfernen</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('footer'); ?>
|
||||
<?php $this->load->view('footer');?>
|
||||
|
||||
Reference in New Issue
Block a user