linked.html.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php $canUnlink = $this->flow->isClickable($flow->module, 'unlink', $data);?>
  2. <?php foreach($linkedDatas as $linkType => $dataList):?>
  3. <?php
  4. if(in_array($linkType, $config->flow->linkPairs))
  5. {
  6. list($linkedApp, $linkedModule) = $this->flow->extractAppAndModule($linkType);
  7. echo $this->fetch($linkedModule, 'linked', "module=$flow->module&dataID=$data->id&linkType=$currentType", $linkedApp);
  8. continue;
  9. }
  10. $linkedFields = $this->workflowaction->getFields($linkType, 'browse', true, $dataList, $uiID);
  11. $active = $activeTab == $linkType ? 'active' : '';
  12. $batchActions = '';
  13. $canBatchAction = $this->config->flow->showBatchActionsInLinkedPage;
  14. if($canBatchAction)
  15. {
  16. $batchActions = $this->flow->buildBatchActions($linkType);
  17. $canBatchAction = !empty($batchActions);
  18. }
  19. ?>
  20. <div id='<?php echo $linkType;?>' class='tab-pane <?php echo $active;?> without-search'>
  21. <div class='actions'>
  22. <?php if($canLink) echo baseHTML::a('#linkTypeBox', $lang->workflowaction->default->actions['link'], "class='btn btn-primary' data-toggle='modal'");?>
  23. </div>
  24. <?php if($currentMode == 'browse'):?>
  25. <form id='unlink<?php echo $linkType;?>Form' method='post' class='main-table' data-ride='table'>
  26. <table class='table table-form linkedTable'>
  27. <thead>
  28. <?php $index = 1;?>
  29. <?php foreach($linkedFields as $field):?>
  30. <?php if(!$field->show) continue;?>
  31. <?php if(!$canUnlink && $field->field == 'actions') continue;?>
  32. <?php $width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto');?>
  33. <th class="text-<?php echo $field->position;?>" style="width:<?php echo $width;?>">
  34. <?php if($index == 1 && ($canUnlink or $canBatchAction)):?>
  35. <div class='checkbox-primary check-all' title='<?php echo $this->lang->selectAll;?>'>
  36. <label><?php echo $field->name;?></label>
  37. </div>
  38. <?php else:?>
  39. <?php echo $field->name;?>
  40. <?php endif;?>
  41. </th>
  42. <?php $index++;?>
  43. <?php endforeach;?>
  44. </thead>
  45. <tbody>
  46. <?php foreach($dataList as $linkedData):?>
  47. <tr>
  48. <?php $index = 1;?>
  49. <?php foreach($linkedFields as $field):?>
  50. <?php if(!$field->show or $field->field == 'actions') continue;?>
  51. <?php
  52. $output = '';
  53. if(is_array($linkedData->{$field->field}))
  54. {
  55. foreach($linkedData->{$field->field} as $value) $output .= zget($field->options, $value) . ' ';
  56. }
  57. else
  58. {
  59. if($field->field == 'id')
  60. {
  61. if(commonModel::hasPriv($linkType, 'view'))
  62. {
  63. $action = $this->workflowaction->getByModuleAndAction($linkType, 'view');
  64. $attr = $action->open == 'modal' ? "data-toggle='modal'" : '';
  65. $output = baseHTML::a(helper::createLink($linkType, 'view', "dataID={$linkedData->id}"), $linkedData->id, $attr);
  66. }
  67. else
  68. {
  69. $output = $linkedData->id;
  70. }
  71. }
  72. else
  73. {
  74. $output = zget($field->options, $linkedData->{$field->field});
  75. }
  76. }
  77. ?>
  78. <td class="text-<?php echo $field->position;?>" title='<?php echo strip_tags(str_replace("</p>", "\n", str_replace(array("\n", "\r"), "", $output)));?>'>
  79. <?php if($index == 1 && ($canUnlink or $canBatchAction)):?>
  80. <div class='checkbox-primary'><input type='checkbox' name='dataIDList[]' value='<?php echo $linkedData->id;?>' id='dataIDList<?php echo $linkedData->id;?>'>
  81. <label for='dataIDList<?php echo $linkedData->id;?>'>
  82. <?php if($field->field != 'id') echo $output;?>
  83. </label>
  84. </div>
  85. <?php if($field->field == 'id') echo $output;?>
  86. <?php else:?>
  87. <?php echo $output;?>
  88. <?php endif;?>
  89. </td>
  90. <?php $index++;?>
  91. <?php endforeach;?>
  92. <?php if($canUnlink):?>
  93. <td class="nowrap">
  94. <?php $confirm = sprintf($lang->flow->unlinkConfirm, zget($linkPairs, $linkType));?>
  95. <?php echo baseHTML::a($this->createLink($flow->module, 'unlink', "dataID=$data->id&linkType=$linkType&linkedID=$linkedData->id"), $lang->flow->unlink, "class='unlink' data-confirm='$confirm'");?>
  96. </td>
  97. <?php endif;?>
  98. </tr>
  99. <?php endforeach;?>
  100. </tbody>
  101. </table>
  102. <div class='table-footer'>
  103. <?php if($canUnlink or $canBatchAction):?>
  104. <div class='checkbox-primary check-all'><label><?php echo $lang->selectAll?></label></div>
  105. <div class='table-actions btn-toolbar'>
  106. <?php
  107. if($canUnlink)
  108. {
  109. $actionLink = $this->createLink($flow->module, 'unlink', "dataID=$data->id&linkType=$linkType");
  110. echo baseHTML::a('javascript:;', $lang->flow->unlink, "class='btn' onclick=\"setFormAction('$actionLink', '', this)\"");
  111. }
  112. if($canBatchAction) echo $batchActions;
  113. ?>
  114. </div>
  115. <?php endif;?>
  116. <div class='table-statistic'></div>
  117. </div>
  118. </form>
  119. <?php endif;?>
  120. </div>
  121. <?php endforeach;?>