]> git.pld-linux.org Git - packages/dokuwiki-plugin-icalevents.git/blob - allow-params.patch
- BR: unzip
[packages/dokuwiki-plugin-icalevents.git] / allow-params.patch
1 --- dokuwiki-plugin-icalevents-20100501/syntax.php      2010-12-05 22:33:33.062976306 +0200
2 +++ iCalEvents/syntax.php       2010-12-05 22:44:54.218325084 +0200
3 @@ -74,20 +74,32 @@
4          $previewSec = 60*24*3600;  # two month
5        }
6        
7 +      # Take dateformat from params, or
8 +      # If dateformat is set in plugin configuration ('dformat'), then use it.
9 +      # Otherwise fall back to dokuwiki's default dformat from the global /conf/dokuwiki.php.
10 +      if (!empty($params['dformat'])) {
11 +        $dateFormat = $params['dformat'];
12 +      } else {
13 +        global $conf;
14 +        $dateFormat = $this->getConf('dformat') ? $this->getConf('dformat') : $conf['dformat'];
15 +      }
16 +
17 +      $showEndDates = !empty($params['showEndDates']);
18 +      
19        #echo "url=$icsURL from = $from    previewSec = $previewSec<br>";
20        
21 -      return array($icsURL, $from, $previewSec); 
22 +      return array($icsURL, $from, $previewSec, $dateFormat, $showEndDates); 
23      }
24      
25      /**
26       * loads the ics file via HTTP, parses it and renders an HTML table.
27       */
28      function render($mode, &$renderer, $data) {
29 -      list($url, $from, $previewSec) = $data;
30 +      list($url, $from, $previewSec, $dateFormat, $showEndDates) = $data;
31        $ret = '';
32        if($mode == 'xhtml'){
33               # parse the ICS file
34 -          $entries = $this->_parseIcs($url, $from, $previewSec);
35 +          $entries = $this->_parseIcs($url, $from, $previewSec, $dateFormat);
36            if ($this->error) {
37              $renderer->doc .= "Error in Plugin iCalEvents: ".$this->error;
38              return true;
39 @@ -103,7 +115,7 @@
40            foreach ($entries as $entry) {
41              $rowCount++;
42              $ret .= '<tr>';
43 -                       if ($this->getConf('showEndDates')) {
44 +                       if ($showEndDates || $this->getConf('showEndDates')) {
45                                 $ret .= '<td>'.$entry['startdate'].' - '.$entry['enddate'].'</td>';
46                         } else {
47                                 $ret .= '<td>'.$entry['startdate'];
48 @@ -130,9 +142,7 @@
49       * @param previewSec preview range also in seconds 
50       * @return an array of entries sorted by their startdate
51       */
52 -    function _parseIcs($url, $from, $previewSec) {
53 -           global $conf;
54 -
55 +    function _parseIcs($url, $from, $previewSec, $dateFormat) {
56          // must reset error in case we have multiple calendars on page
57          $this->error = false;
58  
59 @@ -144,10 +154,6 @@
60          $content    = $http->resp_body;
61          $entries    = array();
62          
63 -               # If dateformat is set in plugin configuration ('dformat'), then use it.
64 -               # Otherwise fall back to dokuwiki's default dformat from the global /conf/dokuwiki.php.
65 -               $dateFormat = $this->getConf('dformat') ? $this->getConf('dformat') : $conf['dformat'];
66 -                               
67          # regular expressions for items that we want to extract from the iCalendar file
68          $regex_vevent      = '/BEGIN:VEVENT(.*?)END:VEVENT/s';
69          $regex_summary     = '/SUMMARY:(.*?)\n/';
This page took 0.123237 seconds and 3 git commands to generate.