1<?php
2/**
3 * Plugin hcalendar: Using Microformat Calendar
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Juergen A. Lamers <jaloma.ac@googlemail.com>
7 * @seealso    (http://jaloma.ac.googlepages.com/plugin:hcalendar)
8 */
9if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
11require_once(DOKU_PLUGIN.'syntax.php');
12
13class helper_plugin_hcal extends DokuWiki_Plugin {
14
15function buildTextEnd($tag_vevent) {
16	return "</div><!--container-->\n";//container
17}
18  function buildText(
19		     $yy_start,$mth_start,$dy_start,$hh_start,$mm_start,$ss_start,$dt_start,
20		     $yy_end  ,$mth_end  ,$dy_end  ,$hh_end,  $mm_end,  $ss_end,  $dt_end,
21		     $summary ,$location, $inlineentry,
22		     $tag_vevent,
23		     $tag_summary,
24		     $tag_dtstart,
25		     $tag_dtend,
26		     $tag_location,
27		     $tag_uid,
28		     $tag_dtstamp,
29			 $container
30		     ) {
31    $txt = '';
32	if (isset($container) && $container==true) {
33		$txt .= '<div>';
34	}
35    $txt .= '<'.$this->getConf($tag_vevent).' class="vevent">';
36    $txt .= '<'.$this->getConf($tag_summary).' class="summary">'.$summary.' </'.$this->getConf($tag_summary).'>';
37    if ($hh_start != '') {//1998-03-12T08:30:00-05:00
38      	$txt .= '<'.$this->getConf($tag_dtstart).' class="dtstart" title="'.$yy_start.'-'.$mth_start.'-'.$dy_start.'T'.$hh_start.':'.$mm_start.':'.$ss_start.//'+01:00'.//'Z'.
39				'">'.
40				date('D d.F Y',$dt_start).
41				' ';
42      	if (isset($dt_end) && $hh_end != '') {
43			$txt .= $this->getLang('ab');
44      	} else {
45			$txt .= $this->getLang('um');
46      	}
47      	$txt .= ' '.$hh_start.':'.$mm_start.' '.$this->getLang('uhr').' ';
48      	$txt .= '</'.$this->getConf($tag_dtstart).'>';
49      	if (isset($dt_end)) {
50			$txt .= ' <'.$this->getConf($tag_dtend).' class="dtend" title="'.$yy_end.'-'.$mth_end.'-'.$dy_end;
51			if ($hh_end != '') {
52	  			$txt .= 'T'.$hh_end.':'.$mm_end.':'.$ss_end.//'-00:00'.//'Z'.
53	    				'';
54			}
55			$txt .= '">';
56			$txt .= ' '.$this->getLang('bis').' ';
57			if (($dy_end  != '' && $dy_end != $dy_start) ||
58	    		($mth_end != '' && $mth_end != $mth_start) ||
59	    		($yy_end  != '' && $yy_end != $yy_start)) {
60	  			$txt .= date('D d.F Y',$dt_end).' ';
61			}
62			if ($hh_end != '' && $hh_end != 'off') {
63				$txt .= $this->getLang('um').' '.$hh_end.':'.$mm_end.' '.$this->getLang('uhr').' ';
64			}
65			$txt .= '</'.$this->getConf($tag_dtend).'>';
66      	}
67    } else {
68      $txt .= ' <'.$this->getConf($tag_dtstart).' class="dtstart" title="'.$yy_start.'-'.$mth_start.'-'.$dy_start.'">'.
69			//	    $dy_start.'.'.$mth_start.' '.$yy_start.
70				date('D d.F Y',$dt_start).
71			' </'.$this->getConf($tag_dtstart).'>';
72      if (isset($dt_end) && (($dy_end != $dy_start) ||
73				($mth_end != $mth_start) ||
74			    ($yy_end != $yy_start))) {
75		$txt .= ' <'.$this->getConf($tag_dtend).' class="dtend" title="'.$yy_end.'-'.$mth_end.'-'.$dy_end;
76		if ($hh_end != '') {
77	  		$txt .= 'T'.$hh_end.':'.$mm_end.':'.$ss_end.//'-00:00'.//'Z'.
78	    				'';
79		}
80		$txt .= '">';
81		$txt .= ' '.$this->getLang('bis').' ';
82		$txt .= date('D d.F Y',$dt_end).' ';
83		if ($hh_end != '' && $hh_end != 'off') {
84			$txt .= $this->getLang('um').' '.$hh_end.':'.$mm_end.' '.$this->getLang('uhr').' ';
85		}
86		$txt .= '</'.$this->getConf($tag_dtend).'>';
87      }
88    }
89    $txt .= ' <'.$this->getConf($tag_location).' class="location">'.$location.'</'.$this->getConf($tag_location).'>';
90    if (!$inlineentry) {
91      $dID  = cleanID($summary);
92      $txt .= ' <'.$this->getConf($tag_uid).' class="uid" style="font-size:4pt;">'.md5($dID).'</'.$this->getConf($tag_uid).'>';// Eingetragen von...
93    }
94   	$txt .= '</'.$this->getConf($tag_vevent)."><!-- class=vevent -->\n";//class=vevent
95
96    return $txt;
97  }
98}
99