chg: Added event info in feed correlations via a popover

pull/1215/merge
iglocska 2017-05-31 10:07:29 +02:00
parent e11d110331
commit 7321e26151
2 changed files with 17 additions and 2 deletions

View File

@ -387,13 +387,28 @@ class FeedsController extends AppController {
$this->params->params['paging'] = array($this->modelClass => $params);
$resultArray = $this->Feed->getFreetextFeedCorrelations($resultArray, $feed['Feed']['id']);
// remove all duplicates
$correlatingEvents = array();
foreach ($resultArray as $k => $v) {
for ($i = 0; $i < $k; $i++) {
if (isset($resultArray[$i]) && $v == $resultArray[$i]) unset($resultArray[$k]);
else {
if (!empty($resultArray[$k]['correlations'])) {
foreach ($resultArray[$k]['correlations'] as $correlatingEvent) {
if (!in_array($correlatingEvent, $correlatingEvents)) {
$correlatingEvents[] = $correlatingEvent;
}
}
}
}
}
}
$resultArray = array_values($resultArray);
$this->loadModel('Attribute');
$correlatingEventInfos = $this->Attribute->Event->find('list', array(
'fields' => array('Event.id', 'Event.info'),
'conditions' => array('Event.id' => $correlatingEvents)
));
$this->set('correlatingEventInfos', $correlatingEventInfos);
$this->set('distributionLevels', $this->Attribute->distributionLevels);
$this->set('feed', $feed);
$this->set('attributes', $resultArray);

View File

@ -51,7 +51,7 @@
if (isset($attribute['correlations'])):
foreach ($attribute['correlations'] as $correlation):
?>
<a href="<?php echo $baseurl; ?>/events/view/<?php echo h($correlation); ?>"><?php echo h($correlation); ?></a>
<a href="<?php echo $baseurl; ?>/events/view/<?php echo h($correlation); ?>" data-toggle="popover" data-content="<?php echo h($correlatingEventInfos[$correlation]);?>" data-trigger="hover"><?php echo h($correlation); ?></a>
<?php
endforeach;
endif;
@ -98,7 +98,7 @@
var data = [];
$(document).ready(function() {
popoverStartup();
});
$('#FetchSelected').click(freetextFeedFetchSelected);