<?php

/**
 * @package     Joomla.Site
 * @subpackage  mod_articles
 *
 * @copyright   (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;

if ($params->get('articles_layout') == 1) {
    $gridCols = 'grid-cols-' . $params->get('layout_columns');
}


use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;

$doc = Factory::getDocument();
$doc->addStyleSheet(Uri::base() . 'modules/mod_articles/tmpl/noticias/css/style.css');

?>

<div uk-slider="autoplay: true; autoplay-interval: 4000">

<div class="titulo-con-navegacion uk-padding uk-padding-remove-bottom">
    <h4 style="color: #9f9f9f">Noticias</h4>
    <ul class="uk-slider-nav uk-dotnav"></ul>
</div>

   <div class="uk-position-relative uk-visible-toggle uk-light uk-margin-medium-left uk-margin-medium-right uk-margin-medium-" tabindex="-1">
      <div class="uk-slider-items uk-child-width-1-1@xs uk-child-width-1-1@s uk-child-width-1-4@m uk-child-width-1-4@l uk-text-center"  uk-grid>
         <?php foreach ($items as $i) { ?>
            <?php $img= json_decode($i->images); ?>
            <?php $attributes = ['class' => 'mod-articles-link ' . $i->active, 'itemprop' => 'url']; ?>
            <?php $link = htmlspecialchars($i->link, ENT_COMPAT, 'UTF-8', false); ?>
            <?php $title = htmlspecialchars($i->title, ENT_COMPAT, 'UTF-8', false); ?>
            <div class="uk-position-relative uk-visible-toggle uk-light">
                  <a href="<?php echo $link ?>"
                     class="uk-card uk-card-hover uk-width-1-1@m br-35px uk-display-block uk-text-decoration-none">
                     <div class="uk-card-header">
                        <div class="uk-grid-small uk-flex-middle" uk-grid>
                           <div class="uk-width-auto">
                              <div class="uk-inline">
                                 <img class="br-35px" src="<?php echo $img->image_intro ?>"
                                 alt="<?php echo htmlspecialchars($i->title) ?>" />
                              </div>
                           </div>
                        </div>
                     </div>
                  <div class="uk-card-body uk-padding-remove-bottom uk-padding-remove-top uk-text-justify">
                     <?php $s = substr(strip_tags($i->introtext), 0, 150); ?>
                     <h5 class="uk-card-title uk-margin-remove"><?php echo $i->title ?></h5>
                     <p style="color: #999"><?php echo substr($s, 0, strrpos($s, ' ')) ?></p>
                  </div>
                  <div class="uk-card-footer uk-text-left">
                     <span class="uk-button uk-button-text uk-text-bold" style="color: #999">Saber +</span>
                  </div>
               </a>
            </div>
         <?php }?>
      </div>
   </div>

   <div class="uk-padding-large">
      <div class="uk-flex uk-flex-center">
         <div class="green-button"><a href="noticias" >Todas las <strong>noticias</strong></a></div>
      </div>
   </div>
</div>






