This commit is contained in:
2024-12-31 11:07:09 +01:00
parent df7915205d
commit e089172b15
1916 changed files with 165422 additions and 271 deletions

View File

@ -0,0 +1,147 @@
<?php
/**
* @version CVS: 1.0.0
* @package Com_Highlights
* @author Eddy Prosperi <eddy.prosperi@protocollicreativi.it>
* @copyright 2024 Eddy Prosperi
* @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
use \Joomla\CMS\HTML\HTMLHelper;
use \Joomla\CMS\Factory;
use \Joomla\CMS\Uri\Uri;
use \Joomla\CMS\Router\Route;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Session\Session;
use Joomla\Utilities\ArrayHelper;
$canEdit = Factory::getApplication()->getIdentity()->authorise('core.edit', 'com_highlights');
if (!$canEdit && Factory::getApplication()->getIdentity()->authorise('core.edit.own', 'com_highlights'))
{
$canEdit = Factory::getApplication()->getIdentity()->id == $this->item->created_by;
}
?>
<div class="item_fields">
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;?>
<table class="table">
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_ETICHETTA'); ?></th>
<td><?php echo $this->item->etichetta; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_TITOLO'); ?></th>
<td><?php echo $this->item->titolo; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_SOTTOTITOLO'); ?></th>
<td><?php echo $this->item->sottotitolo; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_DESCRIZIONE'); ?></th>
<td><?php echo nl2br($this->item->descrizione); ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_LINGUA'); ?></th>
<td><?php echo $this->item->lingua; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_LINK_PULSANTE'); ?></th>
<td><?php echo $this->item->link_pulsante; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_TESTO_PULSANTE'); ?></th>
<td><?php echo $this->item->testo_pulsante; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_DATA'); ?></th>
<td> <?php
$date = $this->item->data;
echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-';
?>
</td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_IMMAGINE_MAIN'); ?></th>
<td><?php echo $this->item->immagine_main; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_IMMAGINE_SECONDARIA'); ?></th>
<td><?php echo $this->item->immagine_secondaria; ?></td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_DATA_INIZIO_PUBBLICAZIONE'); ?></th>
<td> <?php
$date = $this->item->data_inizio_pubblicazione;
echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-';
?>
</td>
</tr>
<tr>
<th><?php echo Text::_('COM_HIGHLIGHTS_FORM_LBL_HIGHLIGHT_DATA_FINE_PUBBLICAZIONE'); ?></th>
<td> <?php
$date = $this->item->data_fine_pubblicazione;
echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-';
?>
</td>
</tr>
</table>
</div>
<?php $canCheckin = Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_highlights.' . $this->item->id) || $this->item->checked_out == Factory::getApplication()->getIdentity()->id; ?>
<?php if($canEdit && $this->item->checked_out == 0): ?>
<a class="btn btn-outline-primary" href="<?php echo Route::_('index.php?option=com_highlights&task=highlight.edit&id='.$this->item->id); ?>"><?php echo Text::_("COM_HIGHLIGHTS_EDIT_ITEM"); ?></a>
<?php elseif($canCheckin && $this->item->checked_out > 0) : ?>
<a class="btn btn-outline-primary" href="<?php echo Route::_('index.php?option=com_highlights&task=highlight.checkin&id=' . $this->item->id .'&'. Session::getFormToken() .'=1'); ?>"><?php echo Text::_("JLIB_HTML_CHECKIN"); ?></a>
<?php endif; ?>
<?php if (Factory::getApplication()->getIdentity()->authorise('core.delete','com_highlights.highlight.'.$this->item->id)) : ?>
<a class="btn btn-danger" rel="noopener noreferrer" href="#deleteModal" role="button" data-bs-toggle="modal">
<?php echo Text::_("COM_HIGHLIGHTS_DELETE_ITEM"); ?>
</a>
<?php echo HTMLHelper::_(
'bootstrap.renderModal',
'deleteModal',
array(
'title' => Text::_('COM_HIGHLIGHTS_DELETE_ITEM'),
'height' => '50%',
'width' => '20%',
'modalWidth' => '50',
'bodyHeight' => '100',
'footer' => '<button class="btn btn-outline-primary" data-bs-dismiss="modal">Close</button><a href="' . Route::_('index.php?option=com_highlights&task=highlight.remove&id=' . $this->item->id, false, 2) .'" class="btn btn-danger">' . Text::_('COM_HIGHLIGHTS_DELETE_ITEM') .'</a>'
),
Text::sprintf('COM_HIGHLIGHTS_DELETE_CONFIRM', $this->item->id)
); ?>
<?php endif; ?>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_HIGHLIGHTS_TITLE_ITEM_VIEW_HIGHLIGHT" option="View">
<message>
<![CDATA[COM_HIGHLIGHTS_TITLE_ITEM_VIEW_HIGHLIGHT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset
name="request"
label="COM_HIGHLIGHTS_FIELDSET_ITEM_ID_SELECT_LABEL">
<field
name="id"
query="SELECT `id`, `titolo` FROM #__highlights_ ORDER BY `id`"
type="sql"
key_field="id"
value_field="titolo"
label="COM_HIGHLIGHTS_ITEM_ID_SELECT_LABEL"
require="true"
description="JGLOBAL_SHOW_TITLE_DESC">
</field>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1 @@
<html><body></body></html>

View File

@ -0,0 +1,117 @@
<?php
/**
* @version CVS: 1.0.0
* @package Com_Highlights
* @author Eddy Prosperi <eddy.prosperi@protocollicreativi.it>
* @copyright 2024 Eddy Prosperi
* @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
use \Joomla\CMS\HTML\HTMLHelper;
use \Joomla\CMS\Factory;
use \Joomla\CMS\Uri\Uri;
use \Joomla\CMS\Router\Route;
use \Joomla\CMS\Language\Text;
use \Pcrt\Component\Highlights\Site\Helper\HighlightsHelper;
$wa = $this->document->getWebAssetManager();
$wa->useScript('keepalive')
->useScript('form.validate');
HTMLHelper::_('bootstrap.tooltip');
// Load admin language file
$lang = Factory::getLanguage();
$lang->load('com_highlights', JPATH_SITE);
$user = Factory::getApplication()->getIdentity();
$canEdit = HighlightsHelper::canUserEdit($this->item, $user);
?>
<div class="highlight-edit front-end-edit">
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;?>
<?php if (!$canEdit) : ?>
<h3>
<?php throw new \Exception(Text::_('COM_HIGHLIGHTS_ERROR_MESSAGE_NOT_AUTHORISED'), 403); ?>
</h3>
<?php else : ?>
<?php if (!empty($this->item->id)): ?>
<h1><?php echo Text::sprintf('COM_HIGHLIGHTS_EDIT_ITEM_TITLE', $this->item->id); ?></h1>
<?php else: ?>
<h1><?php echo Text::_('COM_HIGHLIGHTS_ADD_ITEM_TITLE'); ?></h1>
<?php endif; ?>
<form id="form-highlight"
action="<?php echo Route::_('index.php?option=com_highlights&task=highlightform.save'); ?>"
method="post" class="form-validate form-horizontal" enctype="multipart/form-data">
<input type="hidden" name="jform[id]" value="<?php echo isset($this->item->id) ? $this->item->id : ''; ?>" />
<input type="hidden" name="jform[state]" value="<?php echo isset($this->item->state) ? $this->item->state : ''; ?>" />
<?php echo $this->form->getInput('created_by'); ?>
<?php echo $this->form->getInput('modified_by'); ?>
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => 'highlight')); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'highlight', Text::_('COM_HIGHLIGHTS_TAB_HIGHLIGHT', true)); ?>
<?php echo $this->form->renderField('etichetta'); ?>
<?php echo $this->form->renderField('titolo'); ?>
<?php echo $this->form->renderField('sottotitolo'); ?>
<?php echo $this->form->renderField('descrizione'); ?>
<?php echo $this->form->renderField('lingua'); ?>
<?php echo $this->form->renderField('link_pulsante'); ?>
<?php echo $this->form->renderField('testo_pulsante'); ?>
<?php echo $this->form->renderField('data'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'Immagini', Text::_('COM_HIGHLIGHTS_TAB_IMMAGINI', true)); ?>
<?php echo $this->form->renderField('immagine_main'); ?>
<?php echo $this->form->renderField('immagine_secondaria'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'Pubblicazione', Text::_('COM_HIGHLIGHTS_TAB_PUBBLICAZIONE', true)); ?>
<?php echo $this->form->renderField('data_inizio_pubblicazione'); ?>
<?php echo $this->form->renderField('data_fine_pubblicazione'); ?>
<?php echo HTMLHelper::_('uitab.endTab'); ?>
<div class="control-group">
<div class="controls">
<?php if ($this->canSave): ?>
<button type="submit" class="validate btn btn-primary">
<span class="fas fa-check" aria-hidden="true"></span>
<?php echo Text::_('JSUBMIT'); ?>
</button>
<?php endif; ?>
<a class="btn btn-danger"
href="<?php echo Route::_('index.php?option=com_highlights&task=highlightform.cancel'); ?>"
title="<?php echo Text::_('JCANCEL'); ?>">
<span class="fas fa-times" aria-hidden="true"></span>
<?php echo Text::_('JCANCEL'); ?>
</a>
</div>
</div>
<input type="hidden" name="option" value="com_highlights"/>
<input type="hidden" name="task"
value="highlightform.save"/>
<?php echo HTMLHelper::_('form.token'); ?>
</form>
<?php endif; ?>
</div>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_HIGHLIGHTS_TITLE_FORM_VIEW_HIGHLIGHT" option="View">
<message>
<![CDATA[COM_HIGHLIGHTS_TITLE_FORM_VIEW_HIGHLIGHT_DESC]]>
</message>
</layout>
<fields name="params">
<fieldset
name="basic"
label="COM_HIGHLIGHTS_FIELDSET_ITEM_ID_SELECT_LABEL">
<field
name="item_id"
query="SELECT 0 as `id` UNION SELECT `id` FROM #__highlights_ ORDER BY `id`"
type="sql"
key_field="id"
value_field="id"
label="COM_HIGHLIGHTS_ITEM_ID_SELECT_LABEL_FORM"
require="true"
description="JGLOBAL_SHOW_TITLE_DESC">
</field>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1 @@
<html><body></body></html>

View File

@ -0,0 +1,167 @@
<?php
/**
* @version CVS: 1.0.0
* @package Com_Highlights
* @author Eddy Prosperi <eddy.prosperi@protocollicreativi.it>
* @copyright 2024 Eddy Prosperi
* @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
use \Joomla\CMS\HTML\HTMLHelper;
use \Joomla\CMS\Factory;
use \Joomla\CMS\Uri\Uri;
use \Joomla\CMS\Router\Route;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Layout\LayoutHelper;
use \Joomla\CMS\Session\Session;
use \Joomla\CMS\User\UserFactoryInterface;
HTMLHelper::_('bootstrap.tooltip');
HTMLHelper::_('behavior.multiselect');
HTMLHelper::_('formbehavior.chosen', 'select');
$user = Factory::getApplication()->getIdentity();
$userId = $user->get('id');
$listOrder = $this->state->get('list.ordering');
$listDirn = $this->state->get('list.direction');
$canCreate = $user->authorise('core.create', 'com_highlights') && file_exists(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'highlightform.xml');
$canEdit = $user->authorise('core.edit', 'com_highlights') && file_exists(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'highlightform.xml');
$canCheckin = $user->authorise('core.manage', 'com_highlights');
$canChange = $user->authorise('core.edit.state', 'com_highlights');
$canDelete = $user->authorise('core.delete', 'com_highlights');
// Import CSS
$wa = $this->document->getWebAssetManager();
$wa->useStyle('com_highlights.list');
?>
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;?>
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post"
name="adminForm" id="adminForm">
<div class="table-responsive">
<table class="table table-striped" id="highlightList">
<thead>
<tr>
<th class=''>
<?php echo HTMLHelper::_('grid.sort', 'COM_HIGHLIGHTS_HIGHLIGHTS_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
<th >
<?php echo HTMLHelper::_('grid.sort', 'JPUBLISHED', 'a.state', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo HTMLHelper::_('grid.sort', 'COM_HIGHLIGHTS_HIGHLIGHTS_TITOLO', 'a.titolo', $listDirn, $listOrder); ?>
</th>
<th class=''>
<?php echo HTMLHelper::_('grid.sort', 'COM_HIGHLIGHTS_HIGHLIGHTS_ETICHETTA', 'a.etichetta', $listDirn, $listOrder); ?>
</th>
<?php if ($canEdit || $canDelete): ?>
<th class="center">
<?php echo Text::_('COM_HIGHLIGHTS_HIGHLIGHTS_ACTIONS'); ?>
</th>
<?php endif; ?>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="<?php echo isset($this->items[0]) ? count(get_object_vars($this->items[0])) : 10; ?>">
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php $canEdit = $user->authorise('core.edit', 'com_highlights'); ?>
<?php if (!$canEdit && $user->authorise('core.edit.own', 'com_highlights')): ?>
<?php $canEdit = Factory::getApplication()->getIdentity()->id == $item->created_by; ?>
<?php endif; ?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<?php echo $item->id; ?>
</td>
<td>
<?php $class = ($canChange) ? 'active' : 'disabled'; ?>
<a class="btn btn-micro <?php echo $class; ?>" href="<?php echo ($canChange) ? Route::_('index.php?option=com_highlights&task=highlight.publish&id=' . $item->id . '&state=' . (($item->state + 1) % 2), false, 2) : '#'; ?>">
<?php if ($item->state == 1): ?>
<i class="icon-publish"></i>
<?php else: ?>
<i class="icon-unpublish"></i>
<?php endif; ?>
</a>
</td>
<td>
<?php $canCheckin = Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_highlights.' . $item->id) || $item->checked_out == Factory::getApplication()->getIdentity()->id; ?>
<?php if($canCheckin && $item->checked_out > 0) : ?>
<a href="<?php echo Route::_('index.php?option=com_highlights&task=highlight.checkin&id=' . $item->id .'&'. Session::getFormToken() .'=1'); ?>">
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->uEditor, $item->checked_out_time, 'highlight.', false); ?></a>
<?php endif; ?>
<a href="<?php echo Route::_('index.php?option=com_highlights&view=highlight&id='.(int) $item->id); ?>">
<?php echo $this->escape($item->titolo); ?></a>
</td>
<td>
<?php echo $item->etichetta; ?>
</td>
<?php if ($canEdit || $canDelete): ?>
<td class="center">
<?php $canCheckin = Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_highlights.' . $item->id) || $item->checked_out == Factory::getApplication()->getIdentity()->id; ?>
<?php if($canEdit && $item->checked_out == 0): ?>
<a href="<?php echo Route::_('index.php?option=com_highlights&task=highlight.edit&id=' . $item->id, false, 2); ?>" class="btn btn-mini" type="button"><i class="icon-edit" ></i></a>
<?php endif; ?>
<?php if ($canDelete): ?>
<a href="<?php echo Route::_('index.php?option=com_highlights&task=highlightform.remove&id=' . $item->id, false, 2); ?>" class="btn btn-mini delete-button" type="button"><i class="icon-trash" ></i></a>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if ($canCreate) : ?>
<a href="<?php echo Route::_('index.php?option=com_highlights&task=highlightform.edit&id=0', false, 0); ?>"
class="btn btn-success btn-small"><i
class="icon-plus"></i>
<?php echo Text::_('COM_HIGHLIGHTS_ADD_ITEM'); ?></a>
<?php endif; ?>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<input type="hidden" name="filter_order" value=""/>
<input type="hidden" name="filter_order_Dir" value=""/>
<?php echo HTMLHelper::_('form.token'); ?>
</form>
<?php
if($canDelete) {
$wa->addInlineScript("
jQuery(document).ready(function () {
jQuery('.delete-button').click(deleteItem);
});
function deleteItem() {
if (!confirm(\"" . Text::_('COM_HIGHLIGHTS_DELETE_MESSAGE') . "\")) {
return false;
}
}
", [], [], ["jquery"]);
}
?>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_HIGHLIGHTS_TITLE_LIST_VIEW_HIGHLIGHTS" option="View">
<message>
<![CDATA[COM_HIGHLIGHTS_TITLE_LIST_VIEW_HIGHLIGHTS_DESC]]>
</message>
</layout>
</metadata>

View File

@ -0,0 +1 @@
<html><body></body></html>