From ed8e4f88f2877c7bed09662291711b7165e7455f Mon Sep 17 00:00:00 2001
From: ccwn <tzur@ccwn.org>
Date: Sat, 21 Apr 2012 09:52:18 +0200
Subject: =?UTF-8?q?common=20views=20hinzugef=C3=BCgt=20standort=20views=20?=
 =?UTF-8?q?hinzugef=C3=BCgt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 protected/views/common/_advanced_search.php      | 20 ++++++
 protected/views/common/_comparison_text.php      |  4 ++
 protected/views/common/_required_fields_text.php |  1 +
 protected/views/speisTrank/_angebot_vereine.php  |  8 +++
 protected/views/standort/_form.php               | 42 +++++++++++++
 protected/views/standort/_search.php             | 39 ++++++++++++
 protected/views/standort/_view.php               | 24 ++++++++
 protected/views/standort/ajaxform.php            | 26 ++++++++
 protected/views/standort/create.php              | 14 +++++
 protected/views/standort/index.php               | 77 ++++++++++++++++++++++++
 protected/views/standort/update.php              | 15 +++++
 11 files changed, 270 insertions(+)
 create mode 100644 protected/views/common/_advanced_search.php
 create mode 100644 protected/views/common/_comparison_text.php
 create mode 100644 protected/views/common/_required_fields_text.php
 create mode 100644 protected/views/speisTrank/_angebot_vereine.php
 create mode 100644 protected/views/standort/_form.php
 create mode 100644 protected/views/standort/_search.php
 create mode 100644 protected/views/standort/_view.php
 create mode 100644 protected/views/standort/ajaxform.php
 create mode 100644 protected/views/standort/create.php
 create mode 100644 protected/views/standort/index.php
 create mode 100644 protected/views/standort/update.php

diff --git a/protected/views/common/_advanced_search.php b/protected/views/common/_advanced_search.php
new file mode 100644
index 0000000..78d3837
--- /dev/null
+++ b/protected/views/common/_advanced_search.php
@@ -0,0 +1,20 @@
+<?php
+Yii::app()->clientScript->registerScript('search', "
+$('.search-button').click(function(){
+	$('.search-form').toggle();
+	return false;
+});
+$('.search-form form').submit(function(){
+	$.fn.yiiGridView.update('angebot-grid', {
+		data: $(this).serialize()
+	});
+	return false;
+});
+");
+?>
+<?php echo CHtml::link('Erweiterte Suche','#',array('class'=>'search-button')); ?>
+<div class="search-form" style="display:none">
+<?php $this->renderPartial('_search',array(
+	'model'=>$model,
+)); ?>
+</div><!-- search-form -->
\ No newline at end of file
diff --git a/protected/views/common/_comparison_text.php b/protected/views/common/_comparison_text.php
new file mode 100644
index 0000000..f2a0b2c
--- /dev/null
+++ b/protected/views/common/_comparison_text.php
@@ -0,0 +1,4 @@
+<p>
+Die optionale Eingabe von Vergleichsoperatoren (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
+or <b>=</b>) zu Beginn eines Suchwertes dient der Spezifikation, wie der Vergleich erfolgen soll.
+</p>
\ No newline at end of file
diff --git a/protected/views/common/_required_fields_text.php b/protected/views/common/_required_fields_text.php
new file mode 100644
index 0000000..8b2ca71
--- /dev/null
+++ b/protected/views/common/_required_fields_text.php
@@ -0,0 +1 @@
+<p class="note">Mit <span class="required">*</span> gekennzeichnete Felder sind Pflichtfelder.</p>
\ No newline at end of file
diff --git a/protected/views/speisTrank/_angebot_vereine.php b/protected/views/speisTrank/_angebot_vereine.php
new file mode 100644
index 0000000..93c1ebd
--- /dev/null
+++ b/protected/views/speisTrank/_angebot_vereine.php
@@ -0,0 +1,8 @@
+<ul>
+<?php foreach($angebot_vereine as $verein): ?>
+	<li>
+	<?php echo CHtml::link(Verein::model()->findByPk($verein->verein_id)->name, array("/verein/view", "id"=>$verein->verein_id)); ?>
+	<?php echo $verein->menge." ".$verein->einheit?> für <?php echo $verein->preis?>€
+	</li>
+<?php endforeach; ?>
+</ul>
\ No newline at end of file
diff --git a/protected/views/standort/_form.php b/protected/views/standort/_form.php
new file mode 100644
index 0000000..fb17125
--- /dev/null
+++ b/protected/views/standort/_form.php
@@ -0,0 +1,42 @@
+<div class="form">
+
+<?php $form=$this->beginWidget('CActiveForm', array(
+	'id'=>'standort-form',
+	'enableAjaxValidation'=>false,
+)); ?>
+
+	<?php $this->renderPartial('/common/_required_fields_text'); ?>
+
+	<?php echo $form->errorSummary($model); ?>
+
+	<div class="row">
+		<?php echo $form->labelEx($model,'name'); ?>
+		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>80)); ?>
+		<?php echo $form->error($model,'name'); ?>
+	</div>
+
+	<div class="row">
+		<?php echo $form->labelEx($model,'pos_lat'); ?>
+		<?php echo $form->textField($model,'pos_lat'); ?>
+		<?php echo $form->error($model,'pos_lat'); ?>
+	</div>
+
+	<div class="row">
+		<?php echo $form->labelEx($model,'pos_long'); ?>
+		<?php echo $form->textField($model,'pos_long'); ?>
+		<?php echo $form->error($model,'pos_long'); ?>
+	</div>
+
+	<div class="row">
+		<?php echo $form->labelEx($model,'published'); ?>
+		<?php echo $form->checkbox($model,'published'); ?>
+		<?php echo $form->error($model,'published'); ?>
+	</div>
+
+	<div class="row buttons">
+		<?php echo CHtml::submitButton($model->isNewRecord ? 'Erstellen' : 'Speichern'); ?>
+	</div>
+
+<?php $this->endWidget(); ?>
+
+</div><!-- form -->
\ No newline at end of file
diff --git a/protected/views/standort/_search.php b/protected/views/standort/_search.php
new file mode 100644
index 0000000..4f39bd5
--- /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->textField($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/_view.php b/protected/views/standort/_view.php
new file mode 100644
index 0000000..a02c1e3
--- /dev/null
+++ b/protected/views/standort/_view.php
@@ -0,0 +1,24 @@
+<div class="view">
+
+	<b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?>:</b>
+	<?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?>
+	<br />
+
+	<b><?php echo CHtml::encode($data->getAttributeLabel('name')); ?>:</b>
+	<?php echo CHtml::encode($data->name); ?>
+	<br />
+
+	<b><?php echo CHtml::encode($data->getAttributeLabel('pos_lat')); ?>:</b>
+	<?php echo CHtml::encode($data->pos_lat); ?>
+	<br />
+
+	<b><?php echo CHtml::encode($data->getAttributeLabel('pos_long')); ?>:</b>
+	<?php echo CHtml::encode($data->pos_long); ?>
+	<br />
+
+	<b><?php echo CHtml::encode($data->getAttributeLabel('published')); ?>:</b>
+	<?php echo CHtml::encode($data->published); ?>
+	<br />
+
+
+</div>
\ No newline at end of file
diff --git a/protected/views/standort/ajaxform.php b/protected/views/standort/ajaxform.php
new file mode 100644
index 0000000..306ee0a
--- /dev/null
+++ b/protected/views/standort/ajaxform.php
@@ -0,0 +1,26 @@
+<div class="form">
+
+<?php $form=$this->beginWidget('CActiveForm', array(
+		'id'=>'standort-form',
+		'enableAjaxValidation'=>true,
+)); ?>
+
+	<p class="note">Fields with <span class="required">*</span> are required.</p>
+
+	<?php echo $form->errorSummary($model); ?>
+
+	<div class="row">
+		<?php echo $form->labelEx($model,'name'); ?>
+		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>80)); ?>
+		<?php echo $form->error($model,'name'); ?>
+	</div>
+
+	<div class="row buttons">
+		<?php echo CHtml::ajaxSubmitButton($model->isNewRecord ? 'Erstellen' : 'Speichern', 
+											$model->isNewRecord ? array('standort/ajaxcreate') : array('standort/ajaxupdate'),
+											array('update'=>'#absb')); ?>
+	</div>
+
+<?php $this->endWidget(); ?>
+
+</div><!-- form -->
\ No newline at end of file
diff --git a/protected/views/standort/create.php b/protected/views/standort/create.php
new file mode 100644
index 0000000..822faf1
--- /dev/null
+++ b/protected/views/standort/create.php
@@ -0,0 +1,14 @@
+<?php
+$this->breadcrumbs=array(
+	'Standorte'=>array('index'),
+	'Standort erstellen',
+);
+
+$this->menu=array(
+	array('label'=>'Standorte', 'url'=>array('index')),
+);
+?>
+
+<h1>Standort erstellen</h1>
+
+<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
\ 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..5449010
--- /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(
+		'id',
+		'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/update.php b/protected/views/standort/update.php
new file mode 100644
index 0000000..7141792
--- /dev/null
+++ b/protected/views/standort/update.php
@@ -0,0 +1,15 @@
+<?php
+$this->breadcrumbs=array(
+	'Standorte'=>array('index'),
+	'Standort "'.$model->name.'" bearbeiten',
+);
+
+$this->menu=array(
+	array('label'=>'Standorte', 'url'=>array('index')),
+	array('label'=>'Standort erstellen', 'url'=>array('create')),
+);
+?>
+
+<h1>Standort "<?php echo $model->name; ?>" bearbeiten</h1>
+
+<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
\ No newline at end of file
-- 
cgit v1.0-28-g1787

