adding example apps, fixing powerup issues
[feisty_meow.git] / production / example_apps / zippy_maps / src / Template / Categories / map.ctp
1 <?php
2 /**
3  * @var \App\View\AppView $this
4  */
5
6 use Cake\Log\Log;
7 Log::debug('[got into map template]');
8 ?>
9 <nav class="large-3 medium-4 columns" id="actions-sidebar">
10         <ul class="side-nav">
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>
17         </ul>
18 </nav>
19 <div class="categories view large-9 medium-8 columns content">
20         <h3><?= h($category->name) ?></h3>
21         <table class="vertical-table">
22                 <tr>
23                         <th scope="row"><?= __('Name') ?></th>
24                         <td><?= h($category->name) ?></td>
25                 </tr>
26                 <tr>
27                         <th scope="row"><?= __('Map of this Category\'s Locations') ?></th>
28                         <td>
29 <?php
30
31         // dynamic map preparation below.
32         
33         // see if clustering is turned on.
34         $clustering = in_array ( 'clustering', $selectedList );
35         
36         // list options we want to override or add for the map.
37         $map_options = [ 
38                 'autoCenter' => true, // automatically encompass markers.
39                 'clustering' => $clustering,
40         ];
41
42         // provide the element with all the info it needs to set up the map.
43         $element_options = [
44                 'map_options' => $map_options,
45                 'map_colors' => 'avmaps/js/sg2_map_colors.js',
46                 'the_map' => $this->GoogleMap,
47                 // we want to include the category ID when making ajax calls.
48                 'ajax_options' => '{ category: "' . $category->id . '"}',
49                 'default_options' => '{
50                         iconColor: "' . $this->MapDisplay->defaultIconColor() . '",
51                         json_provider: "/categories.json",
52                 }',
53         ];
54         
55         echo $this->element('Avmaps.google_map', $element_options);
56         
57         // end of dynamic map preparation.
58         
59 ?>
60                         </td>
61                 </tr>
62
63                 <tr>
64                         <th scope="row"><?= __('View Options') ?></th>
65                         <td>
66             <?= $this->Form->create($category) ?>
67                         <?php
68                         echo $this->Form->control ( 'view_options._ids', [ 
69                                         'type' => 'select',
70                                         'multiple' => true,
71                                         'val' => $selectedList,
72                                         'options' => [ 
73                                                         'clustering' => 'clustering' 
74                                         ] 
75                         ] );
76                         ?>
77          
78           <?= $this->Form->button(__('Modify View')) ?>
79                  <?= $this->Form->end() ?>
80          
81             </td>
82                 </tr>
83
84         </table>
85 </div>