templateimport.html.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <table class='table table-form'>
  2. <thead>
  3. <tr class='text-center'>
  4. <?php
  5. foreach($fields as $field)
  6. {
  7. if(!$field->show) continue;
  8. $width = ($field->width && $field->width != 'auto') ? $field->width . 'px' : 'auto';
  9. $required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : '';
  10. echo "<th class='$required' style='width: $width'>$field->name</th>";
  11. }
  12. ?>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <?php
  17. $row = 1;
  18. foreach($dataList as $data)
  19. {
  20. echo "<tr data-key='$row'>";
  21. $index = 1;
  22. foreach($fields as $field)
  23. {
  24. if(!$field->show) continue;
  25. echo '<td>';
  26. $value = $field->defaultValue ? $field->defaultValue : zget($data, $field->field, '');
  27. echo $this->flow->buildControl($field, $value, "dataList[$row][$field->field]");
  28. if($index == 1) echo "<div id='error{$row}'></div>";
  29. echo '</td>';
  30. $index++;
  31. }
  32. echo '</tr>';
  33. $row++;
  34. }
  35. ?>
  36. </tbody>
  37. </table>