<?php if( count($elements)>0 ) : $GLOBALS['nb_accordion'] = isset($GLOBALS['nb_accordion']) ? $GLOBALS['nb_accordion']++ : 1; ?>
<div class="panel-group accordion-group no-dblclick" id="accordion<?php echo $GLOBALS['nb_accordion']; ?>">
<?php foreach ($elements as $tag => $element) : ?>
  <div class="panel panel-default">
    <button class="panel-heading collapsed" data-target="#collapse<?php echo $tag; ?>" data-toggle="collapse" aria-expanded="false">
      <h4 class="panel-title">
        <?php echo $element["title"]; ?>
      </h4>
    </button>
    <div id="collapse<?php echo $tag; ?>" class="panel-collapse collapse">
      <div class="panel-body">
        <?php echo $GLOBALS['wiki']->Format('{{include page="'.$tag.'"}}'); ?>
        <div class="footer-buttons">
          <a href="<?php echo $GLOBALS['wiki']->href('',$tag);?>" class="btn btn-primary"><i class="icon-eye-open icon-white"></i>&nbsp;<?php echo _t('TEMPLATE_VIEW_PAGE');?></a>
          <div class="pull-right">
            <?php if ($GLOBALS['wiki']->HasAccess("write")) : ?>
            <a href="<?php echo $GLOBALS['wiki']->href('edit', $tag); ?>" class="btn btn-default"><i class="icon-pencil"></i></a>
            <?php endif; ?>
            <?php if ($GLOBALS['wiki']->UserIsAdmin() || $GLOBALS['wiki']->UserIsOwner()) : ?>
            <a href="<?php echo $GLOBALS['wiki']->href('deletepage', $tag, 'incomingurl='
                . urlencode(getAbsoluteUrl())); ?>" class="btn btn-danger modalbox"><i class="icon-trash icon-white"></i></a>
            <?php endif; ?>
          </div>
          <div class="clearfix"></div>
        </div> <!-- /.footer-buttons -->
      </div>
    </div>
  </div>
<?php endforeach; ?>
</div>
<?php endif; ?>
