browse.html.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?php
  2. /**
  3. * The browse view file of leave module of Ranzhi.
  4. *
  5. * @copyright Copyright 2009-2018 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author chujilu <chujilu@cnezsoft.com>
  8. * @package leave
  9. * @version $Id$
  10. * @link http://www.ranzhi.org
  11. */
  12. ?>
  13. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  14. <style>
  15. #menuActions{float:right !important; margin-top: -60px !important;}
  16. .input-group-required > .required::after, .required-wrapper.required::after {top:12px !important;}
  17. .modal-body .table {margin-bottom:0px !important;}
  18. </style>
  19. <div id='featurebar'>
  20. <ul class='nav'>
  21. <?php
  22. $methodName = strtolower($this->app->rawMethod);
  23. foreach($lang->leave->featureBar['personal'] as $method => $name)
  24. {
  25. $class = strtolower($method) == $methodName ? "class='active'" : '';
  26. if(common::hasPriv('leave', $method)) echo "<li id='$method' $class>" . html::a($this->createLink('leave', $method), $name) . '</li>';
  27. }
  28. ?>
  29. </ul>
  30. </div>
  31. <?php js::set('confirmReview', $lang->leave->confirmReview)?>
  32. <div id='menuActions'>
  33. <?php extCommonModel::printLink('oa.leave', 'export', "mode=all&orderBy={$orderBy}", $lang->exportIcon . $lang->export, "class='btn btn-primary iframe' data-width='700'");?>
  34. <?php extCommonModel::printLink('oa.leave', 'create', '', "<i class='icon icon-plus'></i> {$lang->leave->create}", "data-toggle='modal' class='btn btn-primary'")?>
  35. </div>
  36. <?php if($type != 'browseReview'):?>
  37. <div class='with-side'>
  38. <div class='side'>
  39. <div class='panel panel-sm'>
  40. <div class='panel-body'>
  41. <ul class='tree' data-ride='tree' data-collapsed='true'>
  42. <?php foreach($yearList as $year):?>
  43. <li class='<?php echo $year == $currentYear ? 'active' : ''?>'>
  44. <?php extCommonModel::printLink('oa.leave', $type, "date=$year", $year);?>
  45. <ul>
  46. <?php foreach($monthList[$year] as $month):?>
  47. <li class='<?php echo ($year == $currentYear and $month == $currentMonth) ? 'active' : ''?>'>
  48. <?php extCommonModel::printLink('oa.leave', $type, "date=$year$month", $year . $month);?>
  49. </li>
  50. <?php endforeach;?>
  51. </ul>
  52. </li>
  53. <?php endforeach;?>
  54. </ul>
  55. </div>
  56. </div>
  57. </div>
  58. <div class='main'>
  59. <?php endif;?>
  60. <?php $batchReview = $type == 'browseReview' && commonModel::hasPriv('leave', 'batchReview');?>
  61. <div class='panel'>
  62. <?php if(empty($leaveList)):?>
  63. <div class="table-empty-tip">
  64. <p>
  65. <span class="text-muted"><?php echo $lang->noData;?></span>
  66. <?php if(common::hasPriv('leave', 'create')):?>
  67. <?php echo html::a($this->createLink('leave', 'create'), "<i class='icon icon-plus'></i> " . $lang->leave->create, '', "class='btn btn-info' data-toggle='modal'");?>
  68. <?php endif;?>
  69. </p>
  70. </div>
  71. <?php else:?>
  72. <?php if($batchReview):?>
  73. <form id='batchReviewForm' method='post' action='<?php echo inlink('batchReview', 'status=pass');?>'>
  74. <?php endif;?>
  75. <table class='table table-hover text-center table-fixed tablesorter' id='leaveTable'>
  76. <thead>
  77. <tr class='text-center'>
  78. <?php $vars = "&date={$date}&orderBy=%s";?>
  79. <th class='w-50px'><?php commonModel::printOrderLink('id', $orderBy, $vars, $lang->leave->id, 'leave', $type);?></th>
  80. <th class='w-100px'><?php commonModel::printOrderLink('createdBy', $orderBy, $vars, $lang->leave->createdBy, 'leave', $type);?></th>
  81. <th class='w-100px visible-lg'><?php echo $lang->user->dept;?></th>
  82. <th class='w-60px'><?php commonModel::printOrderLink('type', $orderBy, $vars, $lang->leave->type, 'leave', $type);?></th>
  83. <th class='w-140px'><?php commonModel::printOrderLink('begin', $orderBy, $vars, $lang->leave->start, 'leave', $type);?></th>
  84. <th class='w-140px'><?php commonModel::printOrderLink('end', $orderBy, $vars, $lang->leave->finish, 'leave', $type);?></th>
  85. <th class='w-140px'><?php commonModel::printOrderLink('backDate', $orderBy, $vars, $lang->leave->backDate, 'leave', $type);?></th>
  86. <th class='w-70px visible-lg'><?php commonModel::printOrderLink('hours', $orderBy, $vars, $lang->leave->hours, 'leave', $type);?></th>
  87. <th class='text-left'><?php echo $lang->leave->desc;?></th>
  88. <th class='w-100px'><?php commonModel::printOrderLink('status', $orderBy, $vars, $lang->leave->status, 'leave', $type);?></th>
  89. <?php if($type == 'personal'):?>
  90. <?php $class = $this->app->clientLang == 'en' ? 'w-200px' : 'w-180px';?>
  91. <th class='<?php echo $class;?>'><?php echo $lang->actions;?></th>
  92. <?php else:?>
  93. <?php $class = $this->app->clientLang == 'en' ? 'w-160px' : 'w-130px';?>
  94. <th class='<?php echo $class;?>'><?php echo $lang->actions;?></th>
  95. <?php endif;?>
  96. </tr>
  97. </thead>
  98. <?php foreach($leaveList as $leave):?>
  99. <?php $viewUrl = commonModel::hasPriv('leave', 'view') ? $this->createLink('leave', 'view', "id={$leave->id}&type=$type", '', true) : '';?>
  100. <?php if($type == 'browseReview' && $leave->type == 'annual' && isset($leftAnnualDays[$leave->createdBy])):?>
  101. <tr id='leave<?php echo $leave->id;?>' >
  102. <?php else:?>
  103. <tr id='leave<?php echo $leave->id;?>' >
  104. <?php endif?>
  105. <td class='idTD'>
  106. <?php if($batchReview):?>
  107. <label class='checkbox-inline'><input type='checkbox' name='leaveIDList[]' value='<?php echo $leave->id;?>'/> <?php echo $leave->id;?></label>
  108. <?php else:?>
  109. <?php echo $leave->id;?>
  110. <?php endif;?>
  111. </td>
  112. <td><?php echo zget($users, $leave->createdBy);?></td>
  113. <td class='visible-lg'><?php echo zget($deptList, $leave->dept);?></td>
  114. <td><?php echo zget($lang->leave->typeList, $leave->type);?></td>
  115. <td><?php echo formatTime($leave->begin . ' ' . $leave->start, DT_DATETIME2);?></td>
  116. <td><?php echo formatTime($leave->end . ' ' . $leave->finish, DT_DATETIME2);?></td>
  117. <td><?php echo formatTime($leave->backDate, DT_DATETIME2);?></td>
  118. <td class='visible-lg'><?php echo $leave->hours == 0 ? '' : $leave->hours;?></td>
  119. <td class='text-left' title='<?php echo $leave->desc;?>'><?php echo $leave->desc;?></td>
  120. <td class='leave-<?php echo $leave->status?>' title='<?php echo $leave->statusLabel;?>'><?php echo $leave->statusLabel;?></td>
  121. <td class='actionTD text-left'>
  122. <?php
  123. if($viewUrl) echo baseHTML::a($viewUrl, $lang->detail, "data-toggle='modal'");
  124. if($type == 'personal')
  125. {
  126. if($leave->status == 'pass' and date('Y-m-d H:i:s') > "$leave->begin $leave->start" && date('Y-m-d H:i:s') < "$leave->end $leave->finish" && $leave->backDate != "$leave->end $leave->finish")
  127. {
  128. extCommonModel::printLink('oa.leave', 'back', "id={$leave->id}", $lang->leave->back, "data-toggle='modal'");
  129. }
  130. else
  131. {
  132. echo baseHTML::a('###', $lang->leave->back, "disabled='disabled'");
  133. }
  134. $switchLabel = $leave->status == 'wait' ? $lang->leave->cancel : $lang->leave->commit;
  135. if(strpos(',wait,draft,', ",$leave->status,") !== false)
  136. {
  137. extCommonModel::printLink('oa.leave', 'switchstatus', "id={$leave->id}", $switchLabel, "class='reload'");
  138. }
  139. else
  140. {
  141. echo baseHTML::a('###', $switchLabel, "disabled='disabled'");
  142. }
  143. if(strpos(',wait,draft,reject,', ",$leave->status,") !== false)
  144. {
  145. extCommonModel::printLink('oa.leave', 'edit', "id={$leave->id}", $lang->edit, "data-toggle='modal'");
  146. extCommonModel::printLink('oa.leave', 'delete', "id={$leave->id}", $lang->delete, "class='deleter'");
  147. }
  148. else
  149. {
  150. echo baseHTML::a('###', $lang->edit, "disabled='disabled'");
  151. echo baseHTML::a('###', $lang->delete, "disabled='disabled'");
  152. }
  153. }
  154. else
  155. {
  156. $canReview = $this->leave->isClickable($leave, 'review');
  157. if($canReview)
  158. {
  159. $params = $leave->status == 'back' ? '&mode=back' : '';
  160. echo baseHTML::a(inlink('review', "id={$leave->id}&status=pass$params"), $lang->leave->reviewStatusList['pass'], "class='reviewPass'");
  161. echo baseHTML::a(inlink('review', "id={$leave->id}&status=reject$params"), $lang->leave->reviewStatusList['reject'], "data-toggle='modal'");
  162. }
  163. else
  164. {
  165. echo baseHTML::a('javascript:;', $lang->leave->reviewStatusList['pass'], "class='disabled'");
  166. echo baseHTML::a('javascript:;', $lang->leave->reviewStatusList['reject'], "class='disabled'");
  167. }
  168. }
  169. ?>
  170. </td>
  171. </tr>
  172. <?php endforeach;?>
  173. </table>
  174. <?php endif;?>
  175. </div>
  176. <?php if($type != 'browseReview'):?>
  177. </div>
  178. </div>
  179. <?php endif;?>
  180. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>