Files
conservatorio-tomadini/components/com_highlights/tmpl/highlight/default.php

152 lines
5.4 KiB
PHP

<?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_CLASSE'); ?></th>
<td><?php echo $this->item->classe; ?></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; ?>