m.personal.html.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /**
  3. * The personal mobile view file of attend module of ZDOO.
  4. *
  5. * @copyright Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license ZPL (http://zpl.pub/page/zplv12.html)
  7. * @author Tingting Dai <daitingting@xirangit.com>
  8. * @package attend
  9. * @version $Id
  10. * @link http://www.zdoo.com
  11. */
  12. if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}
  13. include "../../common/view/m.header.html.php";
  14. ?>
  15. <style>
  16. table .otherMonth {background: #f0f0f0; color: #9e9e9e}
  17. td .attend-normal {color: #38B03F;}
  18. td .attend-leave {color: #9E9E9E;}
  19. td .attend-trip {color: #8666B8;}
  20. td .attend-rest {color: #3280fc;}
  21. .attend-late .attend-signin {color: #EA644A;}
  22. .attend-early .attend-signout {color: #FF8A65;}
  23. .attend-both [class^=attend] {color: #FF5722;}
  24. .attend-absent [class^=attend] {color: #F1A325;}
  25. .attend-rest [class^=attend] {color: #3280FC;}
  26. .list > .list {margin-left: 10px;}
  27. .list > .item {padding: 8px;}
  28. </style>
  29. <div class='heading'>
  30. <nav class='nav fluid'>
  31. <a data-display='dropdown' data-placement='beside-bottom-start'><i class='icon-bars'></i> &nbsp; <?php echo $lang->leave->date;?></a>
  32. <div class='list dropdown-menu'>
  33. <?php foreach($yearList as $year):?>
  34. <a class='item item-year' href='<?php echo $this->createLink('attend', 'personal', "date={$year}");?>'><?php echo $year;?></a>
  35. <div class='list'>
  36. <?php foreach($monthList[$year] as $month):?>
  37. <a class='item item-month' href='<?php echo $this->createLink('attend', 'personal', "date=$year$month");?>'><?php echo $year . $month;?></a>
  38. <?php endforeach;?>
  39. </div>
  40. <?php endforeach;?>
  41. </div>
  42. </nav>
  43. </div>
  44. <section id='page' class='section list-with-pager'>
  45. <div class='box'>
  46. <?php
  47. $weekIndex = 0;
  48. if($this->config->attend->workingDays > 7)
  49. {
  50. $startDate = strtotime("$currentYear-$currentMonth-01");
  51. $startDate = date('w', $startDate) == 0 ? $startDate : strtotime("last Sunday", $startDate);
  52. $endDate = strtotime("next month -1 day $currentYear-$currentMonth-01");
  53. $endDate = date('w', $endDate) == 6 ? $endDate : strtotime("next Saturday", $endDate);
  54. $firstDayIndex = 0;
  55. $lastDayIndex = 6;
  56. }
  57. else
  58. {
  59. $startDate = strtotime("$currentYear-$currentMonth-01");
  60. $startDate = date('w', $startDate) == 1 ? $startDate : strtotime("last Monday", $startDate);
  61. $endDate = strtotime("next month -1 day $currentYear-$currentMonth-01");
  62. $endDate = date('w', $endDate) == 0 ? $endDate : strtotime("next Sunday", $endDate);
  63. $firstDayIndex = 1;
  64. $lastDayIndex = 0;
  65. }
  66. ?>
  67. <?php while($startDate <= $endDate):?>
  68. <?php $dayIndex = date('w', $startDate);?>
  69. <?php if($dayIndex == $firstDayIndex):?>
  70. <table class='table bordered compact'>
  71. <thead>
  72. <tr class='text-center'>
  73. <th style='width:90px'><?php echo $lang->attend->weeks[$weekIndex];?></th>
  74. <th style='width:50px'><?php echo $lang->attend->dayName;?></th>
  75. <th style='width:65px'><?php echo $lang->attend->signIn;?></th>
  76. <th style='width:65px'><?php echo $lang->attend->signOut;?></th>
  77. <th><?php echo $lang->actions . '/' . $lang->attend->status;?></th>
  78. </tr>
  79. </thead>
  80. <tbody>
  81. <?php endif;?>
  82. <?php $currentDate = date("Y-m-d", $startDate);?>
  83. <?php if(isset($attends[$currentDate])):?>
  84. <?php $status = $attends[$currentDate]->status;?>
  85. <?php $reason = $attends[$currentDate]->reason;?>
  86. <?php $reviewStatus = isset($attends[$currentDate]->reviewStatus) ? $attends[$currentDate]->reviewStatus : '';?>
  87. <tr class="text-center attend-<?php echo $status?> <?php echo (date('m', $startDate) == $currentMonth) ? '' : 'otherMonth'?>" title='<?php echo $lang->attend->statusList[$status]?>'>
  88. <td><?php echo $currentDate;?></td>
  89. <td><?php echo $lang->datepicker->abbrDayNames[$dayIndex]?></td>
  90. <td class='attend-signin'>
  91. <?php $signIn = substr($attends[$currentDate]->signIn, 0, 5);?>
  92. <?php if(strpos(',late,absent,rest,', $status) !== false) $signIn = $lang->attend->statusList[$status];?>
  93. <?php if($status == 'both') $signIn = $lang->attend->statusList['late'];?>
  94. <?php echo $signIn;?>
  95. </td>
  96. <td class='attend-signout'>
  97. <?php $signOut = substr($attends[$currentDate]->signOut, 0, 5);?>
  98. <?php if(strpos(',early,absent,rest,', $status) !== false) $signOut = $lang->attend->statusList[$status];?>
  99. <?php if($status == 'both') $signOut = $lang->attend->statusList['early'];?>
  100. <?php echo $signOut;?>
  101. </td>
  102. <td>
  103. <?php if(strpos('rest, normal, trip, egress, leave, overtime,lieu', $status) === false):?>
  104. <?php if($reviewStatus == 'wait' or strpos('late,early,both', $status) !== false):?>
  105. <a class='btn btn-sm warning' data-remote='<?php echo $this->createLink('attend', 'edit', "date=" . str_replace('-', '', $currentDate));?>' data-display='modal' data-placement='bottom'>
  106. <?php echo $reviewStatus == 'wait' ? $lang->attend->edited : $lang->attend->edit;?>
  107. </a>
  108. <?php elseif($reason == '' or $reason == 'normal'):?>
  109. <a class='btn btn-sm warning' data-remote='<?php echo $this->createLink('attend', 'edit', "date=" . str_replace('-', '', $currentDate));?>' data-display='modal' data-placement='bottom'>
  110. <?php echo $reviewStatus == 'wait' ? $lang->attend->edited : $lang->attend->edit;?>
  111. </a>
  112. <?php endif;?>
  113. <?php else:?>
  114. <span class="attend-<?php echo $status;?>">
  115. <?php if($status != 'rest') echo $lang->attend->statusList[$status];?>
  116. <?php if(strpos('leave,trip,egress,overtime,lieu', $status) !== false and $attends[$currentDate]->desc) echo ' ' . $attends[$currentDate]->desc . 'h';?>
  117. </span>
  118. <?php endif;?>
  119. </td>
  120. </tr>
  121. <?php else:?>
  122. <tr class="text-center <?php echo (date('m', $startDate) == $currentMonth) ? '' : 'otherMonth'?>">
  123. <td><?php echo $currentDate;?></td>
  124. <td><?php echo $lang->datepicker->abbrDayNames[$dayIndex]?></td>
  125. <td></td>
  126. <td></td>
  127. <td></td>
  128. </tr>
  129. <?php endif;?>
  130. <?php if($dayIndex == $lastDayIndex):?>
  131. </tbody>
  132. </table>
  133. <?php $weekIndex += 1;?>
  134. <?php endif;?>
  135. <?php $startDate = strtotime('+1 day', $startDate);?>
  136. <?php endwhile;?>
  137. </div>
  138. </section>
  139. <?php include "../../common/view/m.footer.html.php"; ?>