Projet

Général

Profil

Paste
Télécharger (2,4 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / webform / templates / webform-progressbar.tpl.php @ 389fb945

1
<?php
2

    
3
/**
4
 * @file
5
 * Display the progress bar for multipage forms.
6
 *
7
 * Available variables:
8
 * - $node: The webform node.
9
 * - $progressbar_page_number: TRUE if the actual page number should be
10
 *   displayed.
11
 * - $progressbar_percent: TRUE if the percentage complete should be displayed.
12
 * - $progressbar_bar: TRUE if the bar should be displayed.
13
 * - $progressbar_pagebreak_labels: TRUE if the page break labels should be
14
 *   displayed.
15
 *
16
 * - $page_num: The current page number.
17
 * - $page_count: The total number of pages in this form.
18
 * - $page_labels: The labels for the pages. This typically includes a label for
19
 *   the starting page (index 0), each page in the form based on page break
20
 *   labels, and then the confirmation page (index number of pages + 1).
21
 * - $percent: The percentage complete.
22
 */
23
?>
24
<div class="webform-progressbar">
25
  <?php if ($progressbar_bar): ?>
26
    <div class="webform-progressbar-outer">
27
      <div class="webform-progressbar-inner" style="width: <?php print number_format($percent, 0); ?>%">&nbsp;</div>
28
      <?php for ($n = 1; $n <= $page_count; $n++): ?>
29
        <span class="webform-progressbar-page<?php
30
          if ($n < $page_num):
31
            print ' completed';
32
          endif;
33
          if ($n == $page_num):
34
            print ' current';
35
          endif;
36
        ?>" style="<?php print ($GLOBALS['language']->direction == 0) ? 'left' : 'right'; ?>: <?php print number_format(($n - 1) / ($page_count - 1), 4) * 100; ?>%">
37
          <span class="webform-progressbar-page-number"><?php print $n; ?></span>
38
          <?php if ($progressbar_pagebreak_labels): ?>
39
          <span class="webform-progressbar-page-label">
40
            <?php print check_plain($page_labels[$n - 1]); ?>
41
          </span>
42
          <?php endif; ?>
43
        </span>
44
      <?php endfor; ?>
45
    </div>
46
  <?php endif; ?>
47

    
48

    
49
  <?php if ($progressbar_page_number): ?>
50
    <div class="webform-progressbar-number">
51
      <?php print t('Page @start of @end', array('@start' => $page_num, '@end' => $page_count)); ?>
52
      <?php if ($progressbar_percent): ?>
53
        <span class="webform-progressbar-number">
54
          (<?php print number_format($percent, 0); ?>%)
55
        </span>
56
      <?php endif; ?>
57
    </div>
58
  <?php endif; ?>
59

    
60
  <?php if (!$progressbar_page_number && $progressbar_percent): ?>
61
    <div class="webform-progressbar-number">
62
      <?php print number_format($percent, 0); ?>%
63
    </div>
64
  <?php endif; ?>
65
</div>