fix: [UI] Passing the distribution, threat level & analysis description for the edit event view

pull/5404/head
chrisr3d 2019-11-12 14:54:41 +01:00
parent f750d211af
commit 5ed87a6f78
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 8 additions and 9 deletions

View File

@ -2395,32 +2395,31 @@ class EventsController extends AppController
$this->set('sharingGroups', $sgs);
// tooltip for distribution
$info = array();
$fieldDesc = array();
$distributionLevels = $this->Event->distributionLevels;
if (empty($sgs)) {
unset($distributionLevels[4]);
}
$this->set('distributionLevels', $distributionLevels);
foreach ($distributionLevels as $key => $value) {
$info['distribution'][$key] = array('key' => $value, 'desc' => $this->Event->distributionDescriptions[$key]['formdesc']);
$fieldDesc['distribution'][$key] = $this->Event->distributionDescriptions[$key]['formdesc'];
}
// combobox for risks
$threat_levels = $this->Event->ThreatLevel->find('all');
$this->set('threatLevels', Set::combine($threat_levels, '{n}.ThreatLevel.id', '{n}.ThreatLevel.name'));
foreach ($threat_levels as $key => $threat_level) {
$info['threat_level'][$threat_level['ThreatLevel']['id']] = array('key' => $threat_level['ThreatLevel']['name'], 'desc' => $threat_level['ThreatLevel']['form_description']);
}
$fieldDesc['threat_level'] = Set::combine($threat_levels, '{n}.ThreatLevel.id', '{n}.ThreatLevel.description');
// combobox for analysis
$this->set('sharingGroups', $sgs);
// tooltip for analysis
foreach ($this->Event->analysisLevels as $key => $value) {
$info['analysis'][$key] = array('key' => $value, 'desc' => $this->Event->analysisDescriptions[$key]['formdesc']);
$analysisLevels = $this->Event->analysisLevels;
foreach ($analysisLevels as $key => $value) {
$fieldDesc['analysis'][$key] = $this->Event->analysisDescriptions[$key]['formdesc'];
}
$this->set('analysisLevels', $this->Event->analysisLevels);
$this->set('analysisLevels', $analysisLevels);
$this->set('info', $info);
$this->set('fieldDesc', $fieldDesc);
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
$this->set('event', $this->Event->data);
}