This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
forked from joomla/joomla-cms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[adjuntos] inicia la visualización de adjuntos en frontend
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
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
This comment has been minimized.
Sorry, something went wrong. |
||
/** | ||
* @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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Ignorar este archivo, se elimina en el siguiente commit 👎