summaryrefslogtreecommitdiff
path: root/plugins/libkolab
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/libkolab')
-rw-r--r--plugins/libkolab/lib/kolab_format_configuration.php8
-rw-r--r--plugins/libkolab/lib/kolab_storage_cache_configuration.php22
-rw-r--r--plugins/libkolab/lib/kolab_storage_config.php25
3 files changed, 38 insertions, 17 deletions
diff --git a/plugins/libkolab/lib/kolab_format_configuration.php b/plugins/libkolab/lib/kolab_format_configuration.php
index 11f934f..6b71f3e 100644
--- a/plugins/libkolab/lib/kolab_format_configuration.php
+++ b/plugins/libkolab/lib/kolab_format_configuration.php
@@ -208,8 +208,14 @@ class kolab_format_configuration extends kolab_format
{
$tags = array();
- if ($this->data['type'] == 'dictionary') {
+ switch ($this->data['type']) {
+ case 'dictionary':
$tags = array($this->data['language']);
+ break;
+
+ case 'relation':
+ $tags = array('category:' . $this->data['category']);
+ break;
}
return $tags;
diff --git a/plugins/libkolab/lib/kolab_storage_cache_configuration.php b/plugins/libkolab/lib/kolab_storage_cache_configuration.php
index 8380aa8..97315da 100644
--- a/plugins/libkolab/lib/kolab_storage_cache_configuration.php
+++ b/plugins/libkolab/lib/kolab_storage_cache_configuration.php
@@ -37,4 +37,24 @@ class kolab_storage_cache_configuration extends kolab_storage_cache
return $sql_data;
}
-} \ No newline at end of file
+
+ /**
+ * Helper method to compose a valid SQL query from pseudo filter triplets
+ */
+ protected function _sql_where($query)
+ {
+ if (is_array($query)) {
+ foreach ($query as $idx => $param) {
+ // convert category filter
+ if ($param[0] == 'category') {
+ $param[2] = array_map(function($n) { return 'category:' . $n; }, (array) $param[2]);
+
+ $query[$idx][0] = 'tags';
+ $query[$idx][2] = count($param[2]) > 1 ? $param[2] : $param[2][0];
+ }
+ }
+ }
+
+ return parent::_sql_where($query);
+ }
+}
diff --git a/plugins/libkolab/lib/kolab_storage_config.php b/plugins/libkolab/lib/kolab_storage_config.php
index a80cf46..beaa928 100644
--- a/plugins/libkolab/lib/kolab_storage_config.php
+++ b/plugins/libkolab/lib/kolab_storage_config.php
@@ -103,14 +103,13 @@ class kolab_storage_config
/**
* Get configuration objects
*
- * @param array $filter Search filter
- * @param bool $default Enable to get objects only from default folder
- * @param array $data_filter Additional object data filter
- * @param int $limit Max. number of records (per-folder)
+ * @param array $filter Search filter
+ * @param bool $default Enable to get objects only from default folder
+ * @param int $limit Max. number of records (per-folder)
*
* @return array List of objects
*/
- public function get_objects($filter = array(), $default = false, $data_filter = array(), $limit = 0)
+ public function get_objects($filter = array(), $default = false, $limit = 0)
{
$list = array();
@@ -126,12 +125,6 @@ class kolab_storage_config
}
foreach ($folder->select($filter) as $object) {
- foreach ($data_filter as $key => $val) {
- if ($object[$key] != $val) {
- continue 2;
- }
- }
-
$list[] = $object;
}
}
@@ -624,11 +617,13 @@ class kolab_storage_config
public function get_tags($uid = '*')
{
if (!isset($this->tags)) {
- $filter = array(array('type', '=', 'relation'));
- $default = true;
- $data_filter = array('category' => 'tag');
+ $default = true;
+ $filter = array(
+ array('type', '=', 'relation'),
+ array('category', '=', 'tag')
+ );
- $this->tags = $this->get_objects($filter, $default, $data_filter);
+ $this->tags = $this->get_objects($filter, $default);
}
if ($uid === '*') {