mode_dcs_authAction.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * 此文件是流程模块【dcs_auth.查看权限】对应控制器接口文件。
  4. */
  5. class mode_dcs_authClassAction 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. }
  16. /**
  17. * 重写函数:保存后处理,主要保存其他表数据
  18. * $table String 对应表名
  19. * $arr Array 表单参数
  20. * $id Int 对应表上记录Id
  21. * $addbo Boolean 是否添加时
  22. */
  23. protected function saveafter($table, $arr, $id, $addbo){
  24. }
  25. public function getGroup()
  26. {
  27. $groupArr = m('dcs_group')->getall('1=1 and pid != 0');
  28. $arr = [];
  29. $html = '<span id="div_range" class="divinput">';
  30. for ($i = 0; $i < count($groupArr); $i++) {
  31. $group = $groupArr[$i];
  32. $arr[] = array("name"=>$group['name'],"value"=>$group['id']);
  33. $html .= '<label><input name="range_set[]" value="'.$group['id'].'" type="checkbox">'.$group['name'].'<br></label>';
  34. }
  35. $html .= '</span>';
  36. // new
  37. $rows = m('dcs_group')->getall('1=1');
  38. $newRowArr = [];
  39. $html = '';
  40. for ($i = 0; $i < count($rows); $i++) {
  41. $row = $rows[$i];
  42. if ($row['pid'] == 0) {
  43. // 一级
  44. $newRowArr[] = $row;
  45. $html .= "<label class='group_name'>".$row['name']."</label><br>";
  46. $html .= '<span class="group_box">';
  47. // 找二级
  48. for ($j = 0; $j <count($rows); $j++) {
  49. $crow = $rows[$j];
  50. if ($crow['pid'] == $row['id']) {
  51. $newRowArr[] = $crow;
  52. $html .= '<label class="group_box_label"><input name="range_set[]" value="'.$crow['id'].'" type="checkbox">'.$crow['name'].' </label>';
  53. }
  54. }
  55. $html .= '</span><br><div style="height:1px;background-color:#ddd;"></div>';
  56. }
  57. }
  58. return $html;
  59. }
  60. }