<?php

if ( count( $this->list ) ) :

$params = $this->params;

$mainRoute = $params['scope']=='events'?'events':'news';


    switch($params['scope']){
        case 'event' :
            $title = '#events#';

            $allUrl = $this->url(array(),'events',true);
            $allTxt =  $this->translate('#more events#');
            break;
        case 'publication' :
            $title = '#publications#';

            $allUrl = $this->url(array(),'publications',true);
            $allTxt =  $this->translate('#more publications#');
            break;
        default :
            $title = '#news#';
            $allUrl = $this->url(array(),'news',true);
            $allTxt =  $this->translate('#more news#');
            break;
    }

    $listAttr = '';
    if( $params['isSlider']){
        foreach ($params['data-attributes'] as $key => $value) {
            $listAttr .= $key.'="'.$value.'" ';
        }
    }


?>
<section  id="<?= $params['cssId'] ?>" class="news block<?= !is_null($params['cssClass'])?' '.$params['cssClass']:'' ?>" >
    <header>
        <a href="<?= $allUrl ?>"><h1><?= $this->translate( $params['title'] )    ?></h1></a>
    </header>
    <div class="list <?= $params['isSlider']?' cycle-slideshow':'' ?>" <?= $listAttr ?>>
    <?php
    if ($params['isSlider']) :
        echo '<span class="cycle-pager"></span>';
    endif;

    $num = 0;
    foreach ( $this->list as $e ) :
        echo $this->partial('index/_partials/entry.phtml','events',array('item'=>$e,'params'=>$params,'num'=>$num));
        $num++;
    endforeach;

    /*
        <article class="news agenda_block hasImage">
            <a href="<?= $this->structureUrl('agenda-activites') ?>" class="newscontent" style="background-image: url( /upload/hp_blocks/bg-agenda.jpg )">
                <header>
                    <h2 class="">Agenda des activités</h2>
                </header>
            </a>
        </article>
        */
    ?>
         <article class="news agenda_block hasImage">
            <a href="<?= $this->structureUrl('catalogue-des-aides-techniques') ?>" class="newscontent" style="background-image: url( /upload/hp_blocks/bg-aides-min.jpg )">
                <header>
                    <h2 class="">Catalogue des aides techniques</h2>
                </header>
            </a>
        </article>

    </div>
    <?php if(isset($params['globalFooter']) && $params['globalFooter'] == true): ?>
    <footer>
        <a class="more" href="<?= $allUrl ?>">+ <?= $allTxt ?></a>
    </footer>
    <?php endif; ?>
</section>
 <?php endif; ?>