1
0

mode_flowelementAction.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /**
  3. * 此文件是流程模块【flowelement.表单元素管理】对应控制器接口文件。
  4. */
  5. class mode_flowelementClassAction extends inputAction{
  6. public $pobj;
  7. protected function savebefore($table, $arr, $id, $addbo){
  8. include_once('webmain/main/flow/flowAction.php');
  9. $this->pobj = new flowClassAction();
  10. $strs= $this->pobj->elemensavefieldsbefore($table, $arr, $id);
  11. if($strs)return $strs;
  12. $rows = array();
  13. if($arr['zdsm'])$rows['zdsm'] = htmlspecialchars_decode($arr['zdsm']);
  14. return array(
  15. 'rows' => $rows
  16. );
  17. }
  18. protected function saveafter($table, $arr, $id, $addbo){
  19. $this->pobj->elemensavefields($table, $arr);
  20. }
  21. public function iszbdata()
  22. {
  23. $mkid = (int)$this->get('mkid','0');
  24. $mid = (int)$this->get('mid','0');
  25. $mkrs = array();
  26. $talbe = '';
  27. if($mid>0){
  28. $mkid = m('flow_element')->getmou('mid', $mid);
  29. }
  30. if($mkid){
  31. $mkrs = m('flow_set')->getone($mkid);
  32. $talbe = $mkrs['table'];
  33. }
  34. $arr[] = array('value'=>'0','name'=>'主表('.$talbe.')字段');
  35. if($mkrs){
  36. $tables = $mkrs['tables'];
  37. $names = $mkrs['names'];
  38. if(!isempt($tables)){
  39. $tablesa = explode(',', $tables);
  40. $namesa = explode(',', $names);
  41. foreach($tablesa as $k=>$v)$arr[] = array('value'=>$k+1,'name'=>'第个'.($k+1).'子表('.arrvalue($namesa, $k).'.'.$v.')字段');
  42. }
  43. }
  44. return $arr;
  45. }
  46. public function attrdata()
  47. {
  48. $arr[] = array('value'=>'readonly','name'=>'只读');
  49. $arr[] = array('value'=>'onlyen','name'=>'不能有中文');
  50. $arr[] = array('value'=>'onlycn','name'=>'必须包含中文');
  51. $arr[] = array('value'=>'maxhang','name'=>'布局占整行');
  52. $arr[] = array('value'=>'email','name'=>'邮件格式');
  53. $arr[] = array('value'=>'mobile','name'=>'中文手机号');
  54. $arr[] = array('value'=>'number','name'=>'必须是数字');
  55. $arr[] = array('value'=>'date','name'=>'必须是日期格式如2020-02-02');
  56. return $arr;
  57. }
  58. public function devdata()
  59. {
  60. $arr[] = array('value'=>'admin','name'=>'{admin}','subname'=>'当前用户姓名');
  61. $arr[] = array('value'=>'deptname','name'=>'{deptname}','subname'=>'当前用户部门');
  62. $arr[] = array('value'=>'uid','name'=>'{uid}','subname'=>'当前用户ID');
  63. $arr[] = array('value'=>'date','name'=>'{date}','subname'=>'当前日期');
  64. $arr[] = array('value'=>'optdt','name'=>'{optdt}','subname'=>'当前时间');
  65. $arr[] = array('value'=>'ranking','name'=>'{urs.ranking}','subname'=>'当前用户职位');
  66. $arr[] = array('value'=>'urs','name'=>'{urs.mobile}','subname'=>'当前用户其他信息字段,mobile改成需要字段名');
  67. return $arr;
  68. }
  69. protected function storeafter($table, $rows)
  70. {
  71. $mkid = (int)$this->post('mkid','0');
  72. $mkrs = false;
  73. if($mkid>0)$mkrs = m('flow_set')->getone($mkid);
  74. if($this->loadci>1)return array(
  75. 'rows' => $rows,
  76. 'mkrs' => $mkrs,
  77. );
  78. return array(
  79. 'rows' => $rows,
  80. //'modearr' => m('mode')->getmodearr(),
  81. 'mkrs' => $mkrs,
  82. );
  83. }
  84. public function fieldsstore()
  85. {
  86. $mkid = (int)$this->get('mkid','0');
  87. $iszb = (int)$this->get('iszb','0');
  88. $mkrs = m('flow_set')->getone($mkid);
  89. $table = $mkrs['table'];
  90. $tables = $mkrs['tables'];
  91. if($iszb>0 && !isempt($tables)){
  92. $tablesa = explode(',', $tables);
  93. $table = $tablesa[$iszb-1];
  94. }
  95. $farrs = array();
  96. $farr = $this->db->gettablefields('[Q]'.$table.'');
  97. foreach($farr as $k=>$rs){
  98. $farrs[]= array('value'=>$rs['name'],'name'=>$rs['name'],'subname'=>$rs['explain']);
  99. }
  100. return $farrs;
  101. }
  102. public function modewhereAjax()
  103. {
  104. $modeid = (int)$this->get('modeid','0');
  105. $rows = m('flow_where')->getall("`setid`=".$modeid." AND ifnull(`num`,'')<>''", 'num,name','`sort` asc');
  106. $farr = m('flow_element')->getall("`mid`=".$modeid." and `iszb`=0", 'fields,name','`sort` asc');
  107. return array(
  108. 'wheredata'=>$rows,
  109. 'fieldsarr'=> $farr
  110. );
  111. }
  112. }
粤ICP备19079148号