Conditions | 5 |
Paths | 6 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 20 |
CRAP Score | 5 |
1 | <?php |
||
17 | 2 | public function getCMSFields() |
|
18 | { |
||
19 | 2 | $fields = parent::getCMSFields(); |
|
20 | 2 | $fields->addFieldToTab('Root.Main', new TextField('Name', 'Name of the item on the map')); |
|
21 | |||
22 | 2 | $layers = $this->PointsOfInterestLayers(); |
|
23 | 2 | $ids = array(); |
|
24 | 2 | foreach ($layers->getIterator() as $layer) { |
|
25 | 1 | array_push($ids, $layer->ID); |
|
26 | 1 | if ($layer->ShowGuideMarkers) { |
|
27 | 1 | $this->ShowGuideMarkers = true; |
|
28 | 1 | } |
|
29 | 2 | } |
|
30 | 2 | $csv = implode(',', $ids); |
|
31 | |||
32 | 2 | if ($this->ShowGuideMarkers && strlen($csv) > 0) { |
|
33 | 1 | $sql = 'ID IN (SELECT DISTINCT PointOfInterestID from '; |
|
34 | 1 | $sql .= 'PointsOfInterestLayer_PointsOfInterest WHERE PointsOfInterestLayerID '; |
|
35 | 1 | $sql .= "IN ($csv))"; |
|
36 | |||
37 | 1 | $pois = self::get()->where($sql); |
|
38 | 1 | $this->owner->getMapField()->setGuidePoints($pois); |
|
39 | 1 | } |
|
40 | |||
41 | 2 | return $fields; |
|
42 | } |
||
43 | } |
||
44 |