AlexeyGfi

ConditionRules

Oct 15th, 2020 (edited)
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. Нужно из полученного через post
  2. Array
  3. (
  4. [0] => Array
  5. (
  6. [controlId] => CondGroup
  7. )
  8.  
  9. [0__0] => Array
  10. (
  11. [controlId] => FilterGroup
  12. )
  13.  
  14. [0__0__0] => Array
  15. (
  16. [controlId] => FILTER_RULE_votes_plus
  17. [logic] => MoreOrEqual
  18. [votes_plus] =>
  19. )
  20.  
  21. [0__0__1] => Array
  22. (
  23. [controlId] => FILTER_RULE_uploads
  24. [logic] => MoreOrEqual
  25. [uploads] =>
  26. )
  27.  
  28. [0__0__2] => Array
  29. (
  30. [controlId] => FILTER_RULE_votes_minus
  31. [logic] => MoreOrEqual
  32. [votes_minus] =>
  33. )
  34.  
  35. [0__1] => Array
  36. (
  37. [controlId] => SortGroup
  38. )
  39.  
  40. [0__1__0] => Array
  41. (
  42. [controlId] => SORT_RULE_comments
  43. [logic] => DESC
  44. )
  45.  
  46. )
  47.  
  48. ====>
  49. Сделать
  50.  
  51. [
  52. 'id' => '0',
  53. 'controlId' => 'FilterGroup',
  54. 'values' => [],
  55. 'children' => [
  56. [
  57. 'id' => '0',
  58. 'controlId' => 'FILTER_RULE_votes_plus',
  59. 'values' => [
  60. 'logic' => 'MoreOrEqual',
  61. 'votes_plus' => 0,
  62. ]
  63. ],
  64. [
  65. 'id' => '1',
  66. 'controlId' => 'FILTER_RULE_uploads',
  67. 'values' => [
  68. 'logic' => 'MoreOrEqual',
  69. 'votes_plus' => 0,
  70. ]
  71. ],
  72. ]
  73. ],
  74.  
  75. [
  76. 'id' => '1',
  77. 'controlId' => 'SortGroup',
  78. 'values' => [],
  79. 'children' => [
  80. [
  81. 'id' => '0',
  82. 'controlId' => 'SORT_RULE_comments',
  83. 'values' => [
  84. 'logic' => 'DESC',
  85. ]
  86. ],
  87. ]
  88. ],
  89.  
  90.  
Advertisement
Add Comment
Please, Sign In to add comment