personal.html.php 11 KB

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