summaryrefslogtreecommitdiff
path: root/protected/views/standort
diff options
context:
space:
mode:
Diffstat (limited to 'protected/views/standort')
-rw-r--r--protected/views/standort/_search.php39
-rw-r--r--protected/views/standort/index.php77
-rw-r--r--protected/views/standort/view.php67
3 files changed, 183 insertions, 0 deletions
diff --git a/protected/views/standort/_search.php b/protected/views/standort/_search.php
new file mode 100644
index 0000000..eeab539
--- /dev/null
+++ b/protected/views/standort/_search.php
@@ -0,0 +1,39 @@
+<div class="wide form">
+
+<?php $form=$this->beginWidget('CActiveForm', array(
+ 'action'=>Yii::app()->createUrl($this->route),
+ 'method'=>'get',
+)); ?>
+
+ <div class="row">
+ <?php echo $form->label($model,'id'); ?>
+ <?php echo $form->textField($model,'id'); ?>
+ </div>
+
+ <div class="row">
+ <?php echo $form->label($model,'name'); ?>
+ <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>80)); ?>
+ </div>
+
+ <div class="row">
+ <?php echo $form->label($model,'pos_lat'); ?>
+ <?php echo $form->textField($model,'pos_lat'); ?>
+ </div>
+
+ <div class="row">
+ <?php echo $form->label($model,'pos_long'); ?>
+ <?php echo $form->textField($model,'pos_long'); ?>
+ </div>
+
+ <div class="row">
+ <?php echo $form->label($model,'published'); ?>
+ <?php echo $form->checkbox($model,'published'); ?>
+ </div>
+
+ <div class="row buttons">
+ <?php echo CHtml::submitButton('Search'); ?>
+ </div>
+
+<?php $this->endWidget(); ?>
+
+</div><!-- search-form --> \ No newline at end of file
diff --git a/protected/views/standort/index.php b/protected/views/standort/index.php
new file mode 100644
index 0000000..9a88a74
--- /dev/null
+++ b/protected/views/standort/index.php
@@ -0,0 +1,77 @@
+<?php
+$this->breadcrumbs=array(
+ 'Standorte'
+);
+
+$this->menu=array(
+ array('label'=>'Standort erstellen', 'url'=>array('create')),
+);
+?>
+
+<h1>Standorte</h1>
+
+<?php $this->renderPartial('/common/_comparison_text'); ?>
+
+<?php $this->renderPartial('/common/_advanced_search',array(
+ 'model'=>$model,
+)); ?>
+
+<?php
+$map = new Map();
+foreach ($standorte as $standort) {
+ $infoWindow = new EGMapInfoWindow("<div class='gmaps-label' style='color: #000; font-weight:bold'>".$standort->name."<br/>".CHtml::link("Bearbeiten", array("standort/update", "id"=>$standort->id), array("update"=>"#edit"))."</div>");
+ $dragendfunction = "function (event) {
+ var save = confirm('Neue Koordinaten wirklich speichern?');
+ if (save) {
+ $.ajax({
+ 'type':'POST',
+ 'url':'".$this->createUrl('standort/savecoords', array('id'=>$standort->id))."',
+ 'data':({'lat': event.latLng.lat(), 'lng': event.latLng.lng()}),
+ 'cache':false,
+ 'statusCode': {
+ 404: function() {
+ alert('Der Standort existiert nicht.');
+ },
+ 500: function() {
+ alert('Fehler beim Speichern.');
+ },
+ 400: function() {
+ alert('Fehlende Parameter');
+ },
+ 200: function() {
+ alert('Neue Koordinaten erfolgreich gespeichert');
+ }
+ }
+ });
+ }
+ console.info(event)
+ }
+ ";
+ // Saving coordinates after user dragged our marker.
+ $dragevent = new EGMapEvent('dragend', $dragendfunction, false, EGMapEvent::TYPE_EVENT_DEFAULT);
+ $marker = new EGMapMarker($standort->pos_lat, $standort->pos_long, array('title' => $model->name, 'draggable'=>true), 'marker', array('dragevent'=>$dragevent));
+ $marker->addHtmlInfoWindow($infoWindow);
+ $map->addMarker($marker, $standort->published);
+}
+$map->render();
+?>
+
+<?php $this->widget('zii.widgets.grid.CGridView', array(
+ 'id'=>'standort-grid',
+ 'dataProvider'=>$model->search(),
+ 'filter'=>$model,
+ 'columns'=>array(
+ 'type',
+ 'name',
+ 'pos_lat',
+ 'pos_long',
+ array('header'=>'Ă–ffentlich',
+ 'value'=>'CHtml::image($data->published ? "images/ok.png" : "images/nok.png", $data->published ? "ok.png" : "nok.png")', 'type'=>'raw'),
+ array(
+ 'class'=>'CButtonColumn',
+ 'template'=>'{update} {delete}'
+ ),
+ ),
+)); ?>
+
+
diff --git a/protected/views/standort/view.php b/protected/views/standort/view.php
new file mode 100644
index 0000000..26312a3
--- /dev/null
+++ b/protected/views/standort/view.php
@@ -0,0 +1,67 @@
+<?php
+$this->breadcrumbs=array(
+ 'Speis & Trank'=>array('index'),
+ $model->name,
+);
+
+$this->menu=array(
+ array('label'=>'Standorte', 'url'=>array('index')),
+ array('label'=>'Standort erstellen', 'url'=>array('create')),
+ array('label'=>$model->name.' bearbeiten', 'url'=>array('update', 'id'=>$model->id)),
+ array('label'=>$model->name.' löschen', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
+);
+?>
+
+<h3>Standort "<?php echo $model->name ?>"</h3>
+<p>
+<?php Yii::import('ext.egmap.*');
+
+$gMap = new EGMap();
+$gMap->zoom = 20;
+$mapTypeControlOptions = array(
+ 'position'=> EGMapControlPosition::LEFT_BOTTOM,
+ 'style'=>EGMap::MAPTYPECONTROL_STYLE_DROPDOWN_MENU
+);
+
+$gMap->width = '100%';
+$gMap->setOptions(array("mapTypeId"=>EGMap::TYPE_HYBRID));
+$gMap->mapTypeControlOptions= $mapTypeControlOptions;
+
+$gMap->setCenter($model->pos_lat, $model->pos_long);
+$info_window_a = new EGMapInfoWindow('<div>'.$model->name.'</div>');
+$icon = new EGMapMarkerImage("http://google-maps-icons.googlecode.com/files/gazstation.png");
+
+$icon->setSize(32, 37);
+$icon->setAnchor(16, 16.5);
+$icon->setOrigin(0, 0);
+$marker = new EGMapMarkerWithLabel($model->pos_lat, $model->pos_long, array('title' => $model->name,'icon'=> $icon));
+$marker->draggable=false;
+$marker->raiseOnDrag= true;
+$marker->addHtmlInfoWindow($info_window_a);
+
+$gMap->addMarker($marker);
+
+// enabling marker clusterer just for fun
+// to view it zoom-out the map
+$gMap->enableMarkerClusterer(new EGMapMarkerClusterer());
+
+$gMap->renderMap();
+?>
+</p>
+<p>
+<?php
+$dataProvider=new CActiveDataProvider('Verein', array(
+ 'criteria'=>array(
+ 'condition'=>'standort_id='.$model->id,
+ ),
+ 'pagination'=>array(
+ 'pageSize'=>20,
+ ),
+));
+$this->widget('zii.widgets.CListView', array(
+ 'dataProvider'=>$dataProvider,
+ 'itemView'=>'/verein/_short',
+
+ ));?>
+
+</p> \ No newline at end of file