oa.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. public function __construct()
  3. {
  4. parent::__construct();
  5. if(isset($this->config->attend->noAttendUsers) and isset($this->app->user->account) and strpos(",{$this->config->attend->noAttendUsers},", ",{$this->app->user->account},") !== false)
  6. {
  7. unset($this->lang->attend->featurebar->personal);
  8. $this->lang->oa->menu->attend = array('link' => $this->lang->attend->attendance.'|attend|department');
  9. }
  10. }
  11. /**
  12. * Compute attend's status.
  13. *
  14. * @param object $attend
  15. * @access public
  16. * @return string
  17. */
  18. public function computeStatus($attend)
  19. {
  20. return $this->loadExtension('oa')->computeStatus($attend);
  21. }
  22. /**
  23. * Save stat.
  24. *
  25. * @param int $date
  26. * @access public
  27. * @return bool
  28. */
  29. public function saveStat($date)
  30. {
  31. return $this->loadExtension('oa')->saveStat($date);
  32. }
  33. /**
  34. * Set reviewer for attend.
  35. *
  36. * @access public
  37. * @return bool
  38. */
  39. public function setManager()
  40. {
  41. return $this->loadExtension('oa')->setManager();
  42. }
  43. /**
  44. * Judge an action is clickable or not.
  45. *
  46. * @param object $attend
  47. * @param string $action
  48. * @access public
  49. * @return bool
  50. */
  51. public function isClickable($attend, $action)
  52. {
  53. $action = strtolower($action);
  54. $clickable = commonModel::hasPriv('attend', $action);
  55. if(!$clickable) return false;
  56. $account = $this->app->user->account;
  57. switch($action)
  58. {
  59. case 'review' :
  60. $reviewedBy = $this->getReviewedBy($attend->account);
  61. $canReview = $attend->reviewStatus == 'wait' && $reviewedBy == $account;
  62. return $canReview;
  63. }
  64. return true;
  65. }
  66. public function update($oldAttend, $date, $account)
  67. {
  68. return $this->loadExtension('oa')->update($oldAttend, $date, $account);
  69. }
  70. public function checkWaitReviews($month)
  71. {
  72. return $this->loadExtension('oa')->checkWaitReviews($month);
  73. }
  74. public function getDeptManager($month)
  75. {
  76. return $this->loadExtension('oa')->getDeptManager($month);
  77. }
  78. public function getDetailAttends($date = '', $account = '', $deptID = 0)
  79. {
  80. return $this->loadExtension('oa')->getDetailAttends($date, $account, $deptID);
  81. }
  82. public function computeAttendStat($stat, $startDate, $endDate)
  83. {
  84. return $this->loadExtension('oa')->computeAttendStat($stat, $startDate, $endDate);
  85. }
  86. public function signIn($account = '', $date = '')
  87. {
  88. return $this->loadExtension('oa')->signIn($account, $date);
  89. }