1
0

homeitemsModel.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /**
  3. * 桌面项目
  4. */
  5. class homeitemsClassModel extends Model
  6. {
  7. public function getmyshow()
  8. {
  9. $str = m('admin')->getjoinstr('receid', $this->adminid, 1);
  10. $rows = $this->getall('`status`=1 and ('.$str.')','`num`,`row`,`name`,`sort`','`row`,`sort`');
  11. return $rows;
  12. }
  13. /**
  14. * 桌面项目数据读取
  15. */
  16. public function getitemsdata($nums='')
  17. {
  18. if(isempt($nums))$nums = 'apply,gong,meet';
  19. $numarr = explode(',', $nums);
  20. $barr = array();
  21. $xhtype = getconfig('xinhutype');
  22. $obj = false;
  23. if(!isempt($xhtype))$obj = m($xhtype);
  24. foreach($numarr as $num){
  25. $act = 'get_'.$num.'_arr';
  26. if(method_exists($this, $act)){
  27. $barr[''.$num.'arr'] = $this->$act();
  28. }else if($obj){
  29. if(method_exists($obj, $act))
  30. $barr[''.$num.'arr'] = $obj->$act();
  31. }
  32. }
  33. $barr['total'] = $this->gettotals($this->adminid);//统计角标
  34. return $barr;
  35. }
  36. //快捷入口红数字的统计的(根据菜单编号来的)
  37. public function gettotals($uid)
  38. {
  39. $optdt = $this->rock->now;
  40. $arr = array();
  41. $bidb = m('flowbill');
  42. $todo = m('todo')->rows("uid='$uid' and `status`=0 and `tododt`<='$optdt'");
  43. $arr['todo'] = $todo;
  44. $obj = false;
  45. $cbarr = array();
  46. $xhtype = getconfig('xinhutype');
  47. if(!isempt($xhtype))$obj = m($xhtype);
  48. if($obj){
  49. if(method_exists($obj, 'menutotals')){
  50. $cbarr = $obj->menutotals();
  51. if(is_array($cbarr))foreach($cbarr as $k=>$v)$arr[$k]=$v;
  52. }
  53. }
  54. $nubar = array();
  55. $nuarr = m('menu')->getall('`status`=1 and num is not null');
  56. foreach($nuarr as $k=>$rs)$nubar[] = $rs['num'];
  57. if(!isset($arr['daiban']))$arr['daiban'] = $bidb->daibanshu($uid);
  58. if(!isset($arr['applywtg']))$arr['applywtg'] = $bidb->applymywgt($uid);
  59. if(!isset($arr['daiturn']))$arr['daiturn'] = $bidb->daiturntotal($uid);
  60. if(!isset($arr['danerror']))$arr['danerror'] = $bidb->errortotal();
  61. if(in_array('workwwc', $nubar) && !isset($arr['workwwc']))$arr['workwwc'] = m('work')->getwwctotals($uid);
  62. if(in_array('email', $nubar) && !isset($arr['email']))$arr['email'] = m('emailm')->wdtotal($uid);
  63. if(in_array('flowtodo', $nubar) && !isset($arr['flowtodo']))$arr['flowtodo'] = m('flowtodo')->getwdtotals($uid);
  64. if(in_array('cropt', $nubar) && !isset($arr['cropt']))$arr['cropt'] = m('goods')->getdaishu(); //出入库操作数
  65. if(in_array('receiptmy', $nubar) && !isset($arr['receiptmy']))$arr['receiptmy'] = m('flow:receipt')->getweitotal($uid);
  66. if(in_array('myhong', $nubar) && !isset($arr['myhong']))$arr['myhong'] = m('official')->rows('`uid`='.$uid.' and `type`=0 and `status`=1 and `thid`=0');//统计未套红的
  67. if(in_array('officidus', $nubar) && !isset($arr['officidus']))$arr['officidus'] = m('officidu')->rows('`status` in(0,3) and `isturn`=1 and '.$this->rock->dbinstr('runrenid',$uid).'');
  68. //未完成工作计划
  69. if(in_array('myplan', $nubar) && !isset($arr['myplan'])){
  70. $obj = m('flow:planm');
  71. if(method_exists($obj,'getwwctotals'))$arr['myplan'] = $obj->getwwctotals($uid);
  72. }
  73. return $arr;
  74. }
  75. //我的申请
  76. public function get_apply_arr()
  77. {
  78. return m('flowbill')->homelistshow();
  79. }
  80. //通知公告读取,5是读取的条数
  81. public function get_gong_arr()
  82. {
  83. $to = m('mode')->rows("`num`='gong' and `status`=1");
  84. if($to==0)return array();
  85. return m('flow')->initflow('gong')->getflowrows($this->adminid,'my', 5);
  86. }
  87. //会议
  88. public function get_meet_arr()
  89. {
  90. $to = m('mode')->rows("`num`='meet' and `status`=1");
  91. if($to==0)return array();
  92. return m('meet')->getmeethome($this->rock->date, $this->adminid);
  93. }
  94. //系统日志
  95. public function get_syslog_arr()
  96. {
  97. return m('log')->getrows('1=1','type,remark,optdt,level','id desc limit 5');
  98. }
  99. //考勤打卡的
  100. public function get_kqdk_arr()
  101. {
  102. $to = m('mode')->rows("`num`='kqdkjl' and `status`=1");
  103. if($to==0)return array('sbarr'=>array(),'dkarr'=>array());
  104. $kq = m('kaoqin');
  105. $dt = $this->rock->date;
  106. if($this->rock->get('atype')=='daka')$kq->kqanay($this->adminid, $dt);
  107. $sbarr = $kq->getsbanay($this->adminid, $dt);
  108. $dkarr = $kq->getdkjl($this->adminid, $dt);
  109. return array(
  110. 'sbarr' => $sbarr,
  111. 'dkarr' => $dkarr,
  112. );
  113. }
  114. //读取我查阅公文,5是读取条数
  115. public function get_officic_arr()
  116. {
  117. $to = m('mode')->rows("`num`='officic' and `status`=1");
  118. if($to==0)return array();
  119. return m('flow')->initflow('officic')->getflowrows($this->adminid,'my',5);
  120. }
  121. //读取新闻的
  122. public function get_news_arr()
  123. {
  124. $to = m('mode')->rows("`num`='news' and `status`=1");
  125. if($to==0)return array('typearr'=>array(),'rows'=>array());
  126. $typearr = m('option')->getdata('newstype',"and `value` like 'home%'");
  127. $rows = m('flow')->initflow('news')->getflowrows($this->adminid,'my');
  128. return array(
  129. 'typearr' => $typearr,
  130. 'rows' => $rows,
  131. );
  132. }
  133. //考勤情况统计
  134. public function get_kqtotal_arr()
  135. {
  136. $to = m('mode')->rows("`num`='kqdkjl' and `status`=1");
  137. if($to==0)return array();
  138. return m('flow')->initflow('kqdkjl')->homekqtotal();
  139. }
  140. //登录统计
  141. public function get_tjlogin_arr()
  142. {
  143. return m('login')->homejtLogin();
  144. }
  145. }
粤ICP备19079148号