X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=production%2Fexample_apps%2Fzippy_maps%2Fsrc%2FTemplate%2FCategories%2Fcenter.ctp;fp=production%2Fexample_apps%2Fzippy_maps%2Fsrc%2FTemplate%2FCategories%2Fcenter.ctp;h=ede0b27f981fb98e0c820f491dc893f68f4bc9c7;hb=34d1cb2e8687b826357db1d3821bf9e05cf6f13d;hp=0000000000000000000000000000000000000000;hpb=21f30bb859e6c15393e23ac0e5ef417b82f628a5;p=feisty_meow.git diff --git a/production/example_apps/zippy_maps/src/Template/Categories/center.ctp b/production/example_apps/zippy_maps/src/Template/Categories/center.ctp new file mode 100644 index 00000000..ede0b27f --- /dev/null +++ b/production/example_apps/zippy_maps/src/Template/Categories/center.ctp @@ -0,0 +1,133 @@ + + +
+

name) ?>

+ + + + + + + + + + + + + + + +
name) ?>
+log("state is: " . $state); + + // kludgey attempt to focus a little better, based on state size. + $small_state = false; + $medium_state = false; + // is the state small? + $small_state = ($state == 'DE' || $state == 'RI' || $state == 'NH'); +// $this->log('small_state=' . var_export($small_state, true)); + // if not small, we assume medium until told otherwise. + if (! $small_state) $medium_state = true; +// $this->log('medium_state=' . var_export($medium_state, true)); + // if certain known fat states, then not medium sized. + if ($state == 'TX' || $state == 'CA' || $state == 'AK') $medium_state = false; + $zoomFactor = $small_state? 8 : ( $medium_state? 7 : 5 ); + $this->log('zooming at ' . $zoomFactor); + //question: how to pick a more useful zoom factor? maybe record in db a starting zoom factor per state? + + // list options we want to override or add for the map. + $map_options = [ + // automatically encompass markers and auto-center if they haven't told us where to start. + 'autoCenter' => ($mapCenter === null)? true : false, + 'clustering' => $clustering, + 'zoom' => $zoomFactor, + ]; + + // start at a specified center if one is given. + if ($mapCenter) { + $map_options = array_merge($map_options, $mapCenter); + } + + //$this->log('new options set: ' . var_export($map_options, true)); + + + // provide the element with all the info it needs to set up the map. + $element_options = + [ + 'map_options' => $map_options, + 'map_colors' => 'avmaps/js/sg2_map_colors.js', + 'the_map' => $this->GoogleMap, + // no options to pass to ajax so far... + 'ajax_options' => '{ + }', + 'default_options' => '{ + json_provider: "/categories.json", + iconColor: "' . $this->MapDisplay->defaultIconColor() . '", + }', + ]; + + echo $this->element('Avmaps.google_map', $element_options); + + /* + // create the basic map framework using google maps api. + $this->MapDisplay->setupMap ( $map_options, $this->GoogleMap ); + + // plug in our chosen color scheme for land, roads, etc. + $this->MapDisplay->applyColors ( 'avmaps/js/sg2_map_colors.js' ); + + // after the intial configuration items are done, we can emit the map code. + // we can still add markers after this point, and do so below. + $this->MapDisplay->emitMap ( false ); + + // we were handed a list of locations that match our query, so we can now add them as markers. + $this->MapDisplay->addMarkersInCategory ( $locationsInCategory, $category ); + + // set up our event handler for this view. +// $this->MapDisplay->injectJSFile('avmaps/js/event_trappers.js'); + + // now we think we are ready to go. let's get the map displayed. + $this->MapDisplay->finallyDisplayMap (); + */ + + // end of dynamic map preparation. +?> +
+ Form->create($category) ?> + Form->control ( 'view_options._ids', [ + 'type' => 'select', + 'multiple' => true, + 'val' => $selectedList, + 'options' => [ + 'clustering' => 'clustering' + ] + ] ); + ?> + + Form->button(__('Modify View')) ?> + Form->end() ?> + +
+