@@ -20,10 +20,68 @@ class IpAddressRangesController extends AppController
2020 */
2121 public function index ()
2222 {
23- $ this ->paginate = [
24- 'contain ' => ['AccessPoints ' , 'ParentIpAddressRanges ' ],
23+ $ ipAddressRanges = $ this ->IpAddressRanges ->find ('all ' , [
24+ 'contain ' => [
25+ 'AccessPoints ' ,
26+ 'ParentIpAddressRanges ' ,
27+ ],
28+ ])->all ();
29+
30+ $ this ->set (compact ('ipAddressRanges ' ));
31+ $ this ->viewBuilder ()->setOption ('serialize ' , ['ipAddressRanges ' ]);
32+ }
33+
34+ /**
35+ * Search method
36+ *
37+ * @property \App\Model\Table\IpAddressRangesTable $IpAddressRanges
38+ * @return \Cake\Http\Response|null|void Renders view
39+ */
40+ public function search ()
41+ {
42+ $ options = [
43+ 'contain ' => [
44+ 'AccessPoints ' ,
45+ 'ParentIpAddressRanges ' ,
46+ ],
2547 ];
26- $ ipAddressRanges = $ this ->paginate ($ this ->IpAddressRanges );
48+
49+ if ($ this ->request ->getQuery ('access_point_id ' ) !== null ) {
50+ $ options ['conditions ' ]['IpAddressRanges.access_point_id ' ] = $ this ->request ->getQuery ('access_point_id ' );
51+ }
52+ if ($ this ->request ->getQuery ('for_subnets ' ) !== null ) {
53+ $ options ['conditions ' ]['IpAddressRanges.for_subnets ' ] = $ this ->request ->getQuery ('for_subnets ' );
54+ }
55+ if ($ this ->request ->getQuery ('for_customer_addresses_set_via_radius ' ) !== null ) {
56+ $ options ['conditions ' ]['IpAddressRanges.for_customer_addresses_set_via_radius ' ]
57+ = $ this ->request ->getQuery ('for_customer_addresses_set_via_radius ' );
58+ }
59+ if ($ this ->request ->getQuery ('for_customer_addresses_set_manually ' ) !== null ) {
60+ $ options ['conditions ' ]['IpAddressRanges.for_customer_addresses_set_manually ' ]
61+ = $ this ->request ->getQuery ('for_customer_addresses_set_manually ' );
62+ }
63+ if ($ this ->request ->getQuery ('for_technology_addresses_set_manually ' ) !== null ) {
64+ $ options ['conditions ' ]['IpAddressRanges.for_technology_addresses_set_manually ' ]
65+ = $ this ->request ->getQuery ('for_technology_addresses_set_manually ' );
66+ }
67+ if ($ this ->request ->getQuery ('for_customer_networks_set_via_radius ' ) !== null ) {
68+ $ options ['conditions ' ]['IpAddressRanges.for_customer_networks_set_via_radius ' ]
69+ = $ this ->request ->getQuery ('for_customer_networks_set_via_radius ' );
70+ }
71+ if ($ this ->request ->getQuery ('for_customer_networks_set_manually ' ) !== null ) {
72+ $ options ['conditions ' ]['IpAddressRanges.for_customer_networks_set_manually ' ]
73+ = $ this ->request ->getQuery ('for_customer_networks_set_manually ' );
74+ }
75+ if ($ this ->request ->getQuery ('for_technology_networks_set_manually ' ) !== null ) {
76+ $ options ['conditions ' ]['IpAddressRanges.for_technology_networks_set_manually ' ]
77+ = $ this ->request ->getQuery ('for_technology_networks_set_manually ' );
78+ }
79+
80+ if ($ this ->request ->getQuery ('ip_address ' ) !== null ) {
81+ $ options ['conditions ' ]['IpAddressRanges.ip_network >>= ' ] = $ this ->request ->getQuery ('ip_address ' );
82+ }
83+
84+ $ ipAddressRanges = $ this ->IpAddressRanges ->find ('all ' , $ options );
2785
2886 $ this ->set (compact ('ipAddressRanges ' ));
2987 $ this ->viewBuilder ()->setOption ('serialize ' , ['ipAddressRanges ' ]);
0 commit comments