137 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			137 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| /**
 | |
|  * @version     CVS: 1.0.0
 | |
|  * @package     com_highlights
 | |
|  * @subpackage  mod_highlights
 | |
|  * @author      Eddy Prosperi <eddy.prosperi@protocollicreativi.it>
 | |
|  * @copyright   2024 Eddy Prosperi
 | |
|  * @license     GNU General Public License versione 2 o successiva; vedi LICENSE.txt
 | |
|  */
 | |
| defined('_JEXEC') or die;
 | |
| 
 | |
| use Pcrt\Module\Highlights\Site\Helper\HighlightsHelper;
 | |
| use Joomla\CMS\Language\Text;
 | |
| use Joomla\CMS\Factory;
 | |
| use Joomla\CMS\Uri\Uri;
 | |
| 
 | |
| $baseImagePath = Uri::root(false) . "media/templates/site/joomla-italia-theme/images/";
 | |
| 
 | |
| $elements = HighlightsHelper::getList($params);
 | |
| 
 | |
| //Come accedere alle variabili generali:
 | |
| $opacita = $params->get('opacita', []);
 | |
| $sfondo = $params->get('sfondo', []);
 | |
| 
 | |
| $classemodulo = $params->get('header_class', []);
 | |
| 
 | |
| $wa = Factory::getApplication()->getDocument()->getWebAssetManager();
 | |
| $wa->useStyle('swiper.css.styles', ['position' => 'before']);
 | |
| $wa->useScript('swiper.js.scripts');
 | |
| 
 | |
| 
 | |
| $wa->addInlineScript('
 | |
| window.addEventListener("DOMContentLoaded", function(){
 | |
| 
 | |
| var swiper = new Swiper(".carosello'. $module->id . '", {
 | |
|       slidesPerView: 1,
 | |
|       spaceBetween: 10,
 | |
|       loop: true,
 | |
|       navigation: {
 | |
|         nextEl: ".swiper-button-next.swp-'. $module->id .'",
 | |
|         prevEl: ".swiper-button-prev.swp-'. $module->id .'",
 | |
|       },
 | |
|     breakpoints: {
 | |
| 
 | |
|         480: {
 | |
|             spaceBetween: 10,
 | |
|             slidesPerView: 2,
 | |
|         },
 | |
| 
 | |
|         768: {
 | |
|             spaceBetween: 10,
 | |
|             slidesPerView: 3,
 | |
|         },
 | |
| 
 | |
|         1200: {
 | |
|             spaceBetween: 20,
 | |
|             slidesPerView: 4,
 | |
|         },
 | |
| 
 | |
|         1524: {
 | |
|             spaceBetween: 40,
 | |
|             slidesPerView: 5,
 | |
|         },
 | |
|       },
 | |
|     });
 | |
| });
 | |
| 
 | |
| ', [], ['type' => 'text/javascript']);
 | |
| 
 | |
| 
 | |
| ?>
 | |
| 
 | |
| 	<?php //var_dump($module); ?>
 | |
| 
 | |
| <?php if (!empty($elements)) : ?>    
 | |
|   <div class="py-5 <?= !empty($classemodulo) ? $classemodulo : 'bg-grigio'; ?>">
 | |
|     <?php if ((bool) $module->showtitle) : ?>
 | |
|       <div class="titolo-linea mb-4">
 | |
|         <div class="ps-4 ps-lg-3 container bg-grigio position-relative"><span class="h2 rosso"><?= $module->title; ?></span></div>
 | |
|         <div class="swiper-controls carosellimoduli">
 | |
|             <div class="swiper-button-next swiper-button-next swp-<?= $module->id; ?>"></div>
 | |
|             <div class="swiper-button-prev swiper-button-prev swp-<?= $module->id; ?>"></div>
 | |
|         </div> 
 | |
|       </div>
 | |
|     <?php endif; ?>
 | |
| 	<div class="container-jit">
 | |
| 		<div class="swiper carosello<?= $module->id; ?>">
 | |
| 			<div class="swiper-wrapper">
 | |
| 				<?php foreach ($elements as $index => $element) : ?>
 | |
| 					<div class="swiper-slide">
 | |
| 						<div class="swiper-content pt-3 pb-lg-5 pb-4">
 | |
|               <?php if (!empty($element->immagine_main)) : ?>
 | |
|                 <figure class="primopiano-foto img-fit-cover">
 | |
|                   <?php if (!empty($element->link_pulsante)) : ?>
 | |
|                     <a href="<?= $element->link_pulsante; ?>" title="<?= $element->titolo; ?>">
 | |
|                       <img src="<?= $element->immagine_main; ?>" alt="<?= $element->titolo; ?>" class="img-fluid" />  
 | |
|                     </a>
 | |
|                   <?php else: ?>
 | |
|                     <img src="<?= $element->immagine_main; ?>" alt="<?= $element->titolo; ?>" class="img-fluid" /> 
 | |
|                   <?php endif; ?> 
 | |
|                 </figure>
 | |
| 							<?php endif; ?>
 | |
|               <?php if (!empty($element->link_pulsante)) : ?>
 | |
|                 <a href="<?= $element->link_pulsante; ?>" title="<?= $element->titolo; ?>">
 | |
|                   <p class="h5"><?= $element->titolo; ?></p>
 | |
|                   <p><?= $element->sottotitolo; ?></p>
 | |
|                 </a>
 | |
|               <?php else: ?>
 | |
|                 <p class="h5"><?= $element->titolo; ?></p>
 | |
|                 <p><?= $element->sottotitolo; ?></p>
 | |
|               <?php endif; ?>
 | |
|               <?php if (!empty($element->descrizione)) : ?>
 | |
| 							<?= $element->descrizione; ?>
 | |
|               <?php endif; ?>
 | |
| 						</div> 
 | |
| 					</div>
 | |
| 				<?php endforeach; ?>
 | |
| 			</div>
 | |
| 		</div>	
 | |
|     <?php if (!empty($params['url_bottone'])): ?>
 | |
|       <div class="container">
 | |
|         <div class="row">
 | |
|           <div class="col-12 offset-lg-8 col-lg-4">
 | |
|             <a href="<?= $params['url_bottone'];?>" title="<?= Text::_('VEDITUTTI'); ?>" class="text-uppercase btn-sm btn btn-outline-primary">
 | |
|               <?= Text::_('VEDITUTTI'); ?>
 | |
|               <svg class="icon icon-sm d-inline-block">
 | |
|                 <use xlink:href="<?= $baseImagePath ?>sprites.svg#it-arrow-right"></use>
 | |
|               </svg>
 | |
|             </a>
 | |
|           </div>
 | |
|         </div>
 | |
|       </div>
 | |
| 		<?php endif; ?>
 | |
| 	</div>	
 | |
| </div>
 | |
| <?php endif; ?>
 |