You are here

agenda-block.tpl.php in Agenda 7.2

Same filename and directory in other branches
  1. 6.2 agenda-block.tpl.php
  2. 6 agenda-block.tpl.php
  3. 7 agenda-block.tpl.php

Template for displaying the agenda in a block

File

agenda-block.tpl.php
View source
<?php

/**
 * @file
 * Template for displaying the agenda in a block
 */

// Build some neat dates.
$dates[date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - 1))] = t('Yesterday');
$dates[date('Y-m-d', mktime(0, 0, 0))] = t('Today');
$dates[date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") + 1))] = t('Tomorrow');

// List of keys to display.
$keys = array_map('trim', explode(',', $block->display_keys));
$nolabel = array_map('trim', explode(',', $block->hide_labels));
?>
<div class="agenda-block">
  <?php

foreach ($events as $day) {
  ?>
  <?php

  $date = $day[0]['start date'];

  // Substitute today/yesterday/tomorrow.
  if (isset($dates[$day[0]['when']])) {
    $date = $dates[$day[0]['when']];
  }
  ?>
  <p><?php

  echo $date;
  ?></p>
  <ol>
  <?php

  foreach ($day as $event) {
    ?>
    <li class="cal_<?php

    echo $event['index'];
    ?>">
      <span class="calendar_title"><?php

    echo $event['title'];
    ?></span>
      <ul class="moreinfo">

        <?php

    foreach ($keys as $key) {
      ?>
          <?php

      if (!empty($event[$key])) {
        ?>
            <li>
            <?php

        if (!in_array($key, $nolabel)) {
          ?>
              <em><?php

          echo _agenda_translate($key);
          ?></em>:
            <?php

        }
        ?>
            <?php

        echo $event[$key];
        ?>
            </li>
          <?php

      }
      ?>
        <?php

    }
    ?>

      </ul>
    </li>
  <?php

  }
  ?>
  </ol>
<?php

}
?>
</div>