mode_collectsAction.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /**
  3. * 此文件是流程模块【collects.信息收集表】对应控制器接口文件。
  4. */
  5. class mode_collectsClassAction extends inputAction{
  6. /**
  7. * 重写函数:保存前处理,主要用于判断是否可以保存
  8. * $table String 对应表名
  9. * $arr Array 表单参数
  10. * $id Int 对应表上记录Id 0添加时,大于0修改时
  11. * $addbo Boolean 是否添加时
  12. * return array('msg'=>'错误提示内容','rows'=> array()) 可返回空字符串,或者数组 rows 是可同时保存到数据库上数组
  13. */
  14. protected function savebefore($table, $arr, $id, $addbo){
  15. $rows['type'] = 3; //必须为3
  16. return array(
  17. 'rows' => $rows
  18. );
  19. }
  20. /**
  21. * 重写函数:保存后处理,主要保存其他表数据
  22. * $table String 对应表名
  23. * $arr Array 表单参数
  24. * $id Int 对应表上记录Id
  25. * $addbo Boolean 是否添加时
  26. */
  27. protected function saveafter($table, $arr, $id, $addbo){
  28. }
  29. protected function storeaftersss($table, $rows, $barr=array())
  30. {
  31. $arr = array();
  32. $mid = (int)$this->get('leixingid','0');
  33. if($mid>0 && isset($barr['listinfo'])){
  34. $fieldsarr = $barr['listinfo']['fieldsarr'];
  35. }
  36. return $arr;
  37. }
  38. private $zdarr,$zdobj;
  39. public function collectstotal_before()
  40. {
  41. $mid = (int)$this->get('mid','0');
  42. $this->mid = $mid;
  43. $key = $this->post('key');
  44. $this->zdarr = m('plans')->getall('mid='.$this->mid.'','*','`sort`');
  45. $this->zdobj = array();
  46. $where = '';
  47. if($key)$where=" and (`optname` like '%".$key."%'";
  48. $wher1 = '';
  49. foreach($this->zdarr as $k=>$rs){
  50. $flx = $rs['zxren'];
  51. $this->zdobj[$rs['id']] = $flx;
  52. }
  53. if($key)$wher1=" a.`zxren` like '%".$key."%'";
  54. if($wher1)$where.=' or `id` in(select a.`mid` from `[Q]plans` a left join `[Q]planm` b on a.`mid`=b.`id` where b.`type`=3 and b.`leixing`='.$mid.' and '.$wher1.')';
  55. if($key)$where.=')';
  56. return 'and `type`=3 and `leixing`='.$mid.''.$where.'';
  57. }
  58. public function collectstotal_after($table, $rows)
  59. {
  60. $dbs = m('plans');
  61. $arows= $this->zdarr;
  62. $mrs = m($table)->getone($this->mid);
  63. if($this->loadci==1){
  64. $farr = array();
  65. if($mrs['fenlei']=='0'){
  66. $farr[] = array(
  67. 'text' => '填写人',
  68. 'dataIndex' => 'optname'
  69. );
  70. }
  71. foreach($arows as $k=>$rs){
  72. $sarr = array(
  73. 'text' => $rs['pitem'],
  74. 'dataIndex' => 'items_'.$rs['id'].'',
  75. 'filestype' => $rs['zxren'],
  76. 'sortable' => false
  77. );
  78. if($rs['zxren']=='uploadfile' || $rs['zxren']=='textarea')$sarr['align']='left';
  79. $farr[] = $sarr;
  80. }
  81. $farr[] = array(
  82. 'text' => '填写时间',
  83. 'dataIndex' => 'optdt',
  84. 'sortable' => true
  85. );
  86. $farr[] = array(
  87. 'text' => '状态',
  88. 'dataIndex' => 'status',
  89. 'sortable' => true
  90. );
  91. $barr['columns'] = $farr;
  92. }
  93. $faobj = m('file');
  94. foreach($rows as $k=>$rs){
  95. $arows= $dbs->getall('mid='.$rs['id'].'','*','`sort`');
  96. foreach($arows as $k1=>$rs1){
  97. $flx = arrvalue($this->zdobj, $rs1['itemid']);
  98. $val = $rs1['zxren'];
  99. if($flx=='uploadimg' && !isempt($val)){
  100. $val = '<img src="'.$val.'" onclick="$.imgview({\'url\':this.src})" height="60">';
  101. }
  102. if($flx=='uploadfile' && !isempt($val)){
  103. $val = $faobj->getstr('', '', 0, "`id` in($val)");
  104. }
  105. $rows[$k]['items_'.$rs1['itemid'].''] = $val;
  106. }
  107. $status = '';
  108. if($rs['status']=='0')$status='<font color=blue>待审核</font>';
  109. if($rs['status']=='1')$status='<font color=green>已审核</font>';
  110. if($rs['status']=='2')$status='<font color=red>未通过</font>';
  111. $rows[$k]['status'] = $status;
  112. }
  113. $barr['rows'] = $rows;
  114. return $barr;
  115. }
  116. }
粤ICP备19079148号