nyroFwk  0.2
dataTable.html.php
Go to the documentation of this file.
1 <?php if(!empty($list)):?>
2  <?php echo $hasMultiple ? '<form action="'.$multipleAction.'" method="post">' : null ?>
3  <table class="dataTable <?php echo $tblName ?>List">
4  <thead>
5  <tr>
6  <?php
7  if ($hasMultiple)
8  echo '<td class="checkCell checkHead"><input type="checkbox" name="checkAll" id="checkAll" /></td>';
9  foreach($headers as $h) {
10  if ($h['url']) {
11  if ($h['name'] == $sortBy || $tblName.'.'.$h['name'] == $sortBy) {
12  echo '<th class="'.$h['name'].'Cell '.$h['name'].'Head">
13  <a href="'.$h['url'].'">'.$h['label'].'</a>
14  '.($sortDir == 'asc' ? $sortIndicatorAsc : $sortIndicatorDesc).'
15  </th>';
16  } else
17  echo '<th class="'.$h['name'].'Cell '.$h['name'].'Head"><a href="'.$h['url'].'">'.$h['label'].'</a></th>';
18  } else
19  echo '<th class="'.$h['name'].'Cell '.$h['name'].'Head">'.$h['label'].'</th>';
20  if ($h['type'] == 'image')
21  $imgHelper = factory::getHelper('image', array(
22  'w'=>50,
23  'h'=>50
24  ));
25  }
26  if ($actions)
27  echo '<th class="actionsCell actionsHead">Actions</th>';
28  ?>
29  </tr>
30  </thead>
31  <tbody>
32  <?php
33  $i = 0;
34  foreach($list as $l) {
35  echo '<tr>';
36  if ($hasMultiple)
37  echo '<td class="checkCell"><input type="checkbox" name="'.$multipleIdent.'[]" value="'.$l->get($multipleIdent).'" /></td>';
38  foreach($headers as $h) {
39  $val = $l->get($h['name'], 'flatReal');
40  switch($h['type']) {
41  case 'date':
42  $val = $val ? utils::formatDate($val) : $val;
43  break;
44  case 'datetime':
45  case 'timestamp':
46  $val = $val ? utils::formatDate($val, 'datetime') : $val;
47  break;
48  case 'image':
49  $val = $val ? $imgHelper->view($val) : $val;
50  break;
51  case 'tinyint':
52  $val = ucfirst(tr::__($val ? 'yes' : 'no'));
53  break;
54  case 'enum':
55  $tmp = $l->getTable()->getField($h['name']);
56  $val = isset($tmp['precision'][$val]) ? $tmp['precision'][$val] : $val;
57  break;
58  }
59  echo '<td class="'.$h['name'].'Cell">'.(is_array($val)? implode(', ', $val) : $val).'</td>';
60  }
61  if ($actions) {
62  echo '<td class="actionsCell">';
63  if (array_key_exists($i, $actions))
64  foreach($actions[$i] as $a=>$v) {
65  $img = $actionsImg[$a];
66  echo '<a href="'.$v.'" class="'.$a.'">'.($img? $img : $a).'</a> ';
67  }
68  echo '</td>';
69  }
70  echo '</tr>';
71  $i++;
72  }
73  ?>
74  </tbody>
75  </table>
76  <?php
77  if ($hasMultiple) {
78  echo '<select name="action">
79  <option value="">'.$multipleLabel.'</option>';
80  foreach($multiple as $k=>$m)
81  echo '<option value="'.$k.'">'.$m['label'].'</option>';
82  echo '</select>
83  <input type="submit" value="'.$multipleSubmit.'" />
84  </form>';
85  }
86 
87  if ($nbPage > 1) {
88  /*
89  foreach($pageLinks as $i=>$l) {
90  if ($i == $currentPage)
91  echo '<strong>'.$i.'</strong>';
92  else
93  echo '<a href="'.$l.'">'.$i.'</a>';
94  if ($i < $nbPage)
95  echo ' - ';
96  }
97  // */
98  //*
99  echo 'Pages : <select onchange="javascript:location.href=this.value">';
100  foreach($pageLinks as $i=>$l) {
101  if ($i == $currentPage)
102  echo '<option value="'.$l.'" selected="selected">'.$i.'</option>';
103  else
104  echo '<option value="'.$l.'">'.$i.'</option>';
105  }
106  echo '</select>';
107  // */
108  }
109  ?>
110 <?php else: ?>
111  <?php echo $noData ?>
112 <?php endif; ?>
static __($key, $show=false, $out=true)
Definition: tr.class.php:40
static formatDate($date, $type='date', $len='short2', $htmlOut=true)
static getHelper($className, array $cfg=array())
Definition: tr.class.php:10
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13