diff search_function.php @ 2:45cbafdec56e

modified code for updated db tables
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 25 Mar 2015 16:03:54 +0100
parents 38851c894301
children bc6ce492f15d
line wrap: on
line diff
--- a/search_function.php	Tue Mar 24 16:27:18 2015 +0100
+++ b/search_function.php	Wed Mar 25 16:03:54 2015 +0100
@@ -37,7 +37,6 @@
 	}
 	//books.name AS book_name, books.level1, books.level2, books.period, contents.books_id, contents.line, contents.content 
 
-	// TODO: book_info is now merged to books table
 	$query="SELECT books.level1 AS LEVEL1, books.level2 AS LEVEL2,
                         books.name AS Name, books.period AS PERIOD,
                         books.start_year AS 'TimeSpan:begin', books.end_year AS 'TimeSpan:end',
@@ -68,7 +67,7 @@
 
    		} else {
 			$subQuery="SELECT id, name, start_page, end_page 
-			FROM sections
+			FROM sections_index
 			WHERE books_id=".$row['BOOK_ID']." AND start_page<=".$row['PAGE']." AND end_page>=".$row['PAGE'];
    		}
 
@@ -111,11 +110,13 @@
 
 	$fp=fopen("./search_results/".$filename.".html","w");
 	fwrite($fp,$header);
-    $str="<a href='".$server_host."LGMap/get_coordinates_for_listed_books.php?file=".$filename.".csv&name=".$keywordStr."' target='_blank'>view the distribution on the map</a><br><br>";
-	fwrite($fp,$str);
+    $str="<a href='".$server_host."LGMap/get_coordinates_for_listed_books.php?file=".$filename.".csv&name=".$keywordStr."' target='_blank'>view the distribution on the map (click here at the first time)</a><br><br>";
+    $str.="<a href='".$server_host."LGMap/map.php?mode=1&file=".$filename.".csv&name=".$keywordStr."' target='_blank'>view the distribution on the map</a><br><br>";
+
 	$str.="<a href='".$system_root_url."search_results/".$filename.".html' target='_blank'>html version</a><br><br>";
 	// $str.="<a href='http://".$_SERVER['HTTP_HOST']."/LGSearch/search_results/".$filename.".html' target='_blank'>html version</a><br><br>";
 	echo $str;
+	fwrite($fp,$str);
 	echo sizeof($array)." result(s) of \"".$keywordStr."\" ";
 	fwrite($fp,sizeof($array)." result(s) of \"".$keywordStr."\"<br>");
 	$str="<table>";
@@ -136,18 +137,21 @@
 		fwrite($fp,$str);
 		echo $str;
 		foreach($row['SECTION'] as $section){
-			// TODO: config to current extraction-interface OR Toc OR not at all??
-			// redirect to LGServer
+
+			$str="<div class='section'><a>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>";
+			echo $str;
+			/*
+			// redirect to LGServer?
 			$str="<div class='section'><a href='".$lgserver_url."' target='_blank'>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>";
 			echo $str;
 			$str="<div class='section'><a href='".$lgserver_url."' target='_blank'>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>";
-			fwrite($fp,$str);
-			/*
+			*/
+			/* origial
 			$str="<div class='section'><a href='/interface/tagging_text.php?id=".$section['id']."' target='_blank'>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>";
 			echo $str;
 			$str="<div class='section'><a href='/interface/tagging_text.php?id=".$section['id']."' target='_blank'>".$section['name']."</a>p".$section['start_page']."-".$section['end_page']."</div>";
+			*/
 			fwrite($fp,$str);
-			*/
 		}
 		$str="<td>".$row['PAGE'];
 		if($tag==$NO_TAG){