]> git.mxchange.org Git - friendica.git/commitdiff
Events on Diaspora now looking okay.
authorMichael Vogel <icarus@dabo.de>
Sat, 17 Oct 2015 07:41:58 +0000 (09:41 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 17 Oct 2015 07:41:58 +0000 (09:41 +0200)
include/bbcode.php
include/event.php

index 2fcf6c3247a572a8404b78c97716799465427fc9..81536d37200fdd5083a38685c306282856f8d0cb 100644 (file)
@@ -1210,7 +1210,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
        // start which is always required). Allow desc with a missing summary for compatibility.
 
        if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
-               $sub = format_event_html($ev);
+               $sub = format_event_html($ev, $simplehtml);
 
                $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
                $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
index d56388a77a0e407212b7572b8680b8b16e855ec9..c4111dc0b174869be3fff15d6b58599a10d06bcd 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/bbcode.php');
 require_once('include/map.php');
 
-function format_event_html($ev) {
+function format_event_html($ev, $simple = false) {
 
 
 
@@ -12,6 +12,32 @@ function format_event_html($ev) {
 
        $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
 
+       $event_start = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+                       $ev['start'] , $bd_format ))
+                       :  day_translate(datetime_convert('UTC', 'UTC',
+                       $ev['start'] , $bd_format)));
+
+       $event_end = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+                               $ev['finish'] , $bd_format ))
+                               :  day_translate(datetime_convert('UTC', 'UTC',
+                               $ev['finish'] , $bd_format )));
+
+       if ($simple) {
+               $o = "<h3>".bbcode($ev['summary'])."</h3>";
+
+               $o .= "<p>".bbcode($ev['desc'])."</p>";
+
+               $o .= "<h4>".t('Starts:')."</h4><p>".$event_start."</p>";
+
+               if(! $ev['nofinish'])
+                       $o .= "<h4>".t('Finishes:')."</h4><p>".$event_end."</p>";
+
+               if(strlen($ev['location']))
+                       $o .= "<h4>".t('Location:')."</h4><p>".$ev['location']."</p>";
+
+               return $o;
+       }
+
        $o = '<div class="vevent">' . "\r\n";
 
 
@@ -21,21 +47,13 @@ function format_event_html($ev) {
 
        $o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
                . datetime_convert('UTC','UTC',$ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
-               . '" >'
-               . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
-                       $ev['start'] , $bd_format ))
-                       :  day_translate(datetime_convert('UTC', 'UTC',
-                       $ev['start'] , $bd_format)))
+               . '" >'.$event_start
                . '</abbr></p>' . "\r\n";
 
        if(! $ev['nofinish'])
                $o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="'
                        . datetime_convert('UTC','UTC',$ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
-                       . '" >'
-                       . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
-                               $ev['finish'] , $bd_format ))
-                               :  day_translate(datetime_convert('UTC', 'UTC',
-                               $ev['finish'] , $bd_format )))
+                       . '" >'.$event_end
                        . '</abbr></p>'  . "\r\n";
 
        if(strlen($ev['location'])){