Skip to content

Commit

Permalink
Views for admin pannel
Browse files Browse the repository at this point in the history
  • Loading branch information
schulbaumO committed Feb 15, 2014
1 parent c73cad2 commit 0692975
Show file tree
Hide file tree
Showing 29 changed files with 709 additions and 470 deletions.
135 changes: 108 additions & 27 deletions view/admin/blog/list.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,128 @@
use Goteo\Library\Text,
Goteo\Core\ACL;

// paginacion
require_once 'library/pagination/pagination.php';

$translator = ACL::check('/translate') ? true : false;

$filters = $this['filters'];
if (empty($filters['show'])) $filters['show'] = 'all';
$the_filters = '';
foreach ($filters as $key=>$value) {
$the_filters .= "&{$key}={$value}";
}

$pagedResults = new \Paginated($this['posts'], 10, isset($_GET['page']) ? $_GET['page'] : 1);
?>
<a href="/admin/blog/add" class="button red"><?php echo Text::_("Nueva entrada"); ?></a>
<a href="/admin/blog/add" class="button"><?php echo Text::_("Nueva entrada"); ?></a>
&nbsp;&nbsp;&nbsp;
<a href="/admin/blog/reorder" class="button">Ordenar la portada</a>

<div class="widget board">
<form id="filter-form" action="/admin/blog" method="get">
<div style="float:left;margin:5px;">
<label for="show-filter">Mostrar:</label><br />
<select id="show-filter" name="show" onchange="document.getElementById('filter-form').submit();">
<?php foreach ($this['show'] as $itemId=>$itemName) : ?>
<option value="<?php echo $itemId; ?>"<?php if ($filters['show'] == $itemId) echo ' selected="selected"';?>><?php echo $itemName; ?></option>
<?php endforeach; ?>
</select>
</div>

<?php if ($filters['show'] == 'updates') : ?>
<div style="float:left;margin:5px;">
<label for="blog-filter">Del proyecto:</label><br />
<select id="blog-filter" name="blog" onchange="document.getElementById('filter-form').submit();">
<option value="">Cualquiera</option>
<?php foreach ($this['blogs'] as $itemId=>$itemName) : ?>
<option value="<?php echo $itemId; ?>"<?php if ($filters['blog'] == $itemId) echo ' selected="selected"';?>><?php echo $itemName; ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>

<?php if ($filters['show'] == 'entries') : ?>
<div style="float:left;margin:5px;">
<label for="blog-filter">Del nodo:</label><br />
<select id="blog-filter" name="blog" onchange="document.getElementById('filter-form').submit();">
<option value="">Cualquiera</option>
<?php foreach ($this['blogs'] as $itemId=>$itemName) : ?>
<option value="<?php echo $itemId; ?>"<?php if ($filters['blog'] == $itemId) echo ' selected="selected"';?>><?php echo $itemName; ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
</form>
</div>

<div class="widget board">
<?php if (!empty($this['posts'])) : ?>
<table>
<thead>
<tr>
<td><!-- <?php echo Text::_("Edit"); ?> --></td>
<th><?php echo Text::_("Título"); ?></th> <!-- title -->
<th><!-- published --></th>
<th colspan="6"><?php echo Text::_("Título"); ?></th> <!-- title -->
<th><?php echo Text::_("Fecha"); ?></th> <!-- date -->
<th><?php echo Text::_("Publicado"); ?></th>
<th><?php echo Text::_("En portada"); ?></th>
<th><?php echo Text::_("Al pie"); ?></th>
<th><!-- <?php echo Text::_("Traducir"); ?>--></th>
<td><!-- <?php echo Text::_("Remove"); ?> --></td>
<td></td><!-- preview -->
<th>Autor</th>
</tr>
</thead>

<tbody>
<?php foreach ($this['posts'] as $post) : ?>
<?php while ($post = $pagedResults->fetchPagedRow()) : ?>
<tr>
<td><a href="/admin/blog/edit/<?php echo $post->id; ?>">[<?php echo Text::_("Editar"); ?>]</a></td>
<td><?php echo $post->title; ?></td>
<td><?php echo $post->date; ?></td>
<td><?php echo $post->publish ? Text::_("") : ''; ?></td>
<td><?php echo $post->home ? Text::_("") : ''; ?></td>
<td><?php echo $post->footer ? Text::_("") : ''; ?></td>
<?php if ($translator) : ?>
<td><a href="/translate/post/edit/<?php echo $post->id; ?>" >[<?php echo Text::_("Traducir"); ?>]</a></td>
<?php endif; ?>
<td><a href="/admin/blog/remove/<?php echo $post->id; ?>" onclick="return confirm('<?php echo Text::_("Seguro que deseas eliminar este registro?"); ?>');">[<?php echo Text::_("Quitar"); ?>]</a></td>
<td><a href="/blog/<?php echo $post->id; ?>?preview=<?php echo $_SESSION['user']->id ?>" target="_blank">[<?php echo Text::_("Ver publicado"); ?>]</a></td>
<td><?php if ($post->publish) echo '<strong style="color:#20b2b3;font-size:10px;">Publicada</sttrong>'; ?></td>
<td colspan="6"><?php
$style = '';
if (isset($this['homes'][$post->id]))
$style .= ' font-weight:bold;';
if (empty($_SESSION['admin_node']) || $_SESSION['admin_node'] == \GOTEO_NODE) {
if (isset($this['footers'][$post->id]))
$style .= ' font-style:italic;';
}

echo "<span style=\"{$style}\">{$post->title}</span>";
?></td>
<td><?php echo $post->fecha; ?></td>
<td><?php echo $post->user->name . ' (' . $post->owner_name . ')'; ?></td>
</tr>
<?php endforeach; ?>
<tr>
<td><a href="/blog/<?php echo $post->id; ?>?preview=<?php echo $_SESSION['user']->id ?>" target="_blank">[Ver]</a></td>
<td><?php if (($post->owner_type == 'node' && $post->owner_id == $node) || $node == \GOTEO_NODE) : ?>
<a href="/admin/blog/edit/<?php echo $post->id; ?>">[Editar]</a>
<?php endif; ?></td>
<td><?php if (isset($this['homes'][$post->id])) {
echo '<a href="/admin/blog/remove_home/'.$post->id.'" style="color:red;">[Quitar de portada]</a>';
} elseif ($post->publish) {
echo '<a href="/admin/blog/add_home/'.$post->id.'" style="color:blue;">[Poner en portada]</a>';
} ?></td>
<td><?php if (empty($_SESSION['admin_node']) || $_SESSION['admin_node'] == \GOTEO_NODE) {
if (isset($this['footers'][$post->id])) {
echo '<a href="/admin/blog/remove_footer/'.$post->id.'" style="color:red;">[Quitar del footer]</a>';
} elseif ($post->publish) {
echo '<a href="/admin/blog/add_footer/'.$post->id.'" style="color:blue;">[Poner en footer]</a>';
}
} ?></td>
<td>
<?php if ($translator && $node == \GOTEO_NODE) : ?><a href="/translate/post/edit/<?php echo $post->id; ?>" >[Traducir]</a><?php endif; ?>
<?php if ($node != \GOTEO_NODE && $transNode && ($post->owner_type == 'node' && $post->owner_id == $node)) : ?><a href="/translate/node/<?php echo $node ?>/post/edit/<?php echo $post->id; ?>" target="_blank">[Traducir]</a><?php endif; ?>
</td>
<td><?php if (!$post->publish && (($post->owner_type == 'node' && $post->owner_id == $_SESSION['admin_node']) || !isset($_SESSION['admin_node']))) : ?>
<a href="/admin/blog/remove/<?php echo $post->id; ?>" onclick="return confirm('Seguro que deseas eliminar este registro?');">[Eliminar]</a>
<?php endif; ?></td>
<td></td>
</tr>
<tr>
<td colspan="9"><hr /></td>
</tr>
<?php endwhile; ?>
</tbody>

</table>
<?php else : ?>
<p><?php echo Text::_("No se han encontrado registros"); ?></p>
<?php endif; ?>
</div>
</div>
<ul id="pagination" style="margin-bottom: 10px; padding-left: 150px;">
<?php $pagedResults->setLayout(new DoubleBarLayout());
echo $pagedResults->fetchPagedNavigation(str_replace('?', '&', $the_filters)); ?>
</ul>
<?php else : ?>
<p>No se han encontrado registros</p>
<?php endif; ?>
2 changes: 1 addition & 1 deletion view/admin/criteria/edit.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</script>

<div class="widget board">
<form method="post" action="/admin/criteria/?filter=<?php echo $this['filter']; ?>">
<form method="post" action="/admin/criteria">

<input type="hidden" name="action" value="<?php echo $this['action']; ?>" />
<input type="hidden" name="id" value="<?php echo $this['criteria']->id; ?>" />
Expand Down
15 changes: 8 additions & 7 deletions view/admin/criteria/list.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
Goteo\Core\ACL;

$translator = ACL::check('/translate') ? true : false;
$filters = $this['filters'];
?>
<a href="/admin/criteria/add/?filter=<?php echo $this['filter']; ?>" class="button red"><?php echo Text::_('Añadir criterio'); ?></a>
<a href="/admin/criteria/add" class="button"><?php echo Text::_('Añadir criterio'); ?></a>

<div class="widget board">
<form id="sectionfilter-form" action="/admin/criteria" method="get">
<label for="section-filter"><?php echo Text::_('Mostrar los criterios de la sección:'); ?></label>
<select id="section-filter" name="filter" onchange="document.getElementById('sectionfilter-form').submit();">
<select id="section-filter" name="section" onchange="document.getElementById('sectionfilter-form').submit();">
<?php foreach ($this['sections'] as $sectionId=>$sectionName) : ?>
<option value="<?php echo $sectionId; ?>"<?php if ($this['filter'] == $sectionId) echo ' selected="selected"';?>><?php echo $sectionName; ?></option>
<option value="<?php echo $sectionId; ?>"<?php if ($filters['section'] == $sectionId) echo ' selected="selected"';?>><?php echo $sectionName; ?></option>
<?php endforeach; ?>
</select>
</form>
Expand All @@ -54,15 +55,15 @@
<tbody>
<?php foreach ($this['criterias'] as $criteria) : ?>
<tr>
<td><a href="/admin/criteria/edit/<?php echo $criteria->id; ?>/?filter=<?php echo $this['filter']; ?>">[Editar]</a></td>
<td><a href="/admin/criteria/edit/<?php echo $criteria->id; ?>">[Editar]</a></td>
<td><?php echo $criteria->title; ?></td>
<td><?php echo $criteria->order; ?></td>
<td><a href="/admin/criteria/up/<?php echo $criteria->id; ?>/?filter=<?php echo $this['filter']; ?>">[&uarr;]</a></td>
<td><a href="/admin/criteria/down/<?php echo $criteria->id; ?>/?filter=<?php echo $this['filter']; ?>">[&darr;]</a></td>
<td><a href="/admin/criteria/up/<?php echo $criteria->id; ?>">[&uarr;]</a></td>
<td><a href="/admin/criteria/down/<?php echo $criteria->id; ?>">[&darr;]</a></td>
<?php if ($translator) : ?>
<td><a href="/translate/criteria/edit/<?php echo $criteria->id; ?>" >[Traducir]</a></td>
<?php endif; ?>
<td><a href="/admin/criteria/remove/<?php echo $criteria->id; ?>/?filter=<?php echo $this['filter']; ?>" onclick="return confirm('Seguro que deseas eliminar este registro?');">[Quitar]</a></td>
<td><a href="/admin/criteria/remove/<?php echo $criteria->id; ?>" onclick="return confirm('Seguro que deseas eliminar este registro?');">[Quitar]</a></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion view/admin/faq/edit.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
});
</script>
<div class="widget board">
<form method="post" action="/admin/faq/?filter=<?php echo $this['filter']; ?>">
<form method="post" action="/admin/faq">

<input type="hidden" name="action" value="<?php echo $this['action']; ?>" />
<input type="hidden" name="id" value="<?php echo $this['faq']->id; ?>" />
Expand Down
21 changes: 11 additions & 10 deletions view/admin/faq/list.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
Goteo\Core\ACL;

$translator = ACL::check('/translate') ? true : false;
$filters = $this['filters'];
?>
<a href="/admin/faq/add/?filter=<?php echo $this['filter']; ?>" class="button red"><?php echo("Añadir pregunta");?></a>
<a href="/admin/faq/add/?filter=" class="button red"><?php echo Text::_("Añadir pregunta");?></a>

<div class="widget board">
<form id="sectionfilter-form" action="/admin/faq" method="get">
<label for="section-filter"><?php echo("Mostrar las preguntas de:");?></label>
<select id="section-filter" name="filter" onchange="document.getElementById('sectionfilter-form').submit();">
<label for="section-filter"><?php echo Text::_("Mostrar las preguntas de:");?></label>
<select id="section-filter" name="section" onchange="document.getElementById('sectionfilter-form').submit();">
<?php foreach ($this['sections'] as $sectionId=>$sectionName) : ?>
<option value="<?php echo $sectionId; ?>"<?php if ($this['filter'] == $sectionId) echo ' selected="selected"';?>><?php echo $sectionName; ?></option>
<option value="<?php echo $sectionId; ?>"<?php if ($filters['section'] == $sectionId) echo ' selected="selected"';?>><?php echo $sectionName; ?></option>
<?php endforeach; ?>
</select>
</form>
Expand All @@ -42,8 +43,8 @@
<thead>
<tr>
<td><!-- Edit --></td>
<th><?php echo("Título");?></th> <!-- title -->
<th><?php echo("Posición");?></th> <!-- order -->
<th><?php echo Text::_("Título");?></th> <!-- title -->
<th><?php echo Text::_("Posición");?></th> <!-- order -->
<td><!-- Move up --></td>
<td><!-- Move down --></td>
<td><!-- Traducir--></td>
Expand All @@ -54,15 +55,15 @@
<tbody>
<?php foreach ($this['faqs'] as $faq) : ?>
<tr>
<td><a href="/admin/faq/edit/<?php echo $faq->id; ?>/?filter=<?php echo $this['filter']; ?>">[Editar]</a></td>
<td><a href="/admin/faq/edit/<?php echo $faq->id; ?>">[Editar]</a></td>
<td><?php echo $faq->title; ?></td>
<td><?php echo $faq->order; ?></td>
<td><a href="/admin/faq/up/<?php echo $faq->id; ?>/?filter=<?php echo $this['filter']; ?>">[&uarr;]</a></td>
<td><a href="/admin/faq/down/<?php echo $faq->id; ?>/?filter=<?php echo $this['filter']; ?>">[&darr;]</a></td>
<td><a href="/admin/faq/up/<?php echo $faq->id; ?>">[&uarr;]</a></td>
<td><a href="/admin/faq/down/<?php echo $faq->id; ?>">[&darr;]</a></td>
<?php if ($translator) : ?>
<td><a href="/translate/faq/edit/<?php echo $faq->id; ?>" >[Traducir]</a></td>
<?php endif; ?>
<td><a href="/admin/faq/remove/<?php echo $faq->id; ?>/?filter=<?php echo $this['filter']; ?>" onclick="return confirm('Seguro que deseas eliminar este registro?');">[Quitar]</a></td>
<td><a href="/admin/faq/remove/<?php echo $faq->id; ?>" onclick="return confirm('Seguro que deseas eliminar este registro?');">[Quitar]</a></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
31 changes: 12 additions & 19 deletions view/admin/glossary/edit.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,28 @@
*
*/


use Goteo\Library\Text,
Goteo\Model,
Goteo\Core\Redirection,
Goteo\Library\SuperForm;

define('ADMIN_NOAUTOSAVE', true);
Goteo\Library\NormalForm;

$post = $this['post'];

if (!$post instanceof Model\Glossary) {
throw new Redirection('/admin/glossary');
}

// Superform
$images = array();
foreach ($post->gallery as $image) {
$images[] = array(
'type' => 'html',
'class' => 'inline gallery-image',
'html' => is_object($image) ?
$images = array();
foreach ($post->gallery as $image) {
$images[] = array(
'type' => 'html',
'class' => 'inline gallery-image',
'html' => is_object($image) ?
$image . '<img src="'.SRC_URL.'/image/'.$image->id.'/128/128" alt="'.Text::_("Imagen").'" /><button class="image-remove weak" type="submit" name="gallery-'.$image->id.'-remove" title="'.Text::_("Quitar imagen").'" value="'.Text::_("remove").'"></button>' :
''
);

}
''
);

}
?>
<script type="text/javascript" src="/view/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
Expand All @@ -71,9 +66,9 @@
});
</script>

<form method="post" action="/admin/glossary/<?php echo $this['action']; ?>/<?php echo $post->id; ?>" class="project" enctype="multipart/form-data">
<form method="post" action="/admin/glossary/<?php echo $this['action']; ?>/<?php echo $post->id; ?>" enctype="multipart/form-data">

<?php echo new SuperForm(array(
<?php echo new NormalForm(array(

'action' => '',
'level' => 3,
Expand All @@ -96,14 +91,12 @@
),
'title' => array(
'type' => 'textbox',
'required' => true,
'size' => 20,
'title' => Text::_("Término"),
'value' => $post->title,
),
'text' => array(
'type' => 'textarea',
'required' => true,
'cols' => 40,
'rows' => 4,
'title' => Text::_("Explicación del término"),
Expand Down
2 changes: 1 addition & 1 deletion view/admin/glossary/list.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

$translator = ACL::check('/translate') ? true : false;
?>
<a href="/admin/glossary/add" class="button red"><?php echo Text::_("Nuevo término"); ?></a>
<a href="/admin/glossary/add" class="button"><?php echo Text::_("Nuevo término"); ?></a>

<div class="widget board">
<?php if (!empty($this['posts'])) : ?>
Expand Down
2 changes: 1 addition & 1 deletion view/admin/icons/edit.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
?>
<div class="widget board">
<!-- super form -->
<form method="post" action="/admin/icons?filter=<?php echo $this['filter']; ?>">
<form method="post" action="/admin/icons">

<input type="hidden" name="action" value="<?php echo $this['action']; ?>" />
<input type="hidden" name="id" value="<?php echo $this['icon']->id; ?>" />
Expand Down
Loading

0 comments on commit 0692975

Please sign in to comment.