forked from devsecopsmaturitymodel/DevSecOps-MaturityModel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmappings.php
More file actions
139 lines (130 loc) · 5.48 KB
/
mappings.php
File metadata and controls
139 lines (130 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
include_once "head.php";
?>
<body>
<?php
include_once "navi.php";
?>
<?php
include_once "data.php";
include_once "detail.php";
$mappingExists = array();
$noMappingExists = array();
if(array_key_exists("sort", $_GET)) {
$sort = $_GET["sort"];
}else {
$sort = "activity";
}
?>
<form method="get">
<div class="form-check">
<input class="form-check-input" type="radio" name="sort" id="exampleRadios1" value="activity" <?php if($_GET['sort'] == "activity") echo "checked"; ?>>
<label class="form-check-label" for="exampleRadios1">
Activity
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="sort" id="exampleRadios2" value="samm2" <?php if($_GET['sort'] == "samm2") echo "checked"; ?>>
<label class="form-check-label" for="exampleRadios2">
SAMM 2
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="sort" id="exampleRadios3" value="iso27001-2017" <?php if($_GET['sort'] == "iso27001-2017") echo "checked"; ?>>
<label class="form-check-label" for="exampleRadios3">
ISO27001:27001
</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" name="performed" id="exampleCheck1" value="true" <?php if($showPerformed) {echo " checked=checked";}?>>
<label class="form-check-label" for="exampleCheck1">Show performed activities</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" name="planned" id="exampleCheck2" value="true" <?php if($showPlanned) {echo " checked=checked";} ?>>
<label class="form-check-label" for="exampleCheck2">Show planned activities</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<?php
if($sort == "activity") {
?>
<table class="table">
<thead>
<tr>
<th scope="col">Dimension</th>
<th scope="col">Subdimension</th>
<th scope="col">Actvity</th>
<th scope="col">SAMM 2</th>
<th scope="col">ISO 27001 Controls</th>
</tr>
</thead>
<tbody>
<?php
foreach ($filteredDimensions as $dimension => $subdimensions) {
foreach ($subdimensions as $subdimension => $activity) {
foreach ($activity as $activityName => $content) {
echo "<tr>";
echo "<td>$dimension</td>";
echo "<td>$subdimension</td>";
$tooltip = "<div class='popoverdetails'>" . build_table_tooltip ( $content ) . "</div>";
$activityLink = "detail.php?dimension=" . urlencode ( $dimension ) . "&subdimension=" . urlencode ( $subdimension ) . "&element=" . urlencode ( $activityName );
echo "<td><a href='$activityLink'><div data-toggle=\"popover\" data-title=\"$activityName\" data-content=\"$tooltip\" type=\"button\" data-html=\"true \">" . $activityName . "</div></a></td>";
echo "<td>" . getFlattenedArray($content, "samm2") . "</td>";
echo "<td>" . getFlattenedArray($content, "iso27001-2017") . "</td>";
}
}
}
} else {
?>
<table class="table">
<thead>
<tr>
<?php
if($sort == "iso27001-2017") {
echo '<th scope="col">ISO 27001 Control</th>';
}else {
echo '<th scope="col">' . $sort . '</th>';
}
?>
<th scope="col">Dimension</th>
<th scope="col">Subdimension</th>
<th scope="col">Actvity</th>
<th scope="col">SAMM 2</th>
<th scope="col">ISO 27001</th>
</tr>
</thead>
<tbody>
<?php
$mapping = array();
foreach ($filteredDimensions as $dimension => $subdimensions) {
foreach ($subdimensions as $subdimension => $activity) {
foreach ($activity as $activityName => $content) {
$content["dimension"] = $dimension;
$content["subdimension"] = $subdimension;
if($sort != "samm2") {
foreach($content[$sort] as $mappingContent)
$mapping[$mappingContent][$activityName] = $content;
}else {
$mappingValue = str_replace("|", "-", $content[$sort]);
$mapping[$mappingValue][$activityName] = $content;
}
}
}
}
ksort($mapping, SORT_NUMERIC);
foreach($mapping as $mappingName => $mappingElement) {
foreach($mappingElement as $activityName => $activity) {
echo "<tr>";
echo "<td>" . $mappingName . "</td>";
echo "<td>" . $activity['dimension'] . "</td>";
echo "<td>" . $activity['subdimension'] . "</td>";
$tooltip = "<div class='popoverdetails'>" . build_table_tooltip ( $activity ) . "</div>";
$activityLink = "detail.php?dimension=" . urlencode ( $activity['dimension'] ) . "&subdimension=" . urlencode ( $activity['subdimension'] ) . "&element=" . urlencode ( $activityName );
echo "<td><a href='$activityLink'><div data-toggle=\"popover\" data-title=\"$activityName\" data-content=\"$tooltip\" type=\"button\" data-html=\"true \">" . $activityName . "</div></></td>";
echo "<td>" . getFlattenedArray($activity, "samm2") . "</td>";
echo "<td>" . getFlattenedArray($content, "iso27001-2017") . "</td>";
}
}
}
echo "</table>";
//var_dump($noMappingExists);