Possibility to filter valueInFieldAttribute with multiple value.

distribution graph support inherit distribution level
pull/3214/head
Sami Mokaddem 2018-04-23 14:14:06 +00:00
parent bdcecfb1e6
commit 02b4f32c4f
3 changed files with 11 additions and 5 deletions

View File

@ -805,7 +805,7 @@ class EventsController extends AppController {
* Search for a value on an attribute level for a specific field.
* $attribute : (array) an attribute
* $fields : (array) list of keys in attribute to search in
* $searchValue : Value to search
* $searchValue : Values to search ( '|' is the separator)
* returns true on match
*/
private function __valueInFieldAttribute($attribute, $fields, $searchValue) {
@ -817,8 +817,11 @@ class EventsController extends AppController {
if (isset($attribute[$field])) {
$temp_value = strtolower($attribute[$field]);
$temp_search = strtolower($searchValue);
if(strpos($temp_value, $temp_search) !==false) {
return true;
$temp_searches = explode('|', $temp_search);
foreach ($temp_searches as $s) {
if(strpos($temp_value, $s) !==false) {
return true;
}
}
}
}

View File

@ -3,7 +3,7 @@
$mayPublish = ($isAclPublish && $event['Orgc']['id'] == $me['org_id']);
?>
<div id="eventdistri_graph" style="height: 400px; width: 400px;" data-event-id="<?php echo h($event['Event']['id']); ?>" data-user-manipulation="<?php echo $mayModify || $isSiteAdmin ? 'true' : 'false'; ?>" data-extended="<?php echo $extended; ?>">
<div id="eventdistri_graph" style="height: 400px; width: 400px;" data-event-id="<?php echo h($event['Event']['id']); ?>" data-event-distribution="<?php echo h($event['Event']['distribution']); ?>" data-user-manipulation="<?php echo $mayModify || $isSiteAdmin ? 'true' : 'false'; ?>" data-extended="<?php echo $extended; ?>">
<canvas id="distribution_graph_canvas" width="100" height="100" ></canvas>
</div>

View File

@ -1,5 +1,6 @@
var url = "getDistributionGraph";
var scope_id = $('#eventdistri_graph').data('event-id');
var event_distribution = $('#eventdistri_graph').data('event-distribution');
var extended_text = $('#eventdistri_graph').data('extended') == 1 ? true : false;
var payload = {};
var chartColors = window.chartColors;
@ -11,7 +12,9 @@ function clickHandler(evt) {
var distribution_id;
if (firstPoint) {
distribution_id = distribution_chart.data.labels[firstPoint._index][1];
document.getElementById('attributesFilterField').value = distribution_id;
var value_to_set = distribution_id;
value_to_set += distribution_id == event_distribution ? '|' + '5' : '';
document.getElementById('attributesFilterField').value = value_to_set;
filterAttributes('distribution', '17');
}
}