batchcreate.html.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /**
  3. * The batch operate view file of flow module of ZDOO.
  4. *
  5. * @copyright Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license 商业软件,非开源软件
  7. * @author Gang Liu <liugang@cnezsoft.com>
  8. * @package flow
  9. * @version $Id$
  10. * @link http://www.zdoo.com
  11. */
  12. ?>
  13. <?php include 'header.html.php';?>
  14. <?php include '../../common/view/picker.html.php';?>
  15. <?php js::set('moduleName', $flow->module);?>
  16. <?php js::set('action', $action->action);?>
  17. <?php js::set('batchMode', $action->batchMode);?>
  18. <div class='panel'>
  19. <div class='panel-heading'>
  20. <strong><?php echo str_replace('-', '', $title);?></strong>
  21. </div>
  22. <div class='panel-body'>
  23. <form id='ajaxForm' method='post' action='<?php echo $actionURL;?>'>
  24. <div class="table-responsive">
  25. <table class='table table-form table-borderless'>
  26. <thead>
  27. <tr class='text-center'>
  28. <?php
  29. $hasPrevField = false;
  30. foreach($fields as $field)
  31. {
  32. if(!$field->show) continue;
  33. if($field->field == $prevField) $hasPrevField = true;
  34. $width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto');
  35. $required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : '';
  36. echo "<th class='$required' style='width: $width'>$field->name</th>";
  37. }
  38. ?>
  39. <th class='w-100px'><?php echo $lang->actions;?></th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. <?php
  44. $row = 1;
  45. foreach($dataList as $dataID)
  46. {
  47. echo "<tr data-key='$row'>";
  48. $index = 1;
  49. foreach($fields as $field)
  50. {
  51. if(!$field->show) continue;
  52. $value = ($field->field == $prevField ? $dataID : $field->defaultValue);
  53. if($field->control == 'select')
  54. {
  55. if($row == 1)
  56. {
  57. $field->tmpOptions = $field->options;
  58. unset($field->options['ditto']);
  59. }
  60. if($row > 1)
  61. {
  62. $field->options = $field->tmpOptions;
  63. if($prevField && $prevField != $field->field) $value = 'ditto';
  64. }
  65. }
  66. echo '<td>';
  67. $element = "dataList[$row][$field->field]";
  68. $control = $this->flow->buildControl($field, $value, $element);
  69. $control = str_replace("rows='3'", "rows='1'", $control);
  70. echo $control;
  71. if($index == 1)
  72. {
  73. if($prevField && !$hasPrevField) echo html::hidden("dataList[$row][$prevField]", $dataID);
  74. echo "<div id='error{$row}'></div>";
  75. }
  76. echo '</td>';
  77. $index++;
  78. }
  79. echo '<td>';
  80. echo "<a href='javascript:;' class='btn addItem'><i class='icon icon-plus'></i></a>";
  81. echo "<a href='javascript:;' class='btn delItem'><i class='icon icon-close'></i></a>";
  82. echo '</td>';
  83. echo '</tr>';
  84. $row++;
  85. }
  86. ?>
  87. </tbody>
  88. </table>
  89. </div>
  90. <div class='form-actions text-center'>
  91. <?php echo html::submitButton();?>
  92. <?php echo html::backButton();?>
  93. </div>
  94. </form>
  95. </div>
  96. </div>
  97. <?php if($formulaScript) echo $formulaScript;?>
  98. <?php
  99. $index = 1;
  100. $itemRow = "<tr data-key='KEY'>";
  101. foreach($fields as $field)
  102. {
  103. if(!$field->show) continue;
  104. $value = ($field->field == $prevField ? $dataID : $field->defaultValue);
  105. $element = "dataList[KEY][$field->field]";
  106. $control = $this->flow->buildControl($field, $value, $element);
  107. $control = str_replace("rows='3'", "rows='1'", $control);
  108. $itemRow .= '<td>' . $control;
  109. if($index == 1)
  110. {
  111. if(!$hasPrevField) $itemRow .= html::hidden("dataList[KEY][$prevField]", $dataID);
  112. $itemRow .= "<div id='error{$dataID}'></div>";
  113. }
  114. $itemRow .= '</td>';
  115. $index++;
  116. }
  117. $itemRow .= '<td>';
  118. $itemRow .= "<a href='javascript:;' class='btn addItem'><i class='icon icon-plus'></i></a>";
  119. $itemRow .= "<a href='javascript:;' class='btn delItem'><i class='icon icon-close'></i></a>";
  120. $itemRow .= '</td>';
  121. $itemRow .= '</tr>';
  122. js::set('itemRow', $itemRow);
  123. js::set('row', $row);
  124. ?>
  125. <script>
  126. <?php helper::import('../js/search.js');?>
  127. </script>
  128. <?php include 'footer.html.php';?>