This commit is contained in:
Vanessa Gil 2015-01-27 11:44:26 +01:00
parent 02fddf5f6f
commit dc4a6188a6
3 changed files with 40 additions and 2 deletions

View File

@ -2768,4 +2768,28 @@ function events_get_count_events_validated ($filter, $period, $date,
return $return;
}
function events_checks_event_tags($event_data, $acltags) {
global $config;
if (empty($acltags[$event_data['id_grupo']])) {
return true;
} else {
$tags_arr_acl = explode(',',$acltags[$event_data['id_grupo']]);
$tags_arr_event = explode(',',$event_data['tags']);
foreach ($tags_arr_acl as $tag) {
$tag_name = tags_get_name($tag);
if (in_array($tag_name, $tags_arr_event)) {
return true;
} else {
$has_tag = false;
}
}
if (!$has_tag) {
return false;
}
}
return false;
}
?>

View File

@ -991,7 +991,8 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
if ($force_group_and_tag) {
if (!empty($all_tags[$tag])) {
$tags_condition .= sprintf('(tags = "%s"',io_safe_input($all_tags[$tag]));
//~ $tags_condition .= sprintf('(tags = "%s"',io_safe_input($all_tags[$tag]));
$tags_condition .= "(tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
$childrens = groups_get_childrens($group_id, null, true);
if (empty($childrens)) {
@ -1009,7 +1010,8 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
$tags_condition .= "id_grupo = ".$group_id;
}
} else {
$tags_condition .= sprintf('tags = "%s"',io_safe_input($all_tags[$tag]));
//~ $tags_condition .= sprintf('tags = "%s"',io_safe_input($all_tags[$tag]));
$tags_condition .= "tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
}
}
}

View File

@ -564,6 +564,18 @@ else {
$history);
}
if (!empty($result)) {
//~ Checking the event tags exactly. The event query filters approximated tags to keep events
//~ with several tags
$acltags = tags_get_user_module_and_tags ($config['id_user'],'ER', true);
foreach ($result as $key=>$event_data) {
$has_tags = events_checks_event_tags($event_data, $acltags);
if (!$has_tags) {
unset($result[$key]);
}
}
}
if (!empty($result)) {
$graph = '<div style="width: 350px; margin: 0 auto;">' .