comparison views/Extractapp/ExportTable.php @ 117:e6b516fa7b60 extractapp

1. add new columns : book year and edition year. 2. remove duplicate column : time.
author Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
date Thu, 28 Sep 2017 17:45:30 +0200
parents b0cecc104639
children
comparison
equal deleted inserted replaced
116:0ef426b5a1b9 117:e6b516fa7b60
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with Extraction-interface. If not, see <http://www.gnu.org/licenses/>. 17 * along with Extraction-interface. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 /*! \file 19 /*! \file
20 * This is the view for ExportTable. 20 * This is the view for ExportTable.
21 * It shows a html table with each row as a topic object and each column as a tag/attribute. 21 * It shows a html table with each row as a topic object and each column as a tag/attribute.
22 */ 22 */
23 23
24 // --- initialize --- 24 // --- initialize ---
25 $outputTableArray = $viewmodel['outputTableArray']; 25 $outputTableArray = $viewmodel['outputTableArray'];
26 $bookId = $viewmodel['bookId']; 26 $bookId = $viewmodel['bookId'];
32 ?> 32 ?>
33 33
34 <html> 34 <html>
35 <head> 35 <head>
36 <title></title> 36 <title></title>
37 <?php include 'views/maintemplate.php'; ?>
38 <style>
37 39
40 td {
41 padding: 0px 5px;
42 white-space: nowrap;
43 }
44 </style>
38 </head> 45 </head>
39 46
40 <body> 47 <body>
41 <table width="100%" border="1" id="tableMain"> 48 <table width="100%" border="1" id="tableMain">
42 49
43 <?php 50 <?php
44 $count=1; 51 $count=1;
45 foreach ( $outputTableArray as $trIndex =>$trValue ) { 52 foreach ( $outputTableArray as $trIndex =>$trValue ) {
46 echo "<tr>"; 53 echo "<tr>";
47 if ( $trIndex==0 ) { 54 if ( $trIndex==0 ) {
48 echo "<td>#</td>"; 55 echo "<td align='center'>#</td>";
49 echo "<td>Book ID</td>"; 56 echo "<td>Book ID</td>";
50 echo "<td>Section ID</td>"; 57 echo "<td>Section ID</td>";
51 echo "<td>方志</td>"; 58 echo "<td>方志</td>";
52 echo "<td>部</td>"; 59 echo "<td>部</td>";
60 echo "<td>Book Year</td>";
61 echo "<td>Edition Year</td>";
53 echo "<td>方志地點</td>"; 62 echo "<td>方志地點</td>";
54 echo "<td>經度(x)</td>"; // longitude 63 echo "<td>經度(x)</td>"; // longitude
55 echo "<td>緯度(y)</td>"; // latitude 64 echo "<td>緯度(y)</td>"; // latitude
56 echo "<td>Description</td>"; // description 65 echo "<td>Description</td>"; // description
57 66
58 } else { 67 } else {
59 echo "<td>".$count++."</td>"; 68 echo "<td align='center'>".$count++."</td>";
60 echo "<td>".$bookId."</td>"; 69 echo "<td>".$bookId."</td>";
61 echo "<td>".$sectionid."</td>"; 70 echo "<td>".$sectionid."</td>";
62 echo "<td>".$bookName."</td>"; 71 echo "<td>".$bookName."</td>";
63 echo "<td>".$sectionName."</td>"; 72 echo "<td>".$sectionName."</td>";
73 echo "<td>".$bookMeta->book_year."</td>";
74 echo "<td>".$bookMeta->edition_year."</td>";
75 echo "<td>".$sectionName."</td>";
64 echo "<td>".$bookMeta->place_name."</td>"; 76 echo "<td>".$bookMeta->place_name."</td>";
65 echo "<td>".$bookMeta->x."</td>"; 77 echo "<td>".$bookMeta->x."</td>";
66 echo "<td>".$bookMeta->y."</td>"; 78 echo "<td>".$bookMeta->y."</td>";
67 echo "<td>".$bookName."_".$sectionName."</td>"; // description for LGMap 79 echo "<td>".$bookName."_".$sectionName."</td>"; // description for LGMap
68 80
69 } 81 }
70 if ( isset( $trValue["page"] ) ) { 82 if ( isset( $trValue["page"] ) ) {
71 echo "<td>".$trValue["page"]."</td>"; 83 echo "<td >".$trValue["page"]."</td>";
72 } else { 84 } else {
73 echo "<td>&nbsp;</td>"; 85 echo "<td>&nbsp;</td>";
74 } 86 }
75 /* 87 /*
76 foreach ( $outputTableArray[0][1] as $index => $value ) { 88 foreach ( $outputTableArray[0][1] as $index => $value ) {
80 echo "<td>&nbsp;</td>"; 92 echo "<td>&nbsp;</td>";
81 } 93 }
82 } 94 }
83 */ 95 */
84 foreach ( $outputTableArray[0][0] as $index => $value ) { 96 foreach ( $outputTableArray[0][0] as $index => $value ) {
85 if ( $index == "time" ) { 97 //if ( $index == "time" ) {
98 //if ( isset( $trValue[0][$index] ) ) {
99 // echo "<td>".$trValue[0][$index]."</td>";
100 // echo "<td>".$trValue[0][$index]."</td>";
101 //} else {
102 // echo "<td>&nbsp;</td>";
103 // echo "<td>&nbsp;</td>";
104 //}
105 //} else {
86 if ( isset( $trValue[0][$index] ) ) { 106 if ( isset( $trValue[0][$index] ) ) {
87 echo "<td>".$trValue[0][$index]."</td>"; 107 echo "<td >".$trValue[0][$index]."</td>";
88 echo "<td>".$trValue[0][$index]."</td>";
89 } else {
90 echo "<td>&nbsp;</td>";
91 echo "<td>&nbsp;</td>";
92 }
93 } else {
94 if ( isset( $trValue[0][$index] ) ) {
95 echo "<td>".$trValue[0][$index]."</td>";
96 } else { 108 } else {
97 echo "<td>&nbsp;</td>"; 109 echo "<td>&nbsp;</td>";
98 } 110 }
99 } 111 //}
100 } 112 }
101
102 113
114 /* remove other, full columns
103 if ( isset( $trValue["other"] ) ) { 115 if ( isset( $trValue["other"] ) ) {
104 echo "<td>".$trValue["other"]."</td>"; 116 echo "<td>".$trValue["other"]."</td>";
105 } else { 117 } else {
106 echo "<td>&nbsp;</td>"; 118 echo "<td>&nbsp;</td>";
107 } 119 }
108 if ( isset( $trValue["full"] ) ) { 120 if ( isset( $trValue["full"] ) ) {
109 echo "<td>".$trValue["full"]."</td>"; 121 echo "<td>".$trValue["full"]."</td>";
110 } else { 122 } else {
111 echo "<td>&nbsp;</td>"; 123 echo "<td>&nbsp;</td>";
112 } 124 }
113 125 */
126
114 127
115 echo "</tr>"; 128 echo "</tr>";
116 } 129 }
117 ?> 130 ?>
118 </table> 131 </table>