aboutsummaryrefslogtreecommitdiffstats
path: root/lib/HTTP/CalDAV/Tools/ReportParser.php
diff options
context:
space:
mode:
authorJack Bates <jablko@users.sourceforge.net>2006-04-13 21:14:17 +0000
committerJack Bates <jablko@users.sourceforge.net>2006-04-13 21:14:17 +0000
commit36d31ea75fccffa3aa71a24ac5a1614f56b64e30 (patch)
tree5ac614a8a2610802ea657ff71fd33aa9eccdf4f0 /lib/HTTP/CalDAV/Tools/ReportParser.php
parent428ef55248c513015bc3233cf62c0e9db0dfbb3a (diff)
downloadphpicalendar-36d31ea75fccffa3aa71a24ac5a1614f56b64e30.tar.gz
phpicalendar-36d31ea75fccffa3aa71a24ac5a1614f56b64e30.tar.bz2
phpicalendar-36d31ea75fccffa3aa71a24ac5a1614f56b64e30.zip
* Half way through filter support for calendar-query REPORTs
* About to normalize report_response_helper with propfind_response_helper
Diffstat (limited to 'lib/HTTP/CalDAV/Tools/ReportParser.php')
-rw-r--r--lib/HTTP/CalDAV/Tools/ReportParser.php55
1 files changed, 52 insertions, 3 deletions
diff --git a/lib/HTTP/CalDAV/Tools/ReportParser.php b/lib/HTTP/CalDAV/Tools/ReportParser.php
index 9d9c9c7..4c904dc 100644
--- a/lib/HTTP/CalDAV/Tools/ReportParser.php
+++ b/lib/HTTP/CalDAV/Tools/ReportParser.php
@@ -20,7 +20,7 @@
* @author Jack Bates <ms419@freezone.co.uk>
* @copyright 2006 The PHP Group
* @license PHP License 3.0 http://www.php.net/license/3_0.txt
- * @version CVS: $Id: ReportParser.php,v 1.1 2006/04/13 05:10:24 jablko Exp $
+ * @version CVS: $Id: ReportParser.php,v 1.2 2006/04/13 21:14:17 jablko Exp $
* @link http://pear.php.net/package/HTTP_CalDAV_Server
* @see HTTP_WebDAV_Server
*/
@@ -35,7 +35,7 @@
* @author Jack Bates <ms419@freezone.co.uk>
* @copyright 2006 The PHP Group
* @license PHP License 3.0 http://www.php.net/license/3_0.txt
- * @version CVS: $Id: ReportParser.php,v 1.1 2006/04/13 05:10:24 jablko Exp $
+ * @version CVS: $Id: ReportParser.php,v 1.2 2006/04/13 21:14:17 jablko Exp $
* @link http://pear.php.net/package/HTTP_CalDAV_Server
* @see HTTP_WebDAV_Server
*/
@@ -66,6 +66,14 @@ class ReportParser
var $props = array();
/**
+ * Found filters are collected here
+ *
+ * @var array
+ * @access public
+ */
+ var $filters = array();
+
+ /**
* Stack of ancestor tag names
*
* @var array
@@ -205,6 +213,45 @@ class ReportParser
return;
}
+ if (count($this->_names) == 1 && $name == 'filter') {
+ $this->_comps[] =& $this->filters;
+ $this->_names[] = $name;
+ return;
+ }
+
+ if ($name == 'comp-filter') {
+ end($this->_comps);
+
+ // Gross - end returns a copy of the last value
+ $comp =& $this->_comps[key($this->_comps)];
+
+ if (!is_array($comp['comps'])) {
+ $comp['comps'] = array();
+ }
+
+ $comp['comps'][$attrs['name']] = array();
+ $this->_comps[] =& $comp['comps'][$attrs['name']];
+ $this->_names[] = $name;
+ return;
+ }
+
+ if (end($this->_names) == 'comp-filter') {
+ end($this->_comps);
+
+ // Gross - end returns a copy of the last value
+ $comp =& $this->_comps[key($this->_comps)];
+
+ if (!is_array($comp['filters'])) {
+ $comp['filters'] = array();
+ }
+
+ $filter = array('name' => $name, 'value' => $attrs);
+
+ $comp['filters'][] = $filter;
+ $this->_names[] = $name;
+ return;
+ }
+
$this->_names[] = $name;
}
@@ -232,7 +279,9 @@ class ReportParser
}
// Any need to pop at end of calendar-data?
- if ($name == 'comp') {
+ // Yes - $this->_comps is re-used for parsing filters
+ if ($name == 'comp' || $name == 'calendar-data' ||
+ $name == 'comp-filter' || $name == 'filter') {
array_pop($this->_comps);
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy