Store tags to enable partstat queries (#1796)
This commit is contained in:
parent
a3122a566e
commit
bdf2faafae
3 changed files with 25 additions and 9 deletions
|
@ -193,16 +193,12 @@ class kolab_format_event extends kolab_format_xcal
|
||||||
*/
|
*/
|
||||||
public function get_tags()
|
public function get_tags()
|
||||||
{
|
{
|
||||||
$tags = array();
|
$tags = parent::get_tags();
|
||||||
|
|
||||||
foreach ((array)$this->data['categories'] as $cat) {
|
foreach ((array)$this->data['categories'] as $cat) {
|
||||||
$tags[] = rcube_utils::normalize_string($cat);
|
$tags[] = rcube_utils::normalize_string($cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->data['valarms'])) {
|
|
||||||
$tags[] = 'x-has-alarms';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ class kolab_format_task extends kolab_format_xcal
|
||||||
*/
|
*/
|
||||||
public function get_tags()
|
public function get_tags()
|
||||||
{
|
{
|
||||||
$tags = array();
|
$tags = parent::get_tags();
|
||||||
|
|
||||||
if ($this->data['status'] == 'COMPLETED' || ($this->data['complete'] == 100 && empty($this->data['status'])))
|
if ($this->data['status'] == 'COMPLETED' || ($this->data['complete'] == 100 && empty($this->data['status'])))
|
||||||
$tags[] = 'x-complete';
|
$tags[] = 'x-complete';
|
||||||
|
@ -119,9 +119,6 @@ class kolab_format_task extends kolab_format_xcal
|
||||||
if ($this->data['priority'] == 1)
|
if ($this->data['priority'] == 1)
|
||||||
$tags[] = 'x-flagged';
|
$tags[] = 'x-flagged';
|
||||||
|
|
||||||
if (!empty($this->data['valarms']))
|
|
||||||
$tags[] = 'x-has-alarms';
|
|
||||||
|
|
||||||
if ($this->data['parent_id'])
|
if ($this->data['parent_id'])
|
||||||
$tags[] = 'x-parent:' . $this->data['parent_id'];
|
$tags[] = 'x-parent:' . $this->data['parent_id'];
|
||||||
|
|
||||||
|
|
|
@ -560,4 +560,27 @@ abstract class kolab_format_xcal extends kolab_format
|
||||||
return array_unique(rcube_utils::normalize_string($data, true));
|
return array_unique(rcube_utils::normalize_string($data, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for kolab_storage_cache to get object specific tags to cache
|
||||||
|
*
|
||||||
|
* @return array List of tags to save in cache
|
||||||
|
*/
|
||||||
|
public function get_tags()
|
||||||
|
{
|
||||||
|
$tags = array();
|
||||||
|
|
||||||
|
if (!empty($this->data['valarms'])) {
|
||||||
|
$tags[] = 'x-has-alarms';
|
||||||
|
}
|
||||||
|
|
||||||
|
// create tags reflecting participant status
|
||||||
|
if (is_array($this->data['attendees'])) {
|
||||||
|
foreach ($this->data['attendees'] as $attendee) {
|
||||||
|
if (!empty($attendee['email']) && !empty($attendee['status']))
|
||||||
|
$tags[] = 'x-partstat:' . $attendee['email'] . ':' . strtolower($attendee['status']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue