homeitemsModel.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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']) && $this->iscun('officiahong'))$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']) && $this->iscun('officidu'))$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']) && $this->iscun('planm')){
  70. $obj = m('flow:planm');
  71. if(method_exists($obj,'getwwctotals'))$arr['myplan'] = $obj->getwwctotals($uid);
  72. }
  73. if($this->iscun('custfina')){
  74. $dbss = m('custfina');
  75. if(in_array('daifina', $nubar))$arr['daifina'] = $dbss->rows('`ispay`=1 and `jzid`=0 and `type`=0');
  76. if(in_array('daifinb', $nubar))$arr['daifinb'] = $dbss->rows('`ispay`=1 and `jzid`=0 and `type`=1');
  77. }
  78. return $arr;
  79. }
  80. //判断模块是否开启存在
  81. public function iscun($num)
  82. {
  83. $to = $this->db->rows('[Q]flow_set',"`num`='$num' and `status`=1");
  84. return $to==1;
  85. }
  86. //我的申请
  87. public function get_apply_arr()
  88. {
  89. return m('flowbill')->homelistshow();
  90. }
  91. //通知公告读取,5是读取的条数
  92. public function get_gong_arr()
  93. {
  94. $to = m('mode')->rows("`num`='gong' and `status`=1");
  95. if($to==0)return array();
  96. return m('flow')->initflow('gong')->getflowrows($this->adminid,'my', 5);
  97. }
  98. //会议
  99. public function get_meet_arr()
  100. {
  101. $to = m('mode')->rows("`num`='meet' and `status`=1");
  102. if($to==0)return array();
  103. return m('meet')->getmeethome($this->rock->date, $this->adminid);
  104. }
  105. //系统日志
  106. public function get_syslog_arr()
  107. {
  108. return m('log')->getrows('1=1','type,remark,optdt,level','id desc limit 5');
  109. }
  110. //考勤打卡的
  111. public function get_kqdk_arr()
  112. {
  113. $to = m('mode')->rows("`num`='kqdkjl' and `status`=1");
  114. if($to==0)return array('sbarr'=>array(),'dkarr'=>array());
  115. $kq = m('kaoqin');
  116. $dt = $this->rock->date;
  117. if($this->rock->get('atype')=='daka')$kq->kqanay($this->adminid, $dt);
  118. $sbarr = $kq->getsbanay($this->adminid, $dt);
  119. $dkarr = $kq->getdkjl($this->adminid, $dt);
  120. return array(
  121. 'sbarr' => $sbarr,
  122. 'dkarr' => $dkarr,
  123. );
  124. }
  125. //读取我查阅公文,5是读取条数
  126. public function get_officic_arr()
  127. {
  128. $to = m('mode')->rows("`num`='officic' and `status`=1");
  129. if($to==0)return array();
  130. return m('flow')->initflow('officic')->getflowrows($this->adminid,'my',5);
  131. }
  132. //读取新闻的
  133. public function get_news_arr()
  134. {
  135. $to = m('mode')->rows("`num`='news' and `status`=1");
  136. if($to==0)return array('typearr'=>array(),'rows'=>array());
  137. $typearr = m('option')->getdata('newstype',"and `value` like 'home%'");
  138. $rows = m('flow')->initflow('news')->getflowrows($this->adminid,'my');
  139. return array(
  140. 'typearr' => $typearr,
  141. 'rows' => $rows,
  142. );
  143. }
  144. //考勤情况统计
  145. public function get_kqtotal_arr()
  146. {
  147. $to = m('mode')->rows("`num`='kqdkjl' and `status`=1");
  148. if($to==0)return array();
  149. return m('flow')->initflow('kqdkjl')->homekqtotal();
  150. }
  151. //登录统计
  152. public function get_tjlogin_arr()
  153. {
  154. return m('login')->homejtLogin();
  155. }
  156. }
粤ICP备19079148号