3 * @var \App\View\AppView $this
7 Log::debug('[got into center template]');
9 <nav class="large-3 medium-4 columns" id="actions-sidebar">
11 <li class="heading"><?= __('Actions') ?></li>
12 <li><?= $this->Html->link(__('View Category'), ['action' => 'view', $category->id]) ?></li>
13 <li><?= $this->Html->link(__('Edit Category'), ['action' => 'edit', $category->id]) ?> </li>
14 <li><?= $this->Form->postLink(__('Delete Category'), ['action' => 'delete', $category->id], ['confirm' => __('Are you sure you want to delete # {0}?', $category->id)]) ?> </li>
15 <li><?= $this->Html->link(__('List Categories'), ['action' => 'index']) ?> </li>
16 <li><?= $this->Html->link(__('New Category'), ['action' => 'add']) ?> </li>
19 <div class="categories view large-9 medium-8 columns content">
20 <h3><?= h($category->name) ?></h3>
21 <table class="vertical-table">
23 <th scope="row"><?= __('Name') ?></th>
24 <td><?= h($category->name) ?></td>
27 <th scope="row"><?= __('Map of this Category\'s Locations') ?></th>
30 // dynamic map preparation below.
32 // see if clustering is turned on.
33 $clustering = in_array ( 'clustering', $selectedList );
35 //$this->log("state is: " . $state);
37 // kludgey attempt to focus a little better, based on state size.
39 $medium_state = false;
40 // is the state small?
41 $small_state = ($state == 'DE' || $state == 'RI' || $state == 'NH');
42 // $this->log('small_state=' . var_export($small_state, true));
43 // if not small, we assume medium until told otherwise.
44 if (! $small_state) $medium_state = true;
45 // $this->log('medium_state=' . var_export($medium_state, true));
46 // if certain known fat states, then not medium sized.
47 if ($state == 'TX' || $state == 'CA' || $state == 'AK') $medium_state = false;
48 $zoomFactor = $small_state? 8 : ( $medium_state? 7 : 5 );
49 $this->log('zooming at ' . $zoomFactor);
50 //question: how to pick a more useful zoom factor? maybe record in db a starting zoom factor per state?
52 // list options we want to override or add for the map.
54 // automatically encompass markers and auto-center if they haven't told us where to start.
55 'autoCenter' => ($mapCenter === null)? true : false,
56 'clustering' => $clustering,
57 'zoom' => $zoomFactor,
60 // start at a specified center if one is given.
62 $map_options = array_merge($map_options, $mapCenter);
65 //$this->log('new options set: ' . var_export($map_options, true));
68 // provide the element with all the info it needs to set up the map.
71 'map_options' => $map_options,
72 'map_colors' => 'avmaps/js/sg2_map_colors.js',
73 'the_map' => $this->GoogleMap,
74 // no options to pass to ajax so far...
77 'default_options' => '{
78 json_provider: "/categories.json",
79 iconColor: "' . $this->MapDisplay->defaultIconColor() . '",
83 echo $this->element('Avmaps.google_map', $element_options);
86 // create the basic map framework using google maps api.
87 $this->MapDisplay->setupMap ( $map_options, $this->GoogleMap );
89 // plug in our chosen color scheme for land, roads, etc.
90 $this->MapDisplay->applyColors ( 'avmaps/js/sg2_map_colors.js' );
92 // after the intial configuration items are done, we can emit the map code.
93 // we can still add markers after this point, and do so below.
94 $this->MapDisplay->emitMap ( false );
96 // we were handed a list of locations that match our query, so we can now add them as markers.
97 $this->MapDisplay->addMarkersInCategory ( $locationsInCategory, $category );
99 // set up our event handler for this view.
100 // $this->MapDisplay->injectJSFile('avmaps/js/event_trappers.js');
102 // now we think we are ready to go. let's get the map displayed.
103 $this->MapDisplay->finallyDisplayMap ();
106 // end of dynamic map preparation.
112 <th scope="row"><?= __('View Options') ?></th>
114 <?= $this->Form->create($category) ?>
116 echo $this->Form->control ( 'view_options._ids', [
119 'val' => $selectedList,
121 'clustering' => 'clustering'
126 <?= $this->Form->button(__('Modify View')) ?>
127 <?= $this->Form->end() ?>