Skip to content

Commit

Permalink
Views for tasks management
Browse files Browse the repository at this point in the history
  • Loading branch information
Goteo committed Feb 25, 2014
1 parent 59833dc commit e827476
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 0 deletions.
51 changes: 51 additions & 0 deletions view/admin/tasks/edit.html.php
@@ -0,0 +1,51 @@
<?php
/*
* Copyright (C) 2012 Platoniq y Fundación Fuentes Abiertas (see README for details)
* This file is part of Goteo.
*
* Goteo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Goteo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>.
*
*/

use Goteo\Library\Text;

$task = $this['task'];
$nodes = $this['nodes'];
?>
<div class="widget">
<form action="/admin/tasks/<?php echo ($this['action'] == 'add') ? 'add' : 'edit/'.$task->id ?>" method="post">
<input type="hidden" name="node" value="<?php echo \GOTEO_NODE; ?>" />
<p>
<label for="task-text">Explicación:</label><br />
<textarea id="task-text" name="text" style="width:500px;height:200px;" ><?php echo $task->text ?></textarea>
</p>
<p>
<label for="task-url">Url:</label><br />
<input type="text" id="task-url" name="url" value="<?php echo $task->url ?>" style="width:500px" />
</p>

<p>
<label>Estado:</label><br />
<?php if (empty($task->done)) : ?>
<span style="color:red;" >PENDIENTE</span>
<?php else : ?>
<span style="color:green;" >Realizada por:</span> <strong><?php echo $task->user->name; ?></strong><br />
<label><input type="checkbox" name="undone" value="1" />Reabrirla</label>
<?php endif; ?>
</p>

<input type="submit" name="save" value="Guardar" /><br />

</form>
</div>
84 changes: 84 additions & 0 deletions view/admin/tasks/list.html.php
@@ -0,0 +1,84 @@
<?php
/*
* Copyright (C) 2012 Platoniq y Fundación Fuentes Abiertas (see README for details)
* This file is part of Goteo.
*
* Goteo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Goteo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>.
*
*/

use Goteo\Library\Text;

$filters = $this['filters'];
?>
<a href="/admin/tasks/add" class="button">Nueva Tarea</a>

<div class="widget board">
<form id="filter-form" action="/admin/tasks" method="get">
<table>
<tr>
<td>
<label for="status-filter">Mostrar por estado:</label><br />
<select id="status-filter" name="done" onchange="document.getElementById('filter-form').submit();">
<option value="">Cualquier estado</option>
<?php foreach ($this['status'] as $statusId=>$statusName) : ?>
<option value="<?php echo $statusId; ?>"<?php if ($filters['done'] == $statusId) echo ' selected="selected"';?>><?php echo $statusName; ?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<label for="user-filter">Realizadas por:</label><br />
<select id="user-filter" name="user" onchange="document.getElementById('filter-form').submit();">
<option value="">Cualquier admin</option>
<?php foreach ($this['admins'] as $adminId=>$adminName) : ?>
<option value="<?php echo $adminId; ?>"<?php if ($filters['user'] == $adminId) echo ' selected="selected"';?>><?php echo $adminName; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
</table>

</form>
</div>

<div class="widget board">
<?php if (!empty($this['tasks'])) : ?>
<table>
<thead>
<tr>
<th></th> <!-- edit -->
<th>Nodo</th>
<th>Tarea</th>
<th>Estado</th>
<th></th> <!-- remove -->
</tr>
</thead>

<tbody>
<?php foreach ($this['tasks'] as $task) : ?>
<tr>
<td><a href="/admin/tasks/edit/<?php echo $task->id; ?>" title="Editar">[Editar]</a></td>
<td><strong><?php echo $this['nodes'][$task->node]; ?></strong></td>
<td><?php echo substr($task->text, 0, 150); ?></td>
<td><?php echo (empty($task->done)) ? 'Pendiente' : 'Realizada ('.$task->user->name.')';?></td>
<td><a href="/admin/tasks/remove/<?php echo $task->id; ?>" title="Eliminar" onclick="return confirm('La tarea se eliminará irreversiblemente, ok?')">[Eliminar]</a></td>
</tr>
<?php endforeach; ?>
</tbody>

</table>
<?php else : ?>
<p>No se han encontrado registros</p>
<?php endif; ?>
</div>

0 comments on commit e827476

Please sign in to comment.