Save event categories and 'has alarm' information as tags in cache
This commit is contained in:
parent
3ec99f89a6
commit
3f5712a117
1 changed files with 50 additions and 0 deletions
|
@ -26,6 +26,8 @@ class kolab_format_event extends kolab_format
|
|||
{
|
||||
public $CTYPE = 'application/calendar+xml';
|
||||
|
||||
public static $fulltext_cols = array('title', 'description', 'location', 'attendees:name', 'attendees:email');
|
||||
|
||||
private $sensitivity_map = array(
|
||||
'public' => kolabformat::ClassPublic,
|
||||
'private' => kolabformat::ClassPrivate,
|
||||
|
@ -468,6 +470,54 @@ class kolab_format_event extends kolab_format
|
|||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
foreach ((array)$this->data['categories'] as $cat) {
|
||||
$tags[] = rcube_utils::normalize_string($cat);
|
||||
}
|
||||
|
||||
if (!empty($this->data['alarms'])) {
|
||||
$tags[] = 'x-has-alarms';
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for kolab_storage_cache to get words to index for fulltext search
|
||||
*
|
||||
* @return array List of words to save in cache
|
||||
*/
|
||||
public function get_words()
|
||||
{
|
||||
$data = '';
|
||||
foreach (self::$fulltext_cols as $colname) {
|
||||
list($col, $field) = explode(':', $colname);
|
||||
|
||||
if ($field) {
|
||||
$a = array();
|
||||
foreach ((array)$this->data[$col] as $attr)
|
||||
$a[] = $attr[$field];
|
||||
$val = join(' ', $a);
|
||||
}
|
||||
else {
|
||||
$val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : $this->data[$col];
|
||||
}
|
||||
|
||||
if (strlen($val))
|
||||
$data .= $val . ' ';
|
||||
}
|
||||
|
||||
return array_unique(rcube_utils::normalize_string($data, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data from old Kolab2 format
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue