HEX
Server: Apache
System: Linux webm013.cluster123.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: lesanew (165608)
PHP: 8.3.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/lesanew/anestetues2/web/app/cache/acorn/framework/views/3c81b992cafd49659569bae8c3e8874d.php
<?php
  // mode possible : 'featured' (par défaut), 'day', 'all'
  $mode = $mode ?? 'featured';
  $day = $day ?? null;

  $query_args = [
    'post_type' => 'lineup',
    'posts_per_page' => -1,
  ];

  if ($mode === 'featured') {
    $query_args['meta_query'] = [
      [
        'key' => 'mise_en_avant',
        'value' => 1,
        'compare' => '=',
      ],
    ];
  } elseif ($mode === 'day' && ! empty($day)) {
    // ACF checkbox : on cherche les artistes qui ont cette date cochée
    $query_args['meta_query'] = [
      [
        'key' => 'lineup_dates',
        'value' => $day,
        'compare' => 'LIKE',
      ],
    ];
  }

  $artistes = new WP_Query($query_args);

  // Si aucun résultat avec le filtre (mise_en_avant / date),
  // on tombe en repli sur tous les "lineup" pour éviter un bloc vide.
  if (empty($artistes->posts)) {
    $artistes = new WP_Query([
      'post_type' => 'lineup',
      'posts_per_page' => -1,
    ]);
  }

  // Tri manuel :
  // - d'abord les artistes avec un champ "ordre" > 0, par ordre croissant
  // - puis ceux sans ordre (ou ordre = 0), triés par titre.
  $with_order = [];
  $without_order = [];

  foreach ($artistes->posts ?? [] as $p) {
    $raw_ordre = get_field('ordre', $p->ID);

    // Si le champ est vraiment vide (null ou chaîne vide), on le considère
    // comme "sans ordre" et il part dans le groupe de fin.
    if ($raw_ordre === null || $raw_ordre === '') {
      $without_order[] = $p;
      continue;
    }

    // Sinon on caste en entier, 0 est donc un ordre valide (avant 1, 2, 3, ...)
    $ordre = (int) $raw_ordre;
    $with_order[] = ['ordre' => $ordre, 'post' => $p];
  }

  usort($with_order, function ($a, $b) {
    if ($a['ordre'] === $b['ordre']) {
      return strcasecmp($a['post']->post_title, $b['post']->post_title);
    }

    return $a['ordre'] <=> $b['ordre'];
  });

  usort($without_order, function ($a, $b) {
    return strcasecmp($a->post_title, $b->post_title);
  });

  $sorted_posts = array_map(fn ($item) => $item['post'], $with_order);
  $sorted_posts = array_merge($sorted_posts, $without_order);
?>

<?php $__env->startPush('vite-head'); ?>
  <?php echo app('Illuminate\Foundation\Vite')(['resources/css/components/_line-up.scss']); ?>
<?php $__env->stopPush(); ?>

<?php if(! empty($sorted_posts)): ?>
  <div class="line-up__artistes">
    <?php $__currentLoopData = $sorted_posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
      <?php (setup_postdata($post)); ?>
      <?php ($post_id = $post->ID); ?>
      <?php ($nom = get_field('nom', $post_id) ?: get_the_title($post_id)); ?>
      <?php ($photo = get_field('photo', $post_id)); ?>
      <?php ($lineup_dates = get_field('lineup_dates', $post_id)); ?>
      <article class="line-up__artiste">
        <h3 class="text-light"><?php echo e($nom); ?></h3>

        <?php if($mode === 'featured' && ! empty($lineup_dates)): ?>
          <?php ($formatted_dates = implode(', ', array_map(fn ($d) => date('d/m/Y', strtotime($d)), (array) $lineup_dates ?? []))); ?>
          <p class="line-up__artiste-dates text-primary"><?php echo e($formatted_dates); ?></p>
        <?php endif; ?>

        <?php if($photo): ?>
          <img
            class="wave-img"
            src="<?php echo e($photo['url']); ?>"
            alt="<?php echo e($photo['alt'] ?? $nom); ?>"
          />
        <?php endif; ?>
      </article>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
  </div>
<?php else: ?>
  <h2 class="center">découvrez bientot vos artistes !</h2>
<?php endif; ?>
<?php (wp_reset_postdata()); ?>
<?php /**PATH /home/bnowdpik/anes-tetues/web/app/themes/anes-tetues/resources/views/components/lineup-featured.blade.php ENDPATH**/ ?>