SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/components/calendar.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\Needs;
  4.  
  5.  
  6. Needs::fileGroup('sprout/calendar');
  7. ?>
  8.  
  9. <div class="calendar-container -clearfix">
  10.  
  11. <?php if (!empty($options['show_month'])): ?>
  12. <h4 class="calendar-heading"><?php echo Enc::html(date($options['month_format'], strtotime('01-' . $month . '-' . $year))); ?></h4>
  13. <?php endif; ?>
  14.  
  15. <ul class="calendar-weekdays-list">
  16. <?php foreach ($day_names as $idx => $day): ?>
  17. <li class="calendar-weekdays-list__item" data-day="<?php echo Enc::html($idx); ?>"><?php echo Enc::html($day); ?></li>
  18. <?php endforeach; ?>
  19. </ul>
  20.  
  21. <?php while ($options['date_start'] <= $options['date_end']): ?>
  22.  
  23. <?php if ($options['date_start']->format('N') == $options['week_begins']): ?>
  24. <ul class="calendar-days-list">
  25. <?php endif; ?>
  26.  
  27. <?php if ($options['date_start']->format('Y-m') == date('Y-m', strtotime($year . '-' . $month))): ?>
  28. <li class="calendar-days-list__item" data-date="<?php echo Enc::html($options['date_start']->format('Y-m-d')); ?>">
  29. <?php else: ?>
  30. <li class="calendar-days-list__item calendar-days-list__item__other-month" data-date="<?php echo Enc::html($options['date_start']->format('Y-m-d')); ?>">
  31. <?php endif; ?>
  32.  
  33. <time class="calendar-days-list__item__date" datetime="<?php echo Enc::html($options['date_start']->format('Y-m-d')); ?>">
  34. <span class="calendar-days-list__item__date__extra"><?php echo Enc::html($options['date_start']->format('D')); ?></span>
  35. <?php echo Enc::html($options['date_start']->format('d')); ?><span class="calendar-days-list__item__date__extra"><?php echo Enc::html($options['date_start']->format('/m/Y')); ?></span>
  36. </time>
  37.  
  38. <?php echo $callback($options['date_start']); ?>
  39.  
  40. </li>
  41.  
  42. <?php if ($options['date_start']->format('N') == $options['week_ends']): ?>
  43. </ul>
  44. <?php endif; ?>
  45.  
  46. <?php $options['date_start']->modify('+1 day'); ?>
  47. <?php endwhile; ?>
  48.  
  49. </div>
  50.