@@ -68,59 +68,68 @@ function formCheck($reference_id, $sort) {
6868
6969 echo '<tbody> ' ;
7070
71- foreach ($ filteredDimensions as $ dimension => $ subdimensions ) {
72- foreach ($ subdimensions as $ subdimension => $ activity ) {
73- foreach ($ activity as $ activityName => $ content ) {
74- echo "<tr> " ;
75- echo "<td> $ dimension</td> " ;
76- echo "<td> $ subdimension</td> " ;
77- $ tooltip = "<div class='popoverdetails'> " . build_table_tooltip ( $ content ) . "</div> " ;
78- $ activityLink = "detail.php?dimension= " . urlencode ( $ dimension ) . "&subdimension= " . urlencode ( $ subdimension ) . "&element= " . urlencode ( $ activityName );
79- echo "<td><a href=' $ activityLink'><div data-toggle= \"popover \" data-title= \"$ activityName \" data-content= \"$ tooltip \" type= \"button \" data-html= \"true \"> " . $ activityName . "</div></a></td> " ;
80-
81- foreach ($ referenceLabels as $ r => $ rLabel ){
82- $ rlist = $ content ["references " ][$ r ] ?? array ();
83- echo "<td> " . renderSamms ($ rlist ) ."</td> " ;
84- }
71+ foreach (getActions ($ filteredDimensions ) as list ($ dimension , $ subdimension , $ activities )) {
72+ foreach ($ activities as $ activityName => $ activity ) {
73+ echo "<tr> " ;
74+ echo "<td> $ dimension</td> " ;
75+ echo "<td> $ subdimension</td> " ;
76+ $ activityLink = "detail.php? " .
77+ http_build_query (array (
78+ "dimension " => $ dimension ,
79+ "subdimension " => $ subdimension ,
80+ "element " => $ activityName
81+ ));
82+ echo "<td><a href=' $ activityLink'> "
83+ .div_tooltip ($ activityName , $ activityName , build_table_tooltip ( $ activity ))
84+ ."</a></td> " ;
85+
86+ foreach ($ referenceLabels as $ r => $ rLabel ){
87+ $ rlist = $ activity ["references " ][$ r ] ?? array ();
88+ echo "<td> " . renderSamms ($ rlist ) ."</td> " ;
8589 }
8690 }
8791 }
88- } else {
89- echo '<table class="table"> ' ;
90- $ headings = array_merge (array ("$ sort " ), $ headings , array_keys (getReferenceLabels ()));
91- thead ($ headings );
92-
93- echo '<tbody> ' ;
94- $ mapping = array ();
95-
96-
92+ } else { // sort by samm2, iso, samm
9793 // populate mapping:
9894 // mapping = value, activity, content
99- foreach ($ filteredDimensions as $ dimension => $ subdimensions ) {
100- foreach ($ subdimensions as $ subdimension => $ activity ) {
101- foreach ($ activity as $ activityName => $ content ) {
102- $ content ["dimension " ] = $ dimension ;
103- $ content ["subdimension " ] = $ subdimension ;
104-
105- $ references = $ content ["references " ][$ sort ] ?? array ();
106- foreach (as_list ($ references ) as $ mappingContent ) {
107- $ mapping [$ mappingContent ][$ activityName ] = $ content ;
108- }
95+ $ mapping = array ();
96+ foreach (getActions ($ filteredDimensions ) as list ($ dimension , $ subdimension , $ activities )) {
97+ foreach ($ activities as $ activityName => $ activity ) {
98+ $ activity ["dimension " ] = $ dimension ;
99+ $ activity ["subdimension " ] = $ subdimension ;
100+
101+ $ references = $ activity ["references " ][$ sort ] ?? array ();
102+ foreach (as_list ($ references ) as $ mappingContent ) {
103+ $ mapping [$ mappingContent ][$ activityName ] = $ activity ;
109104 }
110105 }
111106 }
112107
113- // render
108+
109+ // render table
110+ echo '<table class="table"> ' ;
111+ $ headings = array_merge (array ("$ sort " ), $ headings , array_keys (getReferenceLabels ()));
112+ thead ($ headings );
113+
114+ echo '<tbody> ' ;
115+
116+ // render mappings.
114117 ksort ($ mapping , SORT_NUMERIC );
115118 foreach ($ mapping as $ mappingName => $ mappingElement ) {
116119 foreach ($ mappingElement as $ activityName => $ activity ) {
117120 echo "<tr> " ;
118121 echo "<td> " . $ mappingName . "</td> " ;
119122 echo "<td> " . $ activity ['dimension ' ] . "</td> " ;
120123 echo "<td> " . $ activity ['subdimension ' ] . "</td> " ;
121- $ tooltip = "<div class='popoverdetails'> " . build_table_tooltip ( $ activity ) . "</div> " ;
122- $ activityLink = "detail.php?dimension= " . urlencode ( $ activity ['dimension ' ] ) . "&subdimension= " . urlencode ( $ activity ['subdimension ' ] ) . "&element= " . urlencode ( $ activityName );
123- echo "<td><a href=' $ activityLink'><div data-toggle= \"popover \" data-title= \"$ activityName \" data-content= \"$ tooltip \" type= \"button \" data-html= \"true \"> " . $ activityName . "</div></></td> " ;
124+ $ activityLink = "detail.php? " .
125+ http_build_query (array (
126+ "dimension " => $ dimension ,
127+ "subdimension " => $ subdimension ,
128+ "element " => $ activityName
129+ ));
130+ echo "<td><a href=' $ activityLink'> "
131+ .div_tooltip ($ activityName , $ activityName , build_table_tooltip ( $ activity ))
132+ ."</a></td> " ;
124133
125134 foreach ($ referenceLabels as $ r => $ rLabel ){
126135 $ rlist = $ activity ["references " ][$ r ] ?? array ();
0 commit comments