Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
[adjuntos] inicia la visualización de adjuntos en frontend
Browse files Browse the repository at this point in the history
Este proceso requiere de un nuevo plugin de contenido el cual
implementa un nuevo método JHtml para obtener los adjuntos de la base de
datos y construir la salida html. Para visualizar los adjuntos en el
front end, no olvidar habilitar el plugin Jokte Adjuntos en el gestor de
Plugins
  • Loading branch information
snaphuman committed Mar 10, 2015
1 parent 58a2ba8 commit 02b2131
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
37 changes: 37 additions & 0 deletions libraries/joomla/html/html/adjuntos.php
@@ -0,0 +1,37 @@
<?php
/**
* @package Jokte.Site
* @subpackage com_content
* @copyright Copyleft 2012 - 2014 Comunidad Juuntos.
* @license GNU General Public License version 3
*/

defined('_JEXEC') or die('Acceso directo a este archivo no permitido');

jimport('joomla.html.html');

abstract class JHtmlAdjuntos {

static function lista($id, $text, $params) {

// TODO: verificar que el artículo tenga archivos adjuntos

// TODO: obtener el objeto con la lista de adjuntos

// TODO: construir la tabla html

$html = "";
$html .= "<table>";
$html .= " <thead>";
$html .= " <tr>";
$html .= " <td>Tipo</td>";
$html .= " <td>Nombre de Archivo</td>";
$html .= " <td>Info</td>";
$html .= " </tr>";
$html .= " </thead>";
$html .= "</table>";

return $html;
}
}

22 changes: 22 additions & 0 deletions plugins/content/jokteadjuntos/jokte_adjuntos.php
@@ -0,0 +1,22 @@
<?php

This comment has been minimized.

Copy link
@snaphuman

snaphuman Mar 10, 2015

Author Member

Ignorar este archivo, se elimina en el siguiente commit 👎

/**
* @version 0.1.0
* @package Jokte.Plugin
* @copyright CopyLeft Comparte Igual. Comunidad Juuntos Latinoamérica.
* @license GNU/GPL v3.0
*/

defined('_JEXEC') or die('Acceso directo a este archivo restringido');

jimport('joomla.plugin.plugin');

class plgContentJokteadjuntos extends JPlugin {

function onContentPrepare ($context, &$article, &$params, $offset=0) {

$text = &$article;

var_dump($text);
}

}
33 changes: 33 additions & 0 deletions plugins/content/jokteadjuntos/jokteadjuntos.php
@@ -0,0 +1,33 @@
<?php
/**
* @version 0.1.0
* @package Jokte.Plugin
* @copyright CopyLeft Comparte Igual. Comunidad Juuntos Latinoamérica.
* @license GNU/GPL v3.0
*/

defined('_JEXEC') or die('Acceso directo a este archivo restringido');

jimport('joomla.plugin.plugin');
jimport('joomla.html.html');

class plgContentJokteadjuntos extends JPlugin {

public function onContentBeforeDisplay ($context, &$article, &$params, $offset = 0 ) {

// Realiza algunas validaciones antes de continuar con la
// ejecución para traer los archivos arjuntos
// TODO: Buscar una forma más elegante para estas validaciones
if(!$params->get('enabled', 1)) return;
if ($context != 'com_content.article') return;
if(!$params->get('show_attachments')) return;

$app = JFactory::getApplication();
$jinput = $app->input;

$id = $jinput->get('id');

$article->text .= JHtml::_('adjuntos.lista', $article->id, $article->text, $params);
}

}
15 changes: 15 additions & 0 deletions plugins/content/jokteadjuntos/jokteadjuntos.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="content" version="1.3.5" method="upgrade">
<name>Contenido - Jokte Adjuntos</name>
<author>Fabián Hernández</author>
<creationDate>Febrero 2014</creationDate>
<copyright>CopyLeft Comparte Igual!</copyright>
<license>GNU GPLv3</license>
<authorEmail>fhernandezn@gmail.com</authorEmail>
<version>0.1.0</version>
<description>Plugin que permite incorporar los archivos adjuntos en los artículos del frontend</description>

<files>
<filename plugin="jokteadjuntos">jokteadjuntos.php</filename>
</files>
</extension>

0 comments on commit 02b2131

Please sign in to comment.