diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-05-15 21:30:11 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-05-15 21:30:11 +0200 |
| commit | 5759435f4da8ec800ba9af0fbbf7d6691e9ed56c (patch) | |
| tree | a3e6f6c676743e89b11804a03bd4f1e837983be9 | |
| parent | 94bdb31c204cdae3ca820828d4731f11f6ffeeae (diff) | |
diverse Layoutings
27 files changed, 415 insertions, 115 deletions
@@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <buildpath> - <buildpathentry kind="src" path=""/> + <buildpathentry combineaccessrules="false" kind="prj" path="/yii-framework"/> <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/> + <buildpathentry kind="src" path=""/> </buildpath> diff --git a/.settings/org.eclipse.php.core.prefs b/.settings/org.eclipse.php.core.prefs index 9309083..f5f8323 100644 --- a/.settings/org.eclipse.php.core.prefs +++ b/.settings/org.eclipse.php.core.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -include_path=0;/www.astaf.de +include_path=0;/www.astaf.de\u00052;/yii-framework diff --git a/images/map/marker_green_32.png b/images/map/marker_green_32.png Binary files differnew file mode 100644 index 0000000..3b98b1f --- /dev/null +++ b/images/map/marker_green_32.png diff --git a/images/map/marker_red_32.png b/images/map/marker_red_32.png Binary files differnew file mode 100644 index 0000000..6a19e8c --- /dev/null +++ b/images/map/marker_red_32.png diff --git a/protected/components/Html.php b/protected/components/Html.php new file mode 100644 index 0000000..6c7df3c --- /dev/null +++ b/protected/components/Html.php @@ -0,0 +1,38 @@ +<?php +class Html extends CHtml { + /** + * Makes the given URL relative to the /image directory + */ + public static function imageUrl($url) { + return Yii::app()->baseUrl.'/images/'.$url; + } + /** + * Makes the given URL relative to the /css directory + */ + public static function cssUrl($url) { + return Yii::app()->baseUrl.'/css/'.$url; + } + /** + * Makes the given URL relative to the /js directory + */ + public static function jsUrl($url) { + return Yii::app()->baseUrl.'/js/'.$url; + } + + public static function enumItem($model, $attribute) { + $attr = $attribute; + self::resolveName($model, $attr); + preg_match('/\((.*)\)/', $model->tableSchema->columns[$attr]->dbType, $matches); + foreach (explode(',', $matches[1]) as $value) { + $value = str_replace("'", null, $value); + $values[$value] = Yii::t('enumItem', $value); + } + + return $values; + } + + public static function enumDropDownList($model, $attribute, $htmlOptions = array()) { + return CHtml::activeDropDownList($model, $attribute, Html::enumItem($model, $attribute), $htmlOptions); + } +} +?>
\ No newline at end of file diff --git a/protected/components/Map.php b/protected/components/Map.php new file mode 100644 index 0000000..614bbc3 --- /dev/null +++ b/protected/components/Map.php @@ -0,0 +1,50 @@ +<?php +Yii::import('ext.egmap.*'); +class Map { + private $POS_LAT; + private $POS_LONG; + private $gMap; + private $publishedIcon; + private $notPublishedIcon; + + public function __construct() { + $this->POS_LAT = Yii::app()->params["pos_lat"]; + $this->POS_LONG = Yii::app()->params["pos_long"]; + $this->gMap = new EGMap(); + $this->gMap->setAPIKey(Yii::app()->params["map_api_domain"], Yii::app()->params["map_api_key"]); + $this->gMap->setWidth("100%"); + $this->gMap->setHeight(550); + $this->gMap->zoom = 18; + $mapTypeControlOptions = array( + 'position' => EGMapControlPosition::RIGHT_TOP, + 'style' => EGMap::MAPTYPECONTROL_STYLE_HORIZONTAL_BAR + ); + + $this->gMap->mapTypeId = EGMap::TYPE_HYBRID; + $this->gMap->mapTypeControlOptions = $mapTypeControlOptions; + $this->gMap->zoom = 18; + $this->gMap->setCenter($this->POS_LAT, $this->POS_LONG); + + // Green icon for published standorte for marker. + $this->publishedIcon = new EGMapMarkerImage(Html::imageUrl("map/marker_green_32.png")); + $this->publishedIcon->setSize(32, 37); + $this->publishedIcon->setAnchor(16, 16.5); + $this->publishedIcon->setOrigin(0, 0); + // Red icon for non-published standorte for marker. + $this->notPublishedIcon = new EGMapMarkerImage(Html::imageUrl("map/marker_red_32.png")); + $this->notPublishedIcon->setSize(32, 37); + $this->notPublishedIcon->setAnchor(16, 16.5); + $this->notPublishedIcon->setOrigin(0, 0); + } + + public function addMarker(EGMapMarker $marker, $published) { + $options = $marker->getOptions(); + $newOptions = array_merge($options, array("icon"=>(($published) ? $this->publishedIcon : $this->notPublishedIcon))); + $marker->setOptions($newOptions); + $this->gMap->addMarker($marker); + } + + public function render() { + $this->gMap->renderMap(array(), Yii::app()->language); + } +}
\ No newline at end of file diff --git a/protected/config/main.php b/protected/config/main.php index 87cdf0a..653a119 100644 --- a/protected/config/main.php +++ b/protected/config/main.php @@ -64,9 +64,9 @@ return array( ), ), */ - 'db'=>array( - 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', - ), +// 'db'=>array( +// 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', +// ), // uncomment the following to use a MySQL database 'db'=>array( @@ -87,13 +87,13 @@ return array( 'routes'=>array( array( 'class'=>'CFileLogRoute', - 'levels'=>'error, warning', + 'levels'=>'error, warning, debug,trace', ), // uncomment the following to show log messages on web pages - array( - 'class'=>'CWebLogRoute', - ), +// array( +// 'class'=>'CWebLogRoute', +// ), ), ), @@ -103,6 +103,14 @@ return array( // using Yii::app()->params['paramName'] 'params'=>array( // this is used in contact page - 'adminEmail'=>'webmaster@example.com', + 'adminEmail'=>'webmaster@astaf.de', + 'pos_lat'=>48.8323934983, + 'pos_long'=>9.31750059128, + 'map_api_key'=>'ABQIAAAAzwMJRVnIOel5nqTjdUcPrRTSNOUR83EeIVShY4aBvXxHJx0DexSUFNGH3KQhtFhfSNHxkECqL5rQBA', + 'map_api_domain'=>'www.astaf.de', + 'start_date'=>'01.07.2012', + 'end_date'=>'03.07.2012', + 'start_time'=>'19:00', + 'end_time'=>'23:00', ), );
\ No newline at end of file diff --git a/protected/controllers/SearchController.php b/protected/controllers/SearchController.php index 2cf87df..1dd2414 100644 --- a/protected/controllers/SearchController.php +++ b/protected/controllers/SearchController.php @@ -2,7 +2,7 @@ class SearchController extends Controller { - public static $Searchables = array('Verein' => array('beschreibung'),'Sitecontent'=>array('content')); + public static $Searchables = array('Verein' => array('beschreibung'),'Sitecontent'=>array('content','title')); public function actionIndex() { $this->render('index'); @@ -14,7 +14,7 @@ class SearchController extends Controller foreach (SearchController::$Searchables as $searchable => $columns) { $q = new CDbCriteria(); foreach ($columns as $col) { - $q->addSearchCondition($col,$_POST['search']); + $q->addSearchCondition($col,$_POST['search'],true,'OR'); } $results[$searchable]=CActiveRecord::model($searchable)->findAll($q); } diff --git a/protected/controllers/StandortController.php b/protected/controllers/StandortController.php index 3fa11df..59e0ca5 100644 --- a/protected/controllers/StandortController.php +++ b/protected/controllers/StandortController.php @@ -27,10 +27,11 @@ class StandortController extends Controller { return array( array('allow', // allow admin user to perform 'admin' and 'delete' actions - 'actions'=>array('delete','create','update','index','view','ajaxupdate','ajaxcreate','savecoords'), - 'users'=>array('admin'), + 'actions'=>array('index','view'), + 'users'=>array('*'), ), array('deny', // deny all users + 'actions'=>array('delete','create','update','ajaxupdate','ajaxcreate','savecoords'), 'users'=>array('*'), ), ); diff --git a/protected/controllers/VeranstaltungController.php b/protected/controllers/VeranstaltungController.php index 49ec10a..0e88513 100644 --- a/protected/controllers/VeranstaltungController.php +++ b/protected/controllers/VeranstaltungController.php @@ -27,8 +27,8 @@ class VeranstaltungController extends Controller { return array( array('allow', // allow admin user to perform 'admin' and 'delete' actions - 'actions'=>array('create','update','index','view','delete'), - 'users'=>array('admin'), + 'actions'=>array('index','view','now'), + 'users'=>array('*'), ), array('deny', // deny all users 'users'=>array('*'), @@ -141,6 +141,19 @@ class VeranstaltungController extends Controller )); } + public function actionNow() + { + $model=new Veranstaltung('now'); + $model->unsetAttributes(); // clear any default values + if(isset($_GET['Veranstaltung'])) + $model->attributes=$_GET['Veranstaltung']; + + $this->render('now',array( + 'model'=>$model, + )); + + } + /** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. diff --git a/protected/models/Standort.php b/protected/models/Standort.php index 6052e1a..cfae1f2 100644 --- a/protected/models/Standort.php +++ b/protected/models/Standort.php @@ -63,6 +63,7 @@ class Standort extends CActiveRecord // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( + "vereine"=>array(self::HAS_MANY, "Verein", array('standort_id'=>'id')), ); } diff --git a/protected/models/Veranstaltung.php b/protected/models/Veranstaltung.php index 0e4d9b8..2b03df1 100644 --- a/protected/models/Veranstaltung.php +++ b/protected/models/Veranstaltung.php @@ -50,8 +50,8 @@ class Veranstaltung extends CActiveRecord array('titel', 'length', 'max'=>100), array('startzeit, endzeit, beschreibung', 'safe'), array('startzeit, endzeit', 'date', 'format'=>'dd.MM.yyyy HH:mm'), - array('startzeit, endzeit', 'DateRangeValidator', 'minDate'=>Yii::app()->params['start_date'].' '.Yii::app()->params['start_time'], 'maxDate'=>Yii::app()->params['end_date'].' '.Yii::app()->params['end_time']), - array('startzeit', 'DateCompareValidator', 'compareAttribute'=>'endzeit', 'operator'=>'<'), + // array('startzeit, endzeit', 'DateRangeValidator', 'minDate'=>Yii::app()->params['start_date'].' '.Yii::app()->params['start_time'], 'maxDate'=>Yii::app()->params['end_date'].' '.Yii::app()->params['end_time']), + // array('startzeit', 'DateCompareValidator', 'compareAttribute'=>'endzeit', 'operator'=>'<'), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, verein_id, titel, startzeit, endzeit, beschreibung, standort_id, published', 'safe', 'on'=>'search'), @@ -106,13 +106,31 @@ class Veranstaltung extends CActiveRecord $criteria->compare('endzeit',$this->endzeit,true); $criteria->compare('beschreibung',$this->beschreibung,true); $criteria->compare('standort_id',$this->standort_id); - $criteria->compare('published',$this->published); + $criteria->compare('published',true); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); } + public function now() + { + + $criteria=new CDbCriteria; + + $nowMin = new CDbExpression('SUBDATE(NOW(),INTERVAL 1 HOUR)'); + $nowPlus= new CDbExpression('ADDDATE(NOW(),INTERVAL 1 HOUR)'); + $now = new CDbExpression("NOW()"); + //$criteria->compare('startzeit','> '.$nowMin); + //$criteria->compare('startzeit','< '.$nowPlus); + //$criteria->compare("endzeit"," <= ".$now,'AND'); + $criteria->condition = '(startzeit between SUBDATE(NOW(),INTERVAL 1 HOUR) and ADDDATE(NOW(),INTERVAL 1 HOUR) OR startzeit < NOW() and endzeit > NOW() ) and endzeit > NOW() and published = 1 order by startzeit asc'; + Yii::trace(print_r($criteria,true)); + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + public function beforeSave() { $isValid = parent::beforeSave(); if ($isValid) { diff --git a/protected/views/search/results.php b/protected/views/search/results.php index c1d80e2..05d2b57 100644 --- a/protected/views/search/results.php +++ b/protected/views/search/results.php @@ -3,20 +3,14 @@ $this->breadcrumbs=array( 'Search'=>array('/search'), 'Results', );?> -<h3><?php echo $this->id . '/' . $this->action->id; ?></h3> +<h3>Suchergebnisse für "<?php echo CHtml::encode($search) ?>"</h3> <?php foreach ($results as $mod => $res) {?> - <h6><?php echo $mod ?></h6> + <h5><?php echo $mod ?></h5> <?php $dataProvider = new CArrayDataProvider($res); $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, - 'itemView'=>'/cms/'.lcfirst($mod).'/_short', // refers to the partial view named '_post' - 'sortableAttributes'=>array( - 'name', - /*'create_time'=>'Post Time',*/ - ), + 'itemView'=>'/'.lcfirst($mod).'/_short', // refers to the partial view named '_post' + ));?> <?php }?> -<p> - <pre><?php print_r($results)?></pre> -</p> diff --git a/protected/views/sitecontent/_short.php b/protected/views/sitecontent/_short.php new file mode 100644 index 0000000..bff61cf --- /dev/null +++ b/protected/views/sitecontent/_short.php @@ -0,0 +1,9 @@ + +<?php +if(strlen(strip_tags($data->content))>300) { + $tmp = str_split(strip_tags($data->content),297); + $myBeschreibung = $tmp[0]."..."; +} else { + $myBeschreibung = strip_tags($data->content); +}?> +<?php echo CHTML::link("<h6>".$data->title."</h6><p>".$myBeschreibung."</p>" ,array("/cms/sitecontent/view","id"=>$data->id)); ?>
\ No newline at end of file diff --git a/protected/views/standort/_buehne.php b/protected/views/standort/_buehne.php new file mode 100644 index 0000000..bfaa34a --- /dev/null +++ b/protected/views/standort/_buehne.php @@ -0,0 +1,18 @@ +<h6>Folgende Veranstaltungen finden <?php echo $data->name?> statt</h6> +<?php +$dataProvider=new CActiveDataProvider('Veranstaltung', array( + 'criteria'=>array( + 'condition'=>'standort_id='.$data->id." and published=1", + ), + 'pagination'=>array( + 'pageSize'=>20, + ), + +)); +$this->widget('zii.widgets.CListView', array( + 'dataProvider'=>$dataProvider, + 'itemView'=>'/veranstaltung/_short', + 'sortableAttributes'=>array( + 'name' + ) + ));?>
\ No newline at end of file diff --git a/protected/views/standort/_standort.php b/protected/views/standort/_standort.php new file mode 100644 index 0000000..9c12fbe --- /dev/null +++ b/protected/views/standort/_standort.php @@ -0,0 +1,18 @@ +<h6>Folgende Vereine finden sich <?php echo $data->name?></h6> +<?php +$dataProvider=new CActiveDataProvider('Verein', array( + 'criteria'=>array( + 'condition'=>'standort_id='.$data->id, + ), + 'pagination'=>array( + 'pageSize'=>20, + ), + +)); +$this->widget('zii.widgets.CListView', array( + 'dataProvider'=>$dataProvider, + 'itemView'=>'/verein/_short', + 'sortableAttributes'=>array( + 'name' + ) + ));?>
\ No newline at end of file diff --git a/protected/views/standort/index.php b/protected/views/standort/index.php index 9a88a74..ca84d35 100644 --- a/protected/views/standort/index.php +++ b/protected/views/standort/index.php @@ -8,70 +8,37 @@ $this->menu=array( ); ?> -<h1>Standorte</h1> - -<?php $this->renderPartial('/common/_comparison_text'); ?> - -<?php $this->renderPartial('/common/_advanced_search',array( - 'model'=>$model, -)); ?> - +<h3>Standorte</h3> +<p class="box info">Mit einem Click auf den Standortmarker erhalten Sie eine Übersicht der Vereine am Standort</p> +<p> <?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'); - } - } - }); + $infostring = "<div class='gmaps-label' style='color: #000;'><strong>".$standort->name."</strong><br/>"; + foreach ($standort->vereine as $verein) { + $infostring .=CHtml::link($verein->name,array("verein/view","id"=>$verein->id))."<br />"; } - console.info(event) - } - "; + $infostring .="</div>"; + $infoWindow = new EGMapInfoWindow($infostring); // 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 = new EGMapMarker($standort->pos_lat, $standort->pos_long, array('title' => $model->name, 'draggable'=>false), 'marker'); $marker->addHtmlInfoWindow($infoWindow); $map->addMarker($marker, $standort->published); } $map->render(); ?> -<?php $this->widget('zii.widgets.grid.CGridView', array( +<?php /* +Listenanzeige der Standorte, gerade Schwachsinnig +$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}' - ), - ), -)); ?> + ), +));*/ ?> +</p> diff --git a/protected/views/standort/view.php b/protected/views/standort/view.php index 0674ce9..53d5440 100644 --- a/protected/views/standort/view.php +++ b/protected/views/standort/view.php @@ -12,7 +12,7 @@ $this->menu=array( ); ?> -<h3>Standort "<?php echo $model->name ?>"</h3> +<h3><?php echo ($model->type == "Bühne") ? "Bühne": "Standort" ?> "<?php echo $model->name ?>"</h3> <p> <?php Yii::import('ext.egmap.*'); @@ -48,21 +48,14 @@ $gMap->enableMarkerClusterer(new EGMapMarkerClusterer()); $gMap->renderMap(); ?> </p> -<h6>Folgende Vereine finden sich <?php echo $model->name?></h6> <?php -$dataProvider=new CActiveDataProvider('Verein', array( - 'criteria'=>array( - 'condition'=>'standort_id='.$model->id, - ), - 'pagination'=>array( - 'pageSize'=>20, - ), - +if("Stand" == $model->type) { + $this->renderPartial('_standort',array( + 'data'=>$model, + )); +} elseif ("Bühne" == $model->type) { + $this->renderPartial('_buehne',array( + 'data'=>$model, )); -$this->widget('zii.widgets.CListView', array( - 'dataProvider'=>$dataProvider, - 'itemView'=>'/verein/_short', - 'sortableAttributes'=>array( - 'name' - ) - ));?> +} +?> diff --git a/protected/views/veranstaltung/_search.php b/protected/views/veranstaltung/_search.php new file mode 100644 index 0000000..099603c --- /dev/null +++ b/protected/views/veranstaltung/_search.php @@ -0,0 +1,54 @@ +<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,'verein_id'); ?> + <?php echo $form->dropDownList($model, 'verein_id', CHtml::listData(Verein::model()->findAll(), 'id', 'name'), array("empty"=>"")); ?> + </div> + + <div class="row"> + <?php echo $form->label($model,'titel'); ?> + <?php echo $form->textField($model,'titel',array('size'=>60,'maxlength'=>100)); ?> + </div> + + <div class="row"> + <?php echo $form->label($model,'startzeit'); ?> + <?php echo $form->textField($model,'startzeit'); ?> + </div> + + <div class="row"> + <?php echo $form->label($model,'endzeit'); ?> + <?php echo $form->textField($model,'endzeit'); ?> + </div> + + <div class="row"> + <?php echo $form->label($model,'beschreibung'); ?> + <?php echo $form->textArea($model,'beschreibung',array('rows'=>6, 'cols'=>50)); ?> + </div> + + <div class="row"> + <?php echo $form->label($model,'standort_id'); ?> + <?php echo $form->dropDownList($model, 'standort_id', CHtml::listData(Standort::model()->findAll(array('condition'=>'type="Bühne"')), 'id', 'name'), array("empty"=>"")); ?> + </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/veranstaltung/_short.php b/protected/views/veranstaltung/_short.php new file mode 100644 index 0000000..56c474b --- /dev/null +++ b/protected/views/veranstaltung/_short.php @@ -0,0 +1,2 @@ +<?php +echo CHTML::link("<strong>".$data->titel."</strong> ".Yii::app()->dateFormatter->format('EEEE hh:mm',$data->startzeit)." Uhr bis ".Yii::app()->dateFormatter->format('EEEE hh:mm',$data->endzeit),array("veranstaltung/view","id"=>$data->id)); ?><br />
\ No newline at end of file diff --git a/protected/views/veranstaltung/_view.php b/protected/views/veranstaltung/_view.php new file mode 100644 index 0000000..daa818a --- /dev/null +++ b/protected/views/veranstaltung/_view.php @@ -0,0 +1,38 @@ +<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('verein_id')); ?>:</b> + <?php echo CHtml::encode($data->verein_id); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('titel')); ?>:</b> + <?php echo CHtml::encode($data->titel); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('startzeit')); ?>:</b> + <?php echo CHtml::encode($data->startzeit); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('endzeit')); ?>:</b> + <?php echo CHtml::encode($data->endzeit); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('beschreibung')); ?>:</b> + <?php echo CHtml::encode($data->beschreibung); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('standort_id')); ?>:</b> + <?php echo CHtml::encode($data->standort_id); ?> + <br /> + + <?php /* + <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/veranstaltung/index.php b/protected/views/veranstaltung/index.php new file mode 100644 index 0000000..13f1dcf --- /dev/null +++ b/protected/views/veranstaltung/index.php @@ -0,0 +1,35 @@ +<?php +$this->breadcrumbs=array( + 'Veranstaltungen', +); + +$this->menu=array( + array('label'=>'Veranstaltung erstellen', 'url'=>array('create')), +);?> + +<h3>Veranstaltungen</h3> + + +<?php $this->widget('zii.widgets.grid.CGridView', array( + 'id'=>'veranstaltung-grid', + 'dataProvider'=>$model->search(), + 'filter'=>$model, + 'columns'=>array( + array('header'=>'Verein', + 'name'=>'verein_id', + 'filter'=>CHtml::listData(Verein::model()->findAll(), 'id', 'name'), + 'value'=>'$data->verein->name'), + 'titel', + array('header'=>'Startzeit', 'value'=>'Format::displayDateTime($data->startzeit)'), + array('header'=>'Endzeit', 'value'=>'Format::displayDateTime($data->endzeit)'), + array('header'=>'Standort', + 'name'=>'standort_id', + 'filter'=>CHtml::listData(Standort::model()->findAll(array('condition'=>'type="Bühne"')), 'id', 'name'), + 'value'=>'($data->standort) ? $data->standort->name : "Kein Standort"'), + 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', + ), + ), +)); ?> diff --git a/protected/views/veranstaltung/now.php b/protected/views/veranstaltung/now.php new file mode 100644 index 0000000..ca5e5dc --- /dev/null +++ b/protected/views/veranstaltung/now.php @@ -0,0 +1,18 @@ +<?php +$this->breadcrumbs=array( + 'Veranstaltungen'=>array('index'),'Jetzt' +); + +$this->menu=array( + array('label'=>'Veranstaltung erstellen', 'url'=>array('create')), +);?> + +<h3>Veranstaltungen heute um <?php echo date("H:i");?></h3> + + +<?php $this->widget('zii.widgets.grid.CGridView', array( + 'id'=>'veranstaltung-grid', + 'dataProvider'=>$model->now() + + +)); ?> diff --git a/protected/views/veranstaltung/view.php b/protected/views/veranstaltung/view.php new file mode 100644 index 0000000..55dbff8 --- /dev/null +++ b/protected/views/veranstaltung/view.php @@ -0,0 +1,21 @@ +<?php +$this->breadcrumbs=array( + 'Veranstaltungen'=>array('index'), + $model->titel, +); + +$this->menu=array( + array('label'=>'Veranstaltungen', 'url'=>array('index')), + ); +?> + +<h3><?php echo $model->titel; ?></h3> +<p>von <?php echo Yii::app()->dateFormatter->format('EEEE hh:mm',$model->startzeit)." Uhr"?> bis <?php +echo Yii::app()->dateFormatter->format('EEEE hh:mm',$model->endzeit)." Uhr"?> +auf der Bühne <?php echo CHtml::link($model->standort->name,array("standort/view","id"=>$model->standort_id))?></p> +<p> +<?php +echo $model->beschreibung; +?> +</p> +<div class="box info"><p>Veranstalter ist der Verein <?php echo CHtml::link($model->verein->name,array("verein/view","id"=>$model->verein_id))?></p><?php echo $model->verein->kontaktdaten?></div>
\ No newline at end of file diff --git a/protected/views/verein/_short.php b/protected/views/verein/_short.php index 0ff6284..c6e42de 100644 --- a/protected/views/verein/_short.php +++ b/protected/views/verein/_short.php @@ -11,4 +11,4 @@ if(strlen(strip_tags($data->beschreibung))>300) { <?php /* <p><?php echo CHTML::link(CHTML::decode($myBeschreibung),array("verein/view","id"=>$data->id)); ?></p> */?> -<?php echo CHTML::link("<h6>".$data->name."</h6><p>".$myBeschreibung."</p>" ,array("verein/view","id"=>$data->id)); ?>
\ No newline at end of file +<?php echo CHTML::link("<h6>".$data->name." (".$data->standort->name.")</h6><p>".$myBeschreibung."</p>" ,array("verein/view","id"=>$data->id)); ?>
\ No newline at end of file diff --git a/protected/views/verein/_shortangebotverein.php b/protected/views/verein/_shortangebotverein.php index e49580e..bc845ca 100644 --- a/protected/views/verein/_shortangebotverein.php +++ b/protected/views/verein/_shortangebotverein.php @@ -1,8 +1,3 @@ <?php -if(strlen(strip_tags($data->angebot->beschreibung))>80) { - $tmp = str_split(strip_tags($data->angebot->beschreibung),77); - $myBeschreibung = $tmp[0]."..."; -} else { - $myBeschreibung = strip_tags($data->angebot->beschreibung); -} -echo CHTML::link("<strong>".$data->angebot->name."</strong> (".$data->menge." ".$data->einheit.") für ".$data->preis."€ ".$myBeschreibung ,array("speisTrank/view","id"=>$data->angebot_id)); ?><br />
\ No newline at end of file + +echo CHTML::link("<strong>".$data->angebot->name."</strong> (".$data->menge." ".$data->einheit.") für ".Format::currency($data->preis) ,array("speisTrank/view","id"=>$data->angebot_id)); ?><br />
\ No newline at end of file diff --git a/protected/views/verein/view.php b/protected/views/verein/view.php index 95e1cf2..188238a 100644 --- a/protected/views/verein/view.php +++ b/protected/views/verein/view.php @@ -20,12 +20,11 @@ $this->menu=array( <div class="box info float-right"><?php echo $model->kontaktdaten ?></div> <p><?php echo $model->beschreibung?></p> -<div class="float-left" > <?php /*$this->widget('zii.widgets.CListView', array( 'dataProvider'=>new CArrayDataProvider($model->angebote, array()), 'itemView'=>'_shortangebot', // refers to the partial view named '_post' ));*/?> - +<h4>Kulinarische Angebote</h4> <?php $dataProvider=new CActiveDataProvider('AngebotVerein', array( 'criteria'=>array( @@ -41,16 +40,25 @@ $this->widget('zii.widgets.CListView', array( 'itemView'=>'_shortangebotverein', 'sortableAttributes'=>array( 'preis','menge', - ), // refers to the partial view named '_post' + ), + ));?> +<h4>Veranstaltungen</h4> +<?php +$dataProvider=new CActiveDataProvider('Veranstaltung', array( + 'criteria'=>array( + 'condition'=>'verein_id='.$model->id." and published=1", + ), + 'pagination'=>array( + 'pageSize'=>20, + ), +)); +$this->widget('zii.widgets.CListView', array( + 'dataProvider'=>$dataProvider, + 'itemView'=>'/veranstaltung/_short', + 'sortableAttributes'=>array( + 'titel','startzeit','endzeit', + ), + 'htmlOptions' => array('style' => 'width:100%'), ));?> - -<ul><?php -foreach ($model->veranstaltungen as $value) { - echo "<li>".CHTML::link($value->titel,array("veranstaltung/view","id"=>$value->id))."</li>"; -} - -?> -</ul> -</div> |
