differentbatch.html.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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>';
  21. $index = 1;
  22. foreach($fields as $field)
  23. {
  24. if(!$field->show) continue;
  25. $value = ($field->defaultValue or $field->defaultValue === 0) ? $field->defaultValue : zget($data, $field->field, '');
  26. if($field->control == 'select')
  27. {
  28. if($row == 1)
  29. {
  30. $field->tmpOptions = $field->options;
  31. unset($field->options['ditto']);
  32. }
  33. if($row > 1)
  34. {
  35. $field->options = $field->tmpOptions;
  36. }
  37. }
  38. echo '<td>';
  39. $element = "dataList[$data->id][$field->field]";
  40. $control = $this->flow->buildControl($field, $value, $element);
  41. $control = str_replace("rows='3'", "rows='1'", $control);
  42. echo $control;
  43. if($index == 1) echo "<div id='error{$data->id}'></div>";
  44. echo '</td>';
  45. $index++;
  46. }
  47. echo '</tr>';
  48. $row++;
  49. }
  50. ?>
  51. </tbody>
  52. </table>
  53. <div class='form-actions text-center'>
  54. <?php echo html::submitButton();?>
  55. <?php echo html::backButton();?>
  56. </div>