personal.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. /**
  3. * The personal view file of attend 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 liyuchun <liyuchun@cnezsoft.com>
  8. * @package attend
  9. * @version $Id$
  10. * @link http://www.zentao.net
  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->getMethodName());
  23. foreach($lang->attend->featureBar['personal'] as $type => $name)
  24. {
  25. $class = strtolower($type) == $methodName ? "class='active'" : '';
  26. if(common::hasPriv('attend', $type)) echo "<li id='$type' $class>" . html::a($this->createLink('attend', $type), $name) . '</li>';
  27. }
  28. ?>
  29. </ul>
  30. </div>
  31. <div class='with-side'>
  32. <div class='side'>
  33. <div class='panel panel-sm'>
  34. <div class='panel-body'>
  35. <ul class='tree' data-ride='tree' data-collapsed='true'>
  36. <?php foreach($yearList as $year):?>
  37. <li class='<?php echo $year == $currentYear ? 'active' : ''?>'>
  38. <?php extCommonModel::printLink('attend', 'personal', "date=$year", $year);?>
  39. <ul>
  40. <?php foreach($monthList[$year] as $month):?>
  41. <li class='<?php echo ($year == $currentYear and $month == $currentMonth) ? 'active' : ''?>'>
  42. <?php extCommonModel::printLink('attend', 'personal', "date=$year$month", $year . $month);?>
  43. </li>
  44. <?php endforeach;?>
  45. </ul>
  46. </li>
  47. <?php endforeach;?>
  48. </ul>
  49. </div>
  50. </div>
  51. </div>
  52. <div class='main'>
  53. <div class='row'>
  54. <?php
  55. $weekIndex = 0;
  56. if($this->config->attend->workingDays > 7)
  57. {
  58. $startDate = strtotime("$currentYear-$currentMonth-01");
  59. $startDate = date('w', $startDate) == 0 ? $startDate : strtotime("last Sunday", $startDate);
  60. $endDate = strtotime("next month -1 day $currentYear-$currentMonth-01");
  61. $endDate = date('w', $endDate) == 6 ? $endDate : strtotime("next Saturday", $endDate);
  62. $firstDayIndex = 0;
  63. $lastDayIndex = 6;
  64. }
  65. else
  66. {
  67. $startDate = strtotime("$currentYear-$currentMonth-01");
  68. $startDate = date('w', $startDate) == 1 ? $startDate : strtotime("last Monday", $startDate);
  69. $endDate = strtotime("next month -1 day $currentYear-$currentMonth-01");
  70. $endDate = date('w', $endDate) == 0 ? $endDate : strtotime("next Sunday", $endDate);
  71. $firstDayIndex = 1;
  72. $lastDayIndex = 0;
  73. }
  74. ?>
  75. <?php while($startDate <= $endDate):?>
  76. <?php $dayIndex = date('w', $startDate);?>
  77. <?php if($dayIndex == $firstDayIndex):?>
  78. <div class='col-xs-4'>
  79. <div class='panel'>
  80. <div class='panel-body no-padding'>
  81. <table class="table table-data text-center table-fixed">
  82. <thead>
  83. <tr class='text-center'>
  84. <th class='w-80px'><?php echo $lang->attend->weeks[$weekIndex];?></th>
  85. <th class='w-40px'><?php echo $lang->attend->dayName;?></th>
  86. <th title='<?php echo $lang->attend->signIn;?>'><?php echo $lang->attend->signIn;?></th>
  87. <th title='<?php echo $lang->attend->signOut;?>'><?php echo $lang->attend->signOut;?></th>
  88. <th class='w-100px'><?php echo $lang->actions . '/' . $lang->attend->status;?></th>
  89. </tr>
  90. </thead>
  91. <?php endif;?>
  92. <?php $currentDate = date('Y-m-d', $startDate);?>
  93. <?php if(isset($attends[$currentDate])):?>
  94. <?php $attend = $attends[$currentDate];?>
  95. <?php $status = $attend->status;?>
  96. <?php $reason = $attend->reason;?>
  97. <?php $date = date('Ymd', $startDate);?>
  98. <?php $reviewStatus = isset($attend->reviewStatus) ? $attend->reviewStatus : '';?>
  99. <tr class="text-middle attend-<?php echo $status?> <?php echo (date('m', $startDate) == $currentMonth) ? '' : 'otherMonth'?>" title='<?php echo $lang->attend->statusList[$status]?>'>
  100. <td><?php echo formatTime($currentDate, DT_DATE1);?></td>
  101. <td><?php echo $lang->datepicker->abbrDayNames[$dayIndex]?></td>
  102. <td class='attend-signin'>
  103. <?php $signIn = substr($attend->signIn, 0, 5);?>
  104. <?php if(strpos(',late,absent,rest,leave,lieu,', ",$status,") !== false) $signIn = $lang->attend->statusList[$status];?>
  105. <?php if($status == 'both') $signIn = $lang->attend->statusList['late'];?>
  106. <?php echo $signIn;?>
  107. </td>
  108. <td class='attend-signout'>
  109. <?php $signOut = substr($attend->signOut, 0, 5);?>
  110. <?php if(strpos(',early,absent,rest,leave,lieu,', ",$status,") !== false) $signOut = $lang->attend->statusList[$status];?>
  111. <?php if($status == 'both') $signOut = $lang->attend->statusList['early'];?>
  112. <?php echo $signOut;?>
  113. </td>
  114. <td class='attend-actions'>
  115. <?php
  116. $edit = $reviewStatus == 'wait' ? $lang->attend->edited : $lang->attend->edit;
  117. $leave = $reason == 'leave' ? $lang->attend->leaved : $lang->attend->leave;
  118. $makeup = $reason == 'makeup' ? $lang->attend->makeuped : $lang->attend->makeup;
  119. $overtime = $reason == 'overtime' ? $lang->attend->overtimed : $lang->attend->overtime;
  120. $lieu = $reason == 'lieu' ? $lang->attend->lieud : $lang->attend->lieu;
  121. $trip = $reason == 'trip' ? $lang->attend->triped : $lang->attend->trip;
  122. $egress = $reason == 'egress' ? $lang->attend->egress : $lang->attend->egress;
  123. ?>
  124. <?php if($attend->hoursList):?>
  125. <?php
  126. $index = 1;
  127. $statusLabel = '';
  128. foreach($attend->hoursList as $status => $hours)
  129. {
  130. if($index > 1) $statusLabel .= '<br/>';
  131. $statusLabel .= $lang->attend->statusList[$status] . $hours . 'h';
  132. $index++;
  133. }
  134. ?>
  135. <div class='dropdown text-left'>
  136. <a href='javascript:;' data-toggle='dropdown'>
  137. <span class='attend-<?php echo $status;?>'><?php echo $statusLabel;?></span>
  138. <span class='caret'></span>
  139. </a>
  140. <ul role='menu' class='dropdown-menu'>
  141. <li><?php echo baseHTML::a($this->createLink('attend', 'edit', "date=" . $date), $edit, "data-toggle='modal' data-width='500px'") . "</li>";?>
  142. </ul>
  143. </div>
  144. <?php elseif($status == 'leave'):?>
  145. <span class='attend-<?php echo $status;?>'>
  146. <?php extCommonModel::printLink('leave', 'create', "date=" . $date, $leave, "data-toggle='modal' data-width='700px'");?>
  147. </span>
  148. <?php elseif($status == 'overtime'):?>
  149. <span class='attend-<?php echo $status;?>'>
  150. <?php extCommonModel::printLink('overtime', 'create', "date=" . $date, $overtime, "data-toggle='modal' data-width='700px'");?>
  151. </span>
  152. <?php elseif($status == 'lieu'):?>
  153. <span class='attend-<?php echo $status;?>'>
  154. <?php extCommonModel::printLink('lieu', 'create', "date=" . $date, $lieu, "data-toggle='modal' data-width='700px'");?>
  155. </span>
  156. <?php elseif(strpos(',rest,normal,', ",$status,") === false):?>
  157. <?php if($reviewStatus == 'wait' or strpos(',late,early,both,', ",$status,") !== false):?>
  158. <?php echo baseHTML::a($this->createLink('attend', 'edit', "date=" . $date), $edit, "data-toggle='modal' data-width='500px'");?>
  159. <?php else:?>
  160. <div class='dropdown'>
  161. <a href='javascript:;' data-toggle='dropdown'><?php echo $lang->actions;?><span class='caret'></span></a>
  162. <ul role='menu' class='dropdown-menu'>
  163. <?php if($reason == '' or $reason == 'normal') extCommonModel::printLink('attend', 'edit', "date=" . $date, $edit, "data-toggle='modal' data-width='500px'", '', '', 'li');?>
  164. <?php if($reason == '' or $reason == 'leave') extCommonModel::printLink('leave', 'create', "date=" . $date, $leave, "data-toggle='modal' data-width='700px'", '', '', 'li');?>
  165. <?php if($reason == '' or $reason == 'makeup') extCommonModel::printLink('makeup', 'create', "date=" . $date, $makeup, "data-toggle='modal' data-width='700px'", '', '', 'li');?>
  166. <?php if($reason == '' or $reason == 'overtime') extCommonModel::printLink('overtime', 'create', "date=" . $date, $overtime, "data-toggle='modal' data-width='700px'", '', '', 'li');?>
  167. <?php if($reason == '' or $reason == 'lieu') extCommonModel::printLink('lieu', 'create', "date=" . $date, $lieu, "data-toggle='modal' data-width='700px'", '', '', 'li');?>
  168. <?php if($reason == '' or $reason == 'trip') extCommonModel::printLink('trip', 'create', "date=" . $date, $trip, "data-toggle='modal' data-width='700px'", '', '', 'li');?>
  169. <?php if($reason == '' or $reason == 'egress') extCommonModel::printLink('egress', 'create', "date=" . $date, $egress, "data-toggle='modal' data-width='700px'", '', '', 'li');?>
  170. </ul>
  171. </div>
  172. <?php endif;?>
  173. <?php elseif($status == 'rest'):?>
  174. <span class='attend-<?php echo $status;?>'>
  175. <?php extCommonModel::printLink('overtime', 'create', "date=" . $date, $lang->attend->overtime, "data-toggle='modal' data-width='700px'");?>
  176. </span>
  177. <?php elseif($status == 'normal'):?>
  178. <span class='attend-<?php echo $status;?>'><?php echo $lang->attend->statusList[$status];?></span>
  179. <?php endif;?>
  180. </td>
  181. </tr>
  182. <?php else:?>
  183. <tr class="<?php echo (date('m', $startDate) == $currentMonth) ? '' : 'otherMonth'?>">
  184. <td><?php echo formatTime($currentDate, DT_DATE1);?></td>
  185. <td><?php echo $lang->datepicker->abbrDayNames[$dayIndex]?></td>
  186. <td></td>
  187. <td></td>
  188. <td></td>
  189. </tr>
  190. <?php endif;?>
  191. <?php if($dayIndex == $lastDayIndex):?>
  192. </table>
  193. </div>
  194. </div>
  195. <?php $weekIndex += 1;?>
  196. </div>
  197. <?php endif;?>
  198. <?php $startDate = strtotime('+1 day', $startDate);?>
  199. <?php endwhile;?>
  200. </div>
  201. </div>
  202. </div>
  203. <script>
  204. $(function()
  205. {
  206. $('.side .has-active-item').addClass('open');
  207. })
  208. </script>
  209. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>