header.html.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. /**
  3. * The common header view file of workfloweditor module of ZDOO.
  4. *
  5. * @copyright Copyright 2009-2020 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license 商业软件,非开源软件
  7. * @author Hao Sun <sunhao@cnezsoft.com>
  8. * @package workfloweditor
  9. * @version $Id$
  10. * @link http://www.zdoo.com
  11. */
  12. ?>
  13. <?php if($editorMode == 'quick' && $flow->buildin) die(js::error($this->lang->workflow->tips->buildinFlow) . js::locate('back'));?>
  14. <?php include $app->getModuleRoot() . 'common/view/header.lite.html.php';?>
  15. <style><?php helper::import($this->app->getExtensionRoot() . 'biz/workflow/css/header.css');?></style>
  16. <?php js::set('moduleName', $flow->module);?>
  17. <?php js::set('editorMode', $editorMode); ?>
  18. <?php js::set('unknownError', $lang->workfloweditor->error->unknown); ?>
  19. <?php $currentModule = $this->app->getModuleName(); ?>
  20. <?php $currentMethod = $this->app->getMethodName(); ?>
  21. <div id='editorNav'>
  22. <div id='editorNavLeft'>
  23. <?php $backLink = $this->session->workflowList ? $this->session->workflowList : $this->createLink('workflow', 'browseFlow');?>
  24. <?php echo baseHTML::a($backLink, "<i class='icon-angle-left'></i>" , 'class="btn btn-link"');?>
  25. <?php
  26. $workflowGroupID = (int)$this->session->workflowGroupID;
  27. $workflowGroup = $this->loadModel('workflowgroup')->getById($workflowGroupID);
  28. ?>
  29. <strong><?php echo $flow->name . ($workflowGroup ? " ({$lang->workflowgroup->template} : {$workflowGroup->name}) " : '');?></strong>
  30. </div>
  31. <div id='editorNavCenter'>
  32. <strong class='title'><?php echo $editorMode == 'quick' ? $lang->workfloweditor->quickEditor : $lang->workfloweditor->advanceEditor; ?></strong>
  33. </div>
  34. <div id='editorNavRight'>
  35. <?php
  36. if($editorMode == 'quick')
  37. {
  38. echo baseHTML::a('#switchConfirmModal', sprintf($lang->workfloweditor->switchTo, $lang->workfloweditor->advanceEditor), "class='btn btn-primary' data-toggle='modal'");
  39. }
  40. elseif(!$flow->buildin)
  41. {
  42. extCommonModel::printLink('workflow', 'ui', "module={$flow->module}&action=create&groupID={$workflowGroupID}", sprintf($lang->workfloweditor->switchTo, $lang->workfloweditor->quickEditor), "class='btn btn-primary'");
  43. }
  44. ?>
  45. </div>
  46. </div>
  47. <?php if($editorMode == 'quick'): ?>
  48. <div class='modal fade' id='switchConfirmModal'>
  49. <div class='modal-dialog'>
  50. <div class='modal-content'>
  51. <div class='modal-header'>
  52. <button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>×</span></button>
  53. </div>
  54. <div class='modal-body text-center'>
  55. <p><?php echo $lang->workfloweditor->switchConfirmMessage; ?></p>
  56. <div>
  57. <?php extCommonModel::printLink('workflowfield', 'browse', "module={$flow->module}&orderBy=order&groupID={$workflowGroupID}", $lang->workfloweditor->confirmSwitch, "class='btn btn-primary not-in-app'");?>
  58. <button type='button' class='btn' data-dismiss='modal'><?php echo $lang->workfloweditor->cancelSwitch; ?></button>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <?php endif; ?>
  65. <div id='editorMenu'>
  66. <nav id='editorSteps' class='editor-steps-<?php echo $editorMode; ?>'>
  67. <ul class='nav nav-primary'>
  68. <?php
  69. $stepList = $editorMode == 'quick' ? $lang->workfloweditor->quickSteps : $lang->workfloweditor->advanceSteps;
  70. if($flow->buildin)
  71. {
  72. unset($stepList['subTable']);
  73. unset($stepList['label']);
  74. unset($lang->workfloweditor->moreSettings['setReport']);
  75. unset($lang->workfloweditor->moreSettings['fulltext']);
  76. if(in_array($flow->module, $this->config->workflow->buildin->noApproval)) unset($lang->workfloweditor->moreSettings['approval']);
  77. }
  78. if($workflowGroupID > 0)
  79. {
  80. unset($lang->workfloweditor->moreSettings['relation']);
  81. unset($lang->workfloweditor->moreSettings['setValue']);
  82. unset($lang->workfloweditor->moreSettings['setExport']);
  83. unset($lang->workfloweditor->moreSettings['setSearch']);
  84. }
  85. if($flow->module == 'cm' || $flow->module == 'projectchange')
  86. {
  87. unset($lang->workfloweditor->moreSettings['setExport']);
  88. unset($lang->workfloweditor->moreSettings['setSearch']);
  89. }
  90. $stepUrls = array();
  91. $currentStep = -1;
  92. $index = 0;
  93. foreach($stepList as $stepItem)
  94. {
  95. $subMenu = array();
  96. if(isset($stepItem['subMenu'])) $subMenu = $stepItem['subMenu'];
  97. if(isset($stepItem['link'])) $stepItem = $stepItem['link'];
  98. list($label, $moduleName, $methodName) = explode('|', $stepItem);
  99. if($methodName == 'more')
  100. {
  101. foreach($lang->workfloweditor->moreSettings as $moreSetting)
  102. {
  103. $moreSetting = explode('|', $moreSetting);
  104. if($flow->module != 'charter' && $moreSetting[1] == 'workflow' && $moreSetting[2] == 'setapproval' && $config->edition == 'biz') continue;
  105. if(commonModel::hasPriv($moreSetting[1], $moreSetting[2]))
  106. {
  107. $moduleName = $moreSetting[1];
  108. $methodName = $moreSetting[2];
  109. $stepParams = $moduleName == 'workflow' && $methodName != 'setapproval' ? sprintf($moreSetting[3], $flow->id) : sprintf($moreSetting[3], $flow->module);
  110. break;
  111. }
  112. }
  113. /* Hide more Settings buttons if none have permissions. */
  114. if($methodName == 'more') continue;
  115. }
  116. else
  117. {
  118. $stepParams = $flow->type == 'table' ? "module={$flow->parent}" : "module={$flow->module}";
  119. if(isset($currentAction)) $stepParams .= "&action={$currentAction->action}";
  120. }
  121. if($moduleName == 'workflowfield' && $methodName == 'browse') $stepParams .= "&orderBy=order&groupID={$workflowGroupID}";
  122. $stepUrl = $this->createLink($moduleName, $methodName, $stepParams);
  123. $stepUrlHtml = baseHTML::a($stepUrl, $label);
  124. if($currentModule == 'workflowfield' && $currentMethod == 'browse' && $flow->type == 'table')
  125. {
  126. $isCurrentStep = $moduleName == 'workflow' && $methodName == 'browsedb';
  127. }
  128. else
  129. {
  130. $isCurrentStep = (($currentModule == $moduleName && $currentMethod == $methodName) or (isset($subMenu[$currentModule]) && stripos(",{$subMenu[$currentModule]},", ",{$currentMethod},") !== false));
  131. }
  132. echo $isCurrentStep ? "<li class='active'>$stepUrlHtml</li>" : "<li>$stepUrlHtml</li>";
  133. if($isCurrentStep) $currentStep = $index;
  134. $stepUrls[] = $stepUrl;
  135. $index++;
  136. }
  137. ?>
  138. </ul>
  139. </nav>
  140. <div id='editorMenuLeft'>
  141. <?php if($currentStep > 0 && isset($stepUrls[$currentStep - 1])) echo baseHTML::a($stepUrls[$currentStep - 1], $lang->workfloweditor->prevStep, "class='btn btn-primary prevStep'"); ?>
  142. </div>
  143. <div id='editorMenuRight'>
  144. <?php
  145. if($editorMode == 'quick') echo "<button type='button' class='btn btn-default' id='saveBtn'>{$lang->save}</button>";
  146. if($currentStep == count($stepList) - 1 and !$flow->buildin and $workflowGroupID == 0)
  147. {
  148. echo html::a($this->createLink('workflow', 'release', "id={$flow->id}"), $lang->workflow->release, '', "class='btn btn-primary iframe' data-toggle='modal' data-size='sm'");
  149. }
  150. ?>
  151. <?php if(isset($stepUrls[$currentStep + 1])) echo baseHTML::a($stepUrls[$currentStep + 1], $lang->workfloweditor->nextStep, "class='btn btn-primary nextStep'"); ?>
  152. </div>
  153. </div>
  154. <?php if($editorMode == 'quick'): ?>
  155. <div class='modal fade' id='confirmReleaseModal'>
  156. <div class='modal-dialog'>
  157. <div class='modal-content'>
  158. <div class='modal-header'>
  159. <button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>×</span></button>
  160. </div>
  161. <div class='modal-body text-center'>
  162. <p><?php echo $lang->workfloweditor->confirmReleaseMessage; ?></p>
  163. <div>
  164. <?php extCommonModel::printLink('workflowfield', 'browse', "module={$flow->module}", $lang->workfloweditor->enterToAdvance, "class='btn btn-primary'");?>
  165. <?php extCommonModel::printLink('workflow', 'release', "id={$flow->id}", $lang->workfloweditor->continueRelease, "class='btn btn-secondary release' data-toggle='modal'");?>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <?php endif; ?>