@@ -45,10 +45,8 @@ |
||
45 | 45 | * |
46 | 46 | * Proxies to {@link get()} |
47 | 47 | * |
48 | - * @param string|array $elementsFieldset |
|
49 | - * @param null|string $buttonsFieldset |
|
50 | 48 | * |
51 | - * @return \Core\Form\TextSearchForm |
|
49 | + * @return \Core\Form\SearchForm |
|
52 | 50 | */ |
53 | 51 | public function __invoke($form, $options = null) |
54 | 52 | { |
@@ -69,11 +69,11 @@ |
||
69 | 69 | public function get($form, $options = null) |
70 | 70 | { |
71 | 71 | if (!is_object($form)) { |
72 | - $form = $this->formElementManager->get($form, $options); |
|
72 | + $form = $this->formElementManager->get($form, $options); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** @noinspection PhpUndefinedMethodInspection */ |
76 | - $params = $this->getController()->getRequest()->getQuery()->toArray(); |
|
76 | + $params = $this->getController()->getRequest()->getQuery()->toArray(); |
|
77 | 77 | |
78 | 78 | $form->setSearchParams($params); |
79 | 79 | return $form; |
@@ -83,6 +83,11 @@ |
||
83 | 83 | return $content; |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @param FormInterface $form |
|
88 | + * |
|
89 | + * @return null|FormInterface |
|
90 | + */ |
|
86 | 91 | public function renderElements($form, $colMap = null, $buttonsSpan = null) |
87 | 92 | { |
88 | 93 | if ($form instanceOf ViewPartialProviderInterface) { |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | $content = $this->renderElements($form, $colMap, $buttonsSpan); |
67 | 67 | |
68 | 68 | return $this->openTag($form) |
69 | - . '<div class="row" style="padding: 0 15px;">' |
|
70 | - . $content . '</div>' . $this->closeTag(); |
|
69 | + . '<div class="row" style="padding: 0 15px;">' |
|
70 | + . $content . '</div>' . $this->closeTag(); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | |
110 | 110 | if ($element->getName() == $form->getButtonElement()) { |
111 | 111 | $content.='<div class="input-group col-md-' . $cols . '">' |
112 | - . $formElement($element) |
|
113 | - . '<div class="input-group-btn search-form-buttons" style="width: 0px;">' |
|
114 | - . $this->renderButtons($form->getButtons()) . '</div>' |
|
115 | - . '</div>'; |
|
112 | + . $formElement($element) |
|
113 | + . '<div class="input-group-btn search-form-buttons" style="width: 0px;">' |
|
114 | + . $this->renderButtons($form->getButtons()) . '</div>' |
|
115 | + . '</div>'; |
|
116 | 116 | $buttonsRendered = true; |
117 | 117 | } else { |
118 | 118 | $content .= '<div class="input-group col-md-' . $cols . '">' |
119 | - . $formElement($element) |
|
120 | - . '</div>'; |
|
119 | + . $formElement($element) |
|
120 | + . '</div>'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $i += 1; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $buttonsSpan = $form->getOption('buttons_span') ?: 12; |
129 | 129 | } |
130 | 130 | $content .= '<div class="input-group search-form-buttons col-md-' . $buttonsSpan . ' text-right">' |
131 | - . '<div class="btn-group">' . $this->renderButtons($form->getButtons()) .'</div></div>'; |
|
131 | + . '<div class="btn-group">' . $this->renderButtons($form->getButtons()) .'</div></div>'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $content; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $colMap |
35 | 35 | * @return Form|string |
36 | 36 | */ |
37 | - public function __invoke(FormInterface $form = null, $colMap=null) |
|
37 | + public function __invoke(FormInterface $form = null, $colMap = null) |
|
38 | 38 | { |
39 | 39 | if (!$form) { |
40 | 40 | return $this; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | return $this->render($form, $colMap); |
44 | 44 | } |
45 | 45 | |
46 | - public function render(FormInterface $form, $colMap=null, $buttonsSpan = null) |
|
46 | + public function render(FormInterface $form, $colMap = null, $buttonsSpan = null) |
|
47 | 47 | { |
48 | 48 | $headscript = $this->getView()->plugin('headscript'); |
49 | 49 | $basepath = $this->getView()->plugin('basepath'); |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | $form->prepare(); |
61 | 61 | |
62 | 62 | if ($form instanceOf ViewPartialProviderInterface) { |
63 | - return $this->getView()->partial($form->getViewPartial(), [ 'element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan ]); |
|
63 | + return $this->getView()->partial($form->getViewPartial(), ['element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan]); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $content = $this->renderElements($form, $colMap, $buttonsSpan); |
67 | 67 | |
68 | 68 | return $this->openTag($form) |
69 | 69 | . '<div class="row" style="padding: 0 15px;">' |
70 | - . $content . '</div>' . $this->closeTag(); |
|
70 | + . $content.'</div>'.$this->closeTag(); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $content = ''; |
79 | 79 | foreach ($buttons as $button) { |
80 | - $content.= $helper($button); |
|
80 | + $content .= $helper($button); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return $content; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function renderElements($form, $colMap = null, $buttonsSpan = null) |
87 | 87 | { |
88 | 88 | if ($form instanceOf ViewPartialProviderInterface) { |
89 | - return $this->getView()->partial($form->getViewPartial(), [ 'element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan ]); |
|
89 | + return $this->getView()->partial($form->getViewPartial(), ['element' => $form, 'colMap' => $colMap, 'buttonsSpan' => $buttonsSpan]); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if (null === $colMap) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $formElement = $this->getView()->plugin('formElement'); |
97 | - $content = ''; $buttonsRendered = false; $i=0; |
|
97 | + $content = ''; $buttonsRendered = false; $i = 0; |
|
98 | 98 | foreach ($form as $element) { |
99 | 99 | |
100 | 100 | if (isset($colMap[$element->getName()])) { |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | if ($element->getName() == $form->getButtonElement()) { |
111 | - $content.='<div class="input-group col-md-' . $cols . '">' |
|
111 | + $content .= '<div class="input-group col-md-'.$cols.'">' |
|
112 | 112 | . $formElement($element) |
113 | 113 | . '<div class="input-group-btn search-form-buttons" style="width: 0px;">' |
114 | - . $this->renderButtons($form->getButtons()) . '</div>' |
|
114 | + . $this->renderButtons($form->getButtons()).'</div>' |
|
115 | 115 | . '</div>'; |
116 | 116 | $buttonsRendered = true; |
117 | 117 | } else { |
118 | - $content .= '<div class="input-group col-md-' . $cols . '">' |
|
118 | + $content .= '<div class="input-group col-md-'.$cols.'">' |
|
119 | 119 | . $formElement($element) |
120 | 120 | . '</div>'; |
121 | 121 | } |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | if (null === $buttonsSpan) { |
128 | 128 | $buttonsSpan = $form->getOption('buttons_span') ?: 12; |
129 | 129 | } |
130 | - $content .= '<div class="input-group search-form-buttons col-md-' . $buttonsSpan . ' text-right">' |
|
131 | - . '<div class="btn-group">' . $this->renderButtons($form->getButtons()) .'</div></div>'; |
|
130 | + $content .= '<div class="input-group search-form-buttons col-md-'.$buttonsSpan.' text-right">' |
|
131 | + . '<div class="btn-group">'.$this->renderButtons($form->getButtons()).'</div></div>'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $content; |
@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | protected $cache; |
37 | 37 | |
38 | 38 | |
39 | + /** |
|
40 | + * @param string $uri |
|
41 | + */ |
|
39 | 42 | public function __construct($uri, $cache = false) |
40 | 43 | { |
41 | 44 | $this->client = $this->setupClient($uri); |
@@ -90,6 +93,9 @@ discard block |
||
90 | 93 | return isset($result[0]) ? $result[0] : false; |
91 | 94 | } |
92 | 95 | |
96 | + /** |
|
97 | + * @param string $result |
|
98 | + */ |
|
93 | 99 | protected function processResult($result) |
94 | 100 | { |
95 | 101 | return $result; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | |
70 | 70 | $response = $this->client->send(); |
71 | 71 | if ($response->getStatusCode() !== 200) { |
72 | - throw new \RuntimeException('Query failed, because ' . $response->getReasonPhrase()); |
|
72 | + throw new \RuntimeException('Query failed, because '.$response->getReasonPhrase()); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $result = $response->getBody(); |
@@ -41,7 +41,6 @@ |
||
41 | 41 | * Construct the jobboard controller |
42 | 42 | * |
43 | 43 | * @param Repository\Job $jobRepository |
44 | - * @param ListFilter $searchForm |
|
45 | 44 | */ |
46 | 45 | public function __construct(Repository\Job $jobRepository) |
47 | 46 | { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | ), |
56 | 56 | 'attributes' => [ |
57 | 57 | 'value' => '10', // default distance |
58 | - 'data-searchbox' => -1, // hide the search box |
|
58 | + 'data-searchbox' => -1, // hide the search box |
|
59 | 59 | 'data-allowclear' => 'false', // allow to clear a selected value |
60 | 60 | 'data-placeholder' => /*@translate*/ 'Distance', |
61 | 61 | ] |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if (isset($this->value['location']->coordinates)) { |
86 | 86 | $coordinates = $this->value['location']->coordinates->getCoordinates(); |
87 | - $queryBuilder->field('locations.coordinates')->geoWithinCenter($coordinates[0], $coordinates[1], (float) $this->value['d']/100); |
|
87 | + $queryBuilder->field('locations.coordinates')->geoWithinCenter($coordinates[0], $coordinates[1], (float) $this->value['d'] / 100); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if (isset($params['l'])) { |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | if (0 === strpos($location, 'c:')) { |
93 | 93 | $coords = substr($location, 2); |
94 | 94 | $coords = explode(':', $coords); |
95 | - $queryBuilder->field('locations.coordinates')->geoWithinCenter((float) $coords[0], (float) $coords[1], (float) $this->value['d']/100); |
|
95 | + $queryBuilder->field('locations.coordinates')->geoWithinCenter((float) $coords[0], (float) $coords[1], (float) $this->value['d'] / 100); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if (isset($params['channel']) && !empty($params['channel']) && $params['channel']!="default" ){ |
|
99 | + if (isset($params['channel']) && !empty($params['channel']) && $params['channel'] != "default") { |
|
100 | 100 | $queryBuilder->field('portals')->equals($params['channel']); |
101 | 101 | } |
102 | 102 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | 'label' => $label, |
168 | 168 | ], |
169 | 169 | 'attributes' => [ |
170 | - 'class' => 'btn btn-' . ('submit' == $type ? 'primary' : 'default'), |
|
170 | + 'class' => 'btn btn-'.('submit' == $type ? 'primary' : 'default'), |
|
171 | 171 | 'type' => $type, |
172 | 172 | ], |
173 | 173 | ] |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $result = json_decode($result, JSON_OBJECT_AS_ARRAY); |
42 | 42 | |
43 | - $r=[]; |
|
43 | + $r = []; |
|
44 | 44 | foreach ($result["result"] as $val) { |
45 | 45 | $coords = $this->queryCoords($val); |
46 | 46 | if (false !== strpos($val, ',')) { |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | 'state' => $state, |
58 | 58 | 'coordinates' => $coords, |
59 | 59 | 'id' => $coords |
60 | - ? 'c:' . $coords[0] . ':' . $coords[1] |
|
61 | - : 'q:' . $val, |
|
60 | + ? 'c:'.$coords[0].':'.$coords[1] |
|
61 | + : 'q:'.$val, |
|
62 | 62 | 'data' => json_encode($val), |
63 | 63 | ]; |
64 | 64 | } |
@@ -78,6 +78,6 @@ discard block |
||
78 | 78 | $coord = $result["result"][0]; |
79 | 79 | $coord = explode(',', $coord); |
80 | 80 | |
81 | - return [str_replace('.', ',', $coord[1]), str_replace('.',',',$coord[0])]; |
|
81 | + return [str_replace('.', ',', $coord[1]), str_replace('.', ',', $coord[0])]; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -62,16 +62,16 @@ |
||
62 | 62 | $r=[]; |
63 | 63 | foreach ($result as $key => $val) { |
64 | 64 | $row=['name' => (property_exists($val->properties, 'name') ? $val->properties->name:''), |
65 | - 'postcode' => (property_exists($val->properties, 'postcode') ? $val->properties->postcode:''), |
|
66 | - 'city' =>(property_exists($val->properties, 'city') ? $val->properties->city:''), |
|
67 | - 'street' => (property_exists($val->properties, 'street') ? $val->properties->street : ''), |
|
68 | - 'state' => (property_exists($val->properties, 'state') ? $val->properties->state : ''), |
|
69 | - 'country' => (property_exists($val->properties, 'country') ? $val->properties->country : ''), |
|
70 | - 'coordinates' => $val->geometry->coordinates, |
|
71 | - 'osm_key' => (property_exists($val->properties, 'osm_key') ? $val->properties->osm_key : ''), |
|
72 | - 'osm_value' => (property_exists($val->properties, 'osm_value') ? $val->properties->osm_value : ''), |
|
73 | - //'id' => (property_exists($val->properties, 'osm_id') ? $val->properties->osm_id : uniqid()), |
|
74 | - 'data' => json_encode($val), |
|
65 | + 'postcode' => (property_exists($val->properties, 'postcode') ? $val->properties->postcode:''), |
|
66 | + 'city' =>(property_exists($val->properties, 'city') ? $val->properties->city:''), |
|
67 | + 'street' => (property_exists($val->properties, 'street') ? $val->properties->street : ''), |
|
68 | + 'state' => (property_exists($val->properties, 'state') ? $val->properties->state : ''), |
|
69 | + 'country' => (property_exists($val->properties, 'country') ? $val->properties->country : ''), |
|
70 | + 'coordinates' => $val->geometry->coordinates, |
|
71 | + 'osm_key' => (property_exists($val->properties, 'osm_key') ? $val->properties->osm_key : ''), |
|
72 | + 'osm_value' => (property_exists($val->properties, 'osm_value') ? $val->properties->osm_value : ''), |
|
73 | + //'id' => (property_exists($val->properties, 'osm_id') ? $val->properties->osm_id : uniqid()), |
|
74 | + 'data' => json_encode($val), |
|
75 | 75 | ]; |
76 | 76 | $row['id'] = 'c:' . (float) $row['coordinates'][0] . ':' . (float) $row['coordinates'][1]; |
77 | 77 | $r[]=$row; |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | $client->setMethod('GET'); |
29 | 29 | |
30 | 30 | $osmTags = [ |
31 | - 'tourism','aeroway','railway', 'amenity', 'historic', 'tunnel', 'mountain_pass', |
|
31 | + 'tourism', 'aeroway', 'railway', 'amenity', 'historic', 'tunnel', 'mountain_pass', |
|
32 | 32 | 'leisure', 'natural', 'bridge', 'waterway' |
33 | 33 | ]; |
34 | 34 | |
35 | - $osmTags = array_map(function($i) { return urlencode('!' . $i); }, $osmTags); |
|
35 | + $osmTags = array_map(function($i) { return urlencode('!'.$i); }, $osmTags); |
|
36 | 36 | |
37 | 37 | $uri = sprintf( |
38 | 38 | '%s?osm_tag=%s', |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | { |
60 | 60 | $result = json_decode($result); |
61 | 61 | $result = $result->features; |
62 | - $r=[]; |
|
62 | + $r = []; |
|
63 | 63 | foreach ($result as $key => $val) { |
64 | - $row=['name' => (property_exists($val->properties, 'name') ? $val->properties->name:''), |
|
65 | - 'postcode' => (property_exists($val->properties, 'postcode') ? $val->properties->postcode:''), |
|
66 | - 'city' =>(property_exists($val->properties, 'city') ? $val->properties->city:''), |
|
64 | + $row = ['name' => (property_exists($val->properties, 'name') ? $val->properties->name : ''), |
|
65 | + 'postcode' => (property_exists($val->properties, 'postcode') ? $val->properties->postcode : ''), |
|
66 | + 'city' =>(property_exists($val->properties, 'city') ? $val->properties->city : ''), |
|
67 | 67 | 'street' => (property_exists($val->properties, 'street') ? $val->properties->street : ''), |
68 | 68 | 'state' => (property_exists($val->properties, 'state') ? $val->properties->state : ''), |
69 | 69 | 'country' => (property_exists($val->properties, 'country') ? $val->properties->country : ''), |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | //'id' => (property_exists($val->properties, 'osm_id') ? $val->properties->osm_id : uniqid()), |
74 | 74 | 'data' => json_encode($val), |
75 | 75 | ]; |
76 | - $row['id'] = 'c:' . (float) $row['coordinates'][0] . ':' . (float) $row['coordinates'][1]; |
|
77 | - $r[]=$row; |
|
76 | + $row['id'] = 'c:'.(float) $row['coordinates'][0].':'.(float) $row['coordinates'][1]; |
|
77 | + $r[] = $row; |
|
78 | 78 | } |
79 | 79 | return $r; |
80 | 80 | } |