<?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.'" ';
        }
    }

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

    $tresh = 3;
    $num = 0;
    foreach ( $this->list as $e ) :
        if( $num < $tresh ):
            echo $this->partial('index/_partials/publication-short.phtml','events',array('item'=>$e,'params'=>$params,'num'=>$num));
        elseif ( $num == $tresh) :
            echo '<article class="others"><div class="content"><p>'. $this->translate('#autres publications#').':</p><ul>';
            echo $this->partial('index/_partials/publication-line.phtml','events',array('item'=>$e,'params'=>$params,'num'=>$num));
        else:
            echo $this->partial('index/_partials/publication-line.phtml','events',array('item'=>$e,'params'=>$params,'num'=>$num));
        endif;

        $num++;
    endforeach;

    if( $num >= $tresh){
        echo '</ul></div></article>';
    }
    ?>

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