~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

Viewing changes to apps/frontend/templates/_list.php

  • Committer: Fabio Albuquerque
  • Date: 2011-08-08 22:10:34 UTC
  • mfrom: (1.26.1 push-trunk)
  • Revision ID: fabiocbalbuquerque@gmail.com-20110808221034-vfr4ggsbxsdllq82
Merges from CUNY SPS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
$thisUrl = url_for($target_module . '/list');
3
 
$ascArrow = '&#x25B2;';
4
 
$descArrow = '&#x25BC;';
5
 
($status != 'active') ? $statusAppend = '?status=' . $status : $statusAppend = '?status=active';
6
 
($sort != null) ? $sortAppend = '&sort=' . $sort : $sortAppend = '';
7
 
($order != null) ? $orderAppend = '&order=' . $order : $orderAppend = '';
8
 
($limit != null) ? $limitAppend = '&limit=' . $limit : $limitAppend = '';
 
2
  $thisUrl = url_for($targetModule . '/' . $targetAction);
 
3
  if (isset($params))
 
4
  {
 
5
    $thisUrl .= $params;
 
6
  }
 
7
  $ascArrow = '&#x25B2;';
 
8
  $descArrow = '&#x25BC;';
 
9
  ($status != 'active') ? $statusAppend = '?status=' . $status : $statusAppend = '?status=active';
 
10
  ($sort != null) ? $sortAppend = '&sort=' . $sort : $sortAppend = '';
 
11
  ($order != null) ? $orderAppend = '&order=' . $order : $orderAppend = '';
9
12
 
10
 
if (!(isset($caption)))
11
 
  $caption = 'List';
12
 
//the above two lines are in place to supress warnings until sort is corrected
 
13
  if (!(isset($caption)))
 
14
    $caption = 'List';
 
15
  //the above two lines are in place to supress warnings until sort is corrected
13
16
?>
14
17
<table class="staffTable">
15
18
  <caption><?php echo $caption ?>
16
19
 
17
20
    <?php
18
 
    if (count($widgets) > 0) {
19
 
      foreach ($widgets as $widget) {
 
21
      if (count($widgets) > 0) {
 
22
        foreach ($widgets as $widget) {
20
23
    ?>
21
 
        <div class="floatRight" style="font-size: 12px;">
22
 
          <form name="statusForm" action="<?php echo $thisUrl ?>" method="get">
23
 
          <?php echo $widget ?>
24
 
          <?php if(isset($sort)): ?>
25
 
            <input type="hidden" name="sort" value="<?php echo $sort ?>">
26
 
         <?php endif ?>
27
 
          <?php if(isset($order)): ?>
28
 
            <input type="hidden" name="order" value="<?php echo $order ?>">
29
 
         <?php endif ?>
 
24
          <div class="floatRight" style="font-size: 12px;">
 
25
            <form name="statusForm" action="<?php echo $thisUrl ?>" method="get">
 
26
            <?php echo $widget ?>
 
27
            <?php if(isset($sort)): ?>
 
28
              <input type="hidden" name="sort" value="<?php echo $sort ?>">
 
29
           <?php endif ?>
 
30
            <?php if(isset($order)): ?>
 
31
              <input type="hidden" name="order" value="<?php echo $order ?>">
 
32
           <?php endif ?>
30
33
 
31
 
          </form></div>
 
34
            </form></div>
32
35
    <?php
 
36
        }
33
37
      }
34
 
    }
35
38
    ?>
36
39
  </caption>
37
40
  <thead>
38
41
    <tr class="head">
39
42
      <?php
40
 
      $listhead = "";
41
 
      foreach ($displayColumns as $column => $columnCaption) {
42
 
 
43
 
        $listhead .= '  <th>' . $columnCaption['title'];
44
 
        if ($columnCaption['sortable']) {
45
 
          $listhead .= $sort == $column && $order == 'ASC' ? '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=ASC" class="buttonSortSelected" title="ascending">' . $ascArrow . '</a>' : '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=ASC" class="buttonSort" title="ascending">' . $ascArrow . '</a>';
46
 
          $listhead .= $sort == $column && $order == 'DESC' ? '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=DESC" class="buttonSortSelected" title="descending">' . $descArrow . '</a>' : '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=DESC" class="buttonSort" title="descending">' . $descArrow . '</a>';
47
 
        }
48
 
        if ($columnCaption->offsetExists('tooltip')) {
49
 
          $listhead .= '<a href="' . $columnCaption['tooltip'] . '" class="tooltipTrigger">?</a>';
50
 
        }
51
 
        $listhead .= '</th>';
52
 
      }
53
 
      echo $listhead;
 
43
        $listhead = "";
 
44
        foreach ($displayColumns as $column => $columnCaption)
 
45
        {
 
46
          $listhead .= '  <th>' . $columnCaption['title'];
 
47
          if ($columnCaption['sortable'])
 
48
          {
 
49
            $listhead .= $sort == $column && $order == 'ASC' ? '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=ASC" class="buttonSortSelected" title="ascending">' . $ascArrow . '</a>' : '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=ASC" class="buttonSort" title="ascending">' . $ascArrow . '</a>';
 
50
            $listhead .= $sort == $column && $order == 'DESC' ? '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=DESC" class="buttonSortSelected" title="descending">' . $descArrow . '</a>' : '<a href="' . $thisUrl . '?status=' . $status . '&sort=' . $column . '&order=DESC" class="buttonSort" title="descending">' . $descArrow . '</a>';
 
51
          }
 
52
          if ($columnCaption->offsetExists('tooltip'))
 
53
          {
 
54
            $listhead .= '<a href="' . $columnCaption['tooltip'] . '" class="tooltipTrigger">?</a>';
 
55
          }
 
56
          $listhead .= '</th>';
 
57
        }
 
58
        echo $listhead;
54
59
      ?>
55
60
    </tr>
56
61
  </thead>
57
62
  <tbody>
58
63
    <?php
59
 
      foreach ($pager->getResults() as $result) {
60
64
        echo get_partial('global/row', array(
61
 
          'obj' => $result,
 
65
          'data' => $data,
62
66
          //'widget' => $widget,
63
67
          'displayColumns' => $displayColumns,
64
 
          'target_module' => $target_module
 
68
          'targetModule' => $targetModule
65
69
        ));
66
 
      }
67
70
    ?>
68
71
 
69
72
    </tbody>
71
74
      <tr>
72
75
        <td colspan=<?php echo count($displayColumns) + 1 ?>>
73
76
        <?php
74
 
        // Output the current staff members being shown, as well total number in the list.
75
 
        // The if prevents getting a 1-0 display indicator if there is an empty list.
76
 
        if($pager->count() == 0) {
77
 
          $firstIndice = 0;
78
 
        } else {
79
 
          $firstIndice = $pager->getFirstIndice();
80
 
        }
81
 
        echo $firstIndice . "-" . $pager->getLastIndice() . " of " . $pager->count();
 
77
          // Output the current staff members being shown, as well total number in the list.
 
78
          // The if prevents getting a 1-0 display indicator if there is an empty list.
 
79
          $totalRecords = $pager->getNumResults();
 
80
          $firstIndice = ($totalRecords === 0) ? 0 : $pager->getFirstIndice();
 
81
          $lastIndice = $pager->getLastIndice();
 
82
          echo $firstIndice . " - " . $lastIndice . " of " . $totalRecords;
82
83
        ?>
83
84
      </td>
84
85
    </tr>
85
86
    <tr>
86
87
      <td colspan=<?php echo count($displayColumns) + 1 ?>>
87
88
        <?php
88
 
        $listfoot = '<div class="floatRight">';
89
 
//
90
 
//First Page link (or inactive if we're at the first page).
91
 
        $listfoot .= ( !$pager->isFirstPage() ? '<a href="' . $thisUrl . '?page=' . $pager->getFirstPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="First Page">&lt;&lt;</a>' : '<a class="buttonTextOff">&lt;&lt;</a>');
92
 
//Previous Page link (or inactive if we're at the first page).
93
 
        $listfoot .= ( !$pager->isFirstPage() ? '<a href="' . $thisUrl . '?page=' . $pager->getPreviousPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="Previous Page">&lt;</a>' : '<a class="buttonTextOff">&lt;</a>');
94
 
//Next Page link (or inactive if we're at the last page).
95
 
        $listfoot .= ( !$pager->isLastPage() ? '<a href="' . $thisUrl . '?page=' . $pager->getNextPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="Next Page">&gt;</a>' : '<a class="buttonTextOff">&gt;</a>');
96
 
//Last Page link (or inactive if we're at the last page).
97
 
        $listfoot .= ( !$pager->isLastPage() ? '<a href="' . $thisUrl . '?page=' . $pager->getLastPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="Last Page">&gt;&gt;</a>' : '<a class="buttonTextOff">&gt;&gt;</a>');
98
 
        $listfoot .= '</div>';
99
 
 
100
 
        // Commented out $listheader here. It's declaration is commented above. Ask Charles.
101
 
 
102
 
        echo $listfoot;
 
89
          $listfoot = '<div class="floatRight">';
 
90
          $currentPage = $pager->getPage();
 
91
          $firstPage = $pager->getFirstPage();
 
92
          $lastPage = $pager->getLastPage();
 
93
          $seperator = ($targetAction == 'list') ? '?' : '&';
 
94
 
 
95
          //First Page link (or inactive if we're at the first page).
 
96
          $listfoot .= ( ($currentPage == $firstPage) ? '<a class="buttonTextOff">&lt;&lt;</a>' : '<a href="' . $thisUrl . $seperator . 'page=' . $firstPage . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="First Page">&lt;&lt;</a>');
 
97
          //Previous Page link (or inactive if we're at the first page).
 
98
          $listfoot .= ( ($currentPage == $firstPage) ? '<a class="buttonTextOff">&lt;</a>' : '<a href="' . $thisUrl . $seperator . 'page=' . $pager->getPreviousPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="Previous Page">&lt;</a>');
 
99
          //Next Page link (or inactive if we're at the last page).
 
100
          $listfoot .= ( ($currentPage == $lastPage) ? '<a class="buttonTextOff">&gt;</a>' : '<a href="' . $thisUrl . $seperator . 'page=' . $pager->getNextPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="Next Page">&gt;</a>');
 
101
          //Last Page link (or inactive if we're at the last page).
 
102
          $listfoot .= ( ($currentPage == $lastPage) ? '<a class="buttonTextOff">&gt;&gt;</a>' : '<a href="' . $thisUrl . $seperator . 'page=' . $pager->getLastPage() . '&status=' . $status . $sortAppend . $orderAppend . '" class="buttonText" title="Last Page">&gt;&gt;</a>');
 
103
          $listfoot .= '</div>';
 
104
 
 
105
          echo $listfoot;
103
106
        ?>
104
107
      </td>
 
108
    </tr>
105
109
  </tfoot>
106
110
</table>