mirror of https://github.com/MISP/MISP
fix: [taxonomies] Counts fixed
parent
e028c1a886
commit
e8263467df
|
@ -56,8 +56,22 @@ class TaxonomiesController extends AppController
|
|||
if (empty($taxonomy)) {
|
||||
throw new NotFoundException('Taxonomy not found.');
|
||||
}
|
||||
$this->loadModel('EventTag');
|
||||
$this->loadModel('AttributeTag');
|
||||
foreach ($taxonomy['entries'] as $key => $value) {
|
||||
$taxonomy['entries'][$key]['events'] = empty($value['existing_tag']) ? 0 : count($value['existing_tag']['EventTag']);
|
||||
$count = 0;
|
||||
if (!empty($value['existing_tag'])) {
|
||||
foreach ($value['existing_tag'] as $et) {
|
||||
$count = $this->EventTag->find('count', array(
|
||||
'conditions' => array('EventTag.tag_id' => $et['id'])
|
||||
));
|
||||
$count_a = $this->AttributeTag->find('count', array(
|
||||
'conditions' => array('AttributeTag.tag_id' => $et['id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$taxonomy['entries'][$key]['events'] = $count;
|
||||
$taxonomy['entries'][$key]['attributes'] = $count_a;
|
||||
}
|
||||
$this->set('filter', $filter);
|
||||
$customPagination = new CustomPaginationTool();
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<?php
|
||||
if ($item['existing_tag']) {
|
||||
?>
|
||||
<a href='<?php echo $baseurl."/events/index/searchtag:". h($item['existing_tag']['Tag']['id']);?>'><?php echo count($item['existing_tag']['EventTag']);?></a>
|
||||
<a href='<?php echo $baseurl."/events/index/searchtag:". h($item['existing_tag']['Tag']['id']);?>'><?php echo h($item['events']);?></a>
|
||||
<?php
|
||||
} else {
|
||||
echo __('N/A');
|
||||
|
@ -113,7 +113,7 @@
|
|||
<?php
|
||||
if ($item['existing_tag']):
|
||||
?>
|
||||
<a href='<?php echo $baseurl."/attributes/search/tags:". h($item['existing_tag']['Tag']['id']);?>'><?php echo count($item['existing_tag']['AttributeTag']);?></a>
|
||||
<a href='<?php echo $baseurl."/attributes/search/tags:". h($item['existing_tag']['Tag']['id']);?>'><?php echo h($item['attributes']);?></a>
|
||||
<?php
|
||||
else:
|
||||
echo __('N/A');
|
||||
|
|
Loading…
Reference in New Issue