homeitemsModel.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. //读取权限下的菜单id
  55. $myext = $this->rock->session('adminallmenuid');
  56. $mewhere = '';
  57. if($myext != '-1'){
  58. $mewhere = '`id` in('.str_replace(array('[',']'), array('',''), $myext).') and ';
  59. }
  60. if($this->adminid!=1)$mewhere.='`type`=0 and ';
  61. $nubar = array();
  62. $nuarr = m('menu')->getall(''.$mewhere.'`status`=1 and num is not null');
  63. foreach($nuarr as $k=>$rs)$nubar[] = $rs['num'];
  64. if(in_array('daiban', $nubar) && !isset($arr['daiban']))$arr['daiban'] = $bidb->daibanshu($uid);
  65. if(in_array('applywtg', $nubar) && !isset($arr['applywtg']))$arr['applywtg'] = $bidb->applymywgt($uid);
  66. if(in_array('daiturn', $nubar) && !isset($arr['daiturn']))$arr['daiturn'] = $bidb->daiturntotal($uid);
  67. if(in_array('danerror', $nubar) && !isset($arr['danerror']))$arr['danerror'] = $bidb->errortotal();
  68. if(in_array('workwwc', $nubar) && !isset($arr['workwwc']))$arr['workwwc'] = m('work')->getwwctotals($uid);
  69. if(in_array('email', $nubar) && !isset($arr['email']))$arr['email'] = m('emailm')->wdtotal($uid);
  70. if(in_array('flowtodo', $nubar) && !isset($arr['flowtodo']))$arr['flowtodo'] = m('flowtodo')->getwdtotals($uid);
  71. if(in_array('cropt', $nubar) && !isset($arr['cropt']))$arr['cropt'] = m('goods')->getdaishu(); //出入库操作数
  72. if(in_array('receiptmy', $nubar) && !isset($arr['receiptmy']))$arr['receiptmy'] = m('flow:receipt')->getweitotal($uid);
  73. 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');//统计未套红的
  74. 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).'');
  75. //未完成工作计划
  76. if(in_array('myplan', $nubar) && !isset($arr['myplan']) && $this->iscun('planm')){
  77. $obj = m('flow:planm');
  78. if(method_exists($obj,'getwwctotals'))$arr['myplan'] = $obj->getwwctotals($uid);
  79. }
  80. if($this->iscun('custfina')){
  81. $dbss = m('custfina');
  82. if(in_array('daifina', $nubar))$arr['daifina'] = $dbss->rows('`ispay`=1 and `jzid`=0 and `type`=0');
  83. if(in_array('daifinb', $nubar))$arr['daifinb'] = $dbss->rows('`ispay`=1 and `jzid`=0 and `type`=1');
  84. }
  85. if(in_array('allfybx', $nubar))$arr['allfybx'] = m('fininfom')->rows('`type`=0 and `status`=1 and `jzid`=0');
  86. if(in_array('allccbx', $nubar))$arr['allccbx'] = m('fininfom')->rows('`type`=1 and `status`=1 and `jzid`=0');
  87. //物业的
  88. if($this->iscun('wyfee')){
  89. if(in_array('wyfee', $nubar))$arr['wyfee'] = m('wyfee')->rows('`ispay`=2');
  90. }
  91. foreach($arr as $k=>$v)if($v==0)unset($arr[$k]);
  92. return $arr;
  93. }
  94. //判断模块是否开启存在
  95. public function iscun($num)
  96. {
  97. $to = $this->db->rows('[Q]flow_set',"`num`='$num' and `status`=1");
  98. return $to==1;
  99. }
  100. //我的申请
  101. public function get_apply_arr()
  102. {
  103. return m('flowbill')->homelistshow();
  104. }
  105. //通知公告读取,5是读取的条数
  106. public function get_gong_arr()
  107. {
  108. $to = m('mode')->rows("`num`='gong' and `status`=1");
  109. if($to==0)return array();
  110. return m('flow')->initflow('gong')->getflowrows($this->adminid,'my', 5);
  111. }
  112. //会议
  113. public function get_meet_arr()
  114. {
  115. $to = m('mode')->rows("`num`='meet' and `status`=1");
  116. if($to==0)return array();
  117. return m('meet')->getmeethome($this->rock->date, $this->adminid);
  118. }
  119. //系统日志
  120. public function get_syslog_arr()
  121. {
  122. return m('log')->getrows('1=1','type,remark,optdt,level','id desc limit 5');
  123. }
  124. //考勤打卡的
  125. public function get_kqdk_arr()
  126. {
  127. $to = m('mode')->rows("`num`='kqdkjl' and `status`=1");
  128. if($to==0)return array('sbarr'=>array(),'dkarr'=>array());
  129. $kq = m('kaoqin');
  130. $dt = $this->rock->date;
  131. if($this->rock->get('atype')=='daka')$kq->kqanay($this->adminid, $dt);
  132. $sbarr = $kq->getsbanay($this->adminid, $dt);
  133. $dkarr = $kq->getdkjl($this->adminid, $dt);
  134. return array(
  135. 'sbarr' => $sbarr,
  136. 'dkarr' => $dkarr,
  137. );
  138. }
  139. //读取我查阅公文,5是读取条数
  140. public function get_officic_arr()
  141. {
  142. $to = m('mode')->rows("`num`='officic' and `status`=1");
  143. if($to==0)return array();
  144. return m('flow')->initflow('officic')->getflowrows($this->adminid,'my',5);
  145. }
  146. //读取新闻的
  147. public function get_news_arr()
  148. {
  149. $to = m('mode')->rows("`num`='news' and `status`=1");
  150. if($to==0)return array('typearr'=>array(),'rows'=>array());
  151. $typearr = m('option')->getdata('newstype',"and `value` like 'home%'");
  152. $rows = m('flow')->initflow('news')->getflowrows($this->adminid,'my');
  153. return array(
  154. 'typearr' => $typearr,
  155. 'rows' => $rows,
  156. );
  157. }
  158. //考勤情况统计
  159. public function get_kqtotal_arr()
  160. {
  161. $to = m('mode')->rows("`num`='kqdkjl' and `status`=1");
  162. if($to==0)return array();
  163. return m('flow')->initflow('kqdkjl')->homekqtotal();
  164. }
  165. //登录统计
  166. public function get_tjlogin_arr()
  167. {
  168. return m('login')->homejtLogin();
  169. }
  170. }
粤ICP备19079148号