view 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
line wrap: on
line source

<?php
/*
 * ExportTable.php
 * This file is part of Extraction-interface.
 *
 * Extraction-interface is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Extraction-interface is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Extraction-interface.  If not, see <http://www.gnu.org/licenses/>.
*/
/*! \file
 * This is the view for ExportTable.
 * It shows a html table with each row as a topic object and each column as a tag/attribute.
*/

// --- initialize ---
$outputTableArray = $viewmodel['outputTableArray'];
$bookId = $viewmodel['bookId'];
$sectionid = $viewmodel['section_id'];
$bookName = $viewmodel['bookName'];
$sectionName = $viewmodel['sectionName'];
$bookMeta = $viewmodel['bookMeta'];

?>

<html>
<head>
<title></title>
<?php include 'views/maintemplate.php'; ?>
<style>

td {
   padding: 0px 5px;
   white-space: nowrap;
}
</style>
</head>

<body>
<table width="100%" border="1" id="tableMain">

<?php
$count=1;
	foreach ( $outputTableArray as $trIndex =>$trValue ) {
		echo "<tr>";
		if ( $trIndex==0 ) {
			echo "<td align='center'>#</td>";
			echo "<td>Book ID</td>";
			echo "<td>Section ID</td>";
			echo "<td>方志</td>";
			echo "<td>部</td>";
            echo "<td>Book Year</td>";
            echo "<td>Edition Year</td>";
			echo "<td>方志地點</td>";
			echo "<td>經度(x)</td>";	// longitude
			echo "<td>緯度(y)</td>";	// latitude
			echo "<td>Description</td>";	// description

		} else {
			echo "<td align='center'>".$count++."</td>";
			echo "<td>".$bookId."</td>";
			echo "<td>".$sectionid."</td>";
			echo "<td>".$bookName."</td>";
			echo "<td>".$sectionName."</td>";
            echo "<td>".$bookMeta->book_year."</td>";
            echo "<td>".$bookMeta->edition_year."</td>";
            echo "<td>".$sectionName."</td>";
			echo "<td>".$bookMeta->place_name."</td>";
			echo "<td>".$bookMeta->x."</td>";
			echo "<td>".$bookMeta->y."</td>";
			echo "<td>".$bookName."_".$sectionName."</td>";	// description for LGMap

		}
		if ( isset( $trValue["page"] ) ) {
			echo "<td >".$trValue["page"]."</td>";
		} else {
			echo "<td>&nbsp;</td>";
		}
		/*
		foreach ( $outputTableArray[0][1] as $index => $value ) {
			if ( isset( $trValue[1][$index] ) ) {
				echo "<td>".$trValue[1][$index]."</td>";
			} else {
				echo "<td>&nbsp;</td>";
			}
		}
		*/
		foreach ( $outputTableArray[0][0] as $index => $value ) {
			//if ( $index == "time" ) {
			//if ( isset( $trValue[0][$index] ) ) {
			//	echo "<td>".$trValue[0][$index]."</td>";
			//		echo "<td>".$trValue[0][$index]."</td>";
			//} else {
			//	echo "<td>&nbsp;</td>";
			//	echo "<td>&nbsp;</td>";
			//}
			//} else {
				if ( isset( $trValue[0][$index] ) ) {
					echo "<td >".$trValue[0][$index]."</td>";
				} else {
					echo "<td>&nbsp;</td>";
				}
			//}
		}

        /* remove other, full columns
		if ( isset( $trValue["other"] ) ) {
			echo "<td>".$trValue["other"]."</td>";
		} else {
			echo "<td>&nbsp;</td>";
		}
		if ( isset( $trValue["full"] ) ) {
			echo "<td>".$trValue["full"]."</td>";
		} else {
			echo "<td>&nbsp;</td>";
		}
        */


		echo "</tr>";
	}
?>
</table>
</body>
</html>