ajaxview.html.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /**
  3. * The ajaxView view file of workflowfield module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license ZPL (http://zpl.pub/page/zplv12.html)
  7. * @author Yidong Wang <yidong@chandao.com>
  8. * @package workflowfield
  9. * @version $Id$
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php
  14. $showFields = array('type', 'default', 'rules');
  15. if(in_array($field->control, $config->workflowfield->optionControls)) $showFields[] = 'datasource';
  16. if($field->type == 'file') $showFields = array();
  17. if($field->type == 'varchar' || $field->type == 'char') $showFields[] = 'length';
  18. if($field->control == 'formula') $showFields[] = 'expression';
  19. if($field->type == 'decimal')
  20. {
  21. $showFields[] = 'integerDigits';
  22. $showFields[] = 'decimalDigits';
  23. list($integerDigits, $decimalDigits) = explode(',', $field->length);
  24. }
  25. ?>
  26. <style>
  27. #fieldDetail {background-color: #F1F1F1; border: 1px solid #ddd; padding-bottom: 10px; margin-bottom: 0;}
  28. #fieldDetail table.table tr > th{font-weight: normal; color: #64758b;}
  29. #fieldDetail table.table tr > th, #fieldDetail table.table tr > td{padding: 2px 5px;}
  30. </style>
  31. <div id='fieldDetail' class='panel'>
  32. <div class='panel-heading'><strong><?php printf($lang->workflowfield->detail, $field->name);?></strong></div>
  33. <table class='table table-form'>
  34. <tr>
  35. <th class='w-80px'><?php echo $lang->workflowfield->name;?></th>
  36. <td><?php echo $field->name?></td>
  37. </tr>
  38. <tr>
  39. <th><?php echo $lang->workflowfield->field;?></th>
  40. <td><?php echo $field->field?></td>
  41. </tr>
  42. <tr>
  43. <th><?php echo $lang->workflowfield->control;?></th>
  44. <td><?php echo zget($lang->workflowfield->controlTypeList, $field->control);?></td>
  45. </tr>
  46. <?php if(in_array('type', $showFields)):?>
  47. <tr>
  48. <th><?php echo $lang->workflowfield->type;?></th>
  49. <td>
  50. <?php
  51. $typeName = $field->type;
  52. foreach($config->workflowfield->typeList as $typeList)
  53. {
  54. foreach($typeList as $key => $value)
  55. {
  56. if($key == $field->type) $typeName = $value;
  57. }
  58. }
  59. echo $typeName;
  60. ?>
  61. </td>
  62. </tr>
  63. <?php endif;?>
  64. <?php if(in_array('length', $showFields)):?>
  65. <tr>
  66. <th><?php echo $lang->workflowfield->length;?></th>
  67. <td><?php echo $field->length;?></td>
  68. </tr>
  69. <?php endif;?>
  70. <?php if(in_array('integerDigits', $showFields)):?>
  71. <tr>
  72. <th><?php echo $lang->workflowfield->integerDigits;?></th>
  73. <td><?php echo $integerDigits;?></td>
  74. </tr>
  75. <?php endif;?>
  76. <?php if(in_array('decimalDigits', $showFields)):?>
  77. <tr>
  78. <th><?php echo $lang->workflowfield->decimalDigits;?></th>
  79. <td><?php echo $decimalDigits;?></td>
  80. </tr>
  81. <?php endif;?>
  82. <?php if(in_array('datasource', $showFields)):?>
  83. <tr>
  84. <th><?php echo $lang->workflowfield->datasource;?></th>
  85. <td><?php echo is_string($field->options) ? zget($datasources, $field->options) : 'custom';?></td>
  86. </tr>
  87. <?php if(is_array($field->options)):?>
  88. <tr>
  89. <th><?php echo $lang->workflowfield->options;?></th>
  90. <td style='word-break: break-all;'><?php echo json_encode($field->options, JSON_UNESCAPED_UNICODE);?></td>
  91. </tr>
  92. <?php endif;?>
  93. <?php if($field->options == 'sql'):?>
  94. <tr>
  95. <th><?php echo $lang->workflowfield->sql;?></th>
  96. <td><?php echo $field->sql;?></td>
  97. </tr>
  98. <?php endif;?>
  99. <?php endif;?>
  100. <?php if(in_array('expression', $showFields)):?>
  101. <tr>
  102. <th><?php echo $lang->workflowfield->expression;?></th>
  103. <td>
  104. <?php
  105. $numberFields = $this->workflowfield->getNumberFields($flow->module);
  106. $formulaLang = $lang->workflowfield->formula;
  107. $modules = array($flow->module => $flow->name);
  108. $moduleFields = array($flow->module => $numberFields);
  109. $expression = json_decode($field->expression, true);
  110. if($expression)
  111. {
  112. $expressionHtml = "<span class='item-name'>{$field->name}</span><span> = </span>";
  113. foreach($expression as $key => $current)
  114. {
  115. $text = $current['text'];
  116. if($current['type'] == 'target')
  117. {
  118. $text = zget($modules, current['module']) . '_' . zget(zget($moduleFields, current['module'], array()), current['field']);
  119. if(!empty($current['function'])) $text = sprintf($formulaLang->functions[$current['function']], zget($modules, $current['module']), zget(zget($moduleFields, current['module'], array()), current['field']));
  120. }
  121. $expressionHtml .= "<span class='item-expression item-{$current['type']}'>{$text}</span>";
  122. }
  123. echo $expressionHtml;
  124. }
  125. ?>
  126. </td>
  127. </tr>
  128. <?php endif;?>
  129. <?php if(in_array('default', $showFields)):?>
  130. <tr>
  131. <th><?php echo $lang->workflowfield->defaultValue;?></th>
  132. <td><?php echo $field->default;?></td>
  133. </tr>
  134. <?php endif;?>
  135. <?php if(in_array('rules', $showFields)):?>
  136. <tr>
  137. <th><?php echo $lang->workflowfield->rules;?></th>
  138. <td><?php foreach(explode(',', $field->rules) as $ruleID) echo zget($rules, $ruleID, '') . ' ';?></td>
  139. </tr>
  140. <?php endif;?>
  141. </table>
  142. </div>