pc_get_res_preview.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. include "./config.php";
  3. include "./_pdo.php";
  4. ?>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  9. <style>
  10. .word {
  11. width: Auto;
  12. float: left;
  13. margin:0 0.5em 1.8em 0;
  14. }
  15. .pali{
  16. font-weight: 500;
  17. font-size: 110%;
  18. padding: 0px 2px;
  19. margin: 0px;
  20. font-weight: 500;
  21. }
  22. .mean {
  23. font-weight: 500;
  24. padding: 0px 2px;
  25. margin: 0px;
  26. }
  27. .org, .om, .case {
  28. font-size: 80%;
  29. margin: 0.3em 0;
  30. clear: both;
  31. margin:0;
  32. }
  33. .cls{
  34. clear:both;
  35. }
  36. h1{
  37. margin-left:0em;
  38. }
  39. h2{
  40. margin-left:1em;
  41. }
  42. h3{
  43. margin-left:2em;
  44. }
  45. h4{
  46. margin-left:3em;
  47. }
  48. h5{
  49. margin-left:4em;
  50. }
  51. h6{
  52. margin-left:5em;
  53. }
  54. h7{
  55. margin-left:6em;
  56. }
  57. h8{
  58. margin-left:7em;
  59. }
  60. </style>
  61. <script>
  62. function mOver(obj)
  63. {
  64. obj.style.color="red"
  65. }
  66. function mOut(obj)
  67. {
  68. obj.style.color="black"
  69. }
  70. </script>
  71. </head>
  72. <body>
  73. <?php
  74. $get_res_type = $_GET["res_type"];
  75. $get_book = $_GET["book"];
  76. $get_par_begin = $_GET["begin"];
  77. $get_par_end = $_GET["end"];
  78. $language = $_GET["language"];
  79. $author = $_GET["author"];
  80. $editor = $_GET["editor"];
  81. $revision = $_GET["revision"];
  82. $edition = $_GET["edition"];
  83. $subver = $_GET["subver"];
  84. echo "Type:$get_res_type<br />";
  85. echo "book:$get_book<br />";
  86. echo "par_begin:$get_par_begin<br />";
  87. echo "par_end:$get_par_end<br />";
  88. echo "language:$language<br />";
  89. echo "author:$author<br />";
  90. echo "editor:$editor<br />";
  91. $outHtml = "";
  92. if ($author == "templet") {
  93. switch ($get_res_type) {
  94. case "wbw":
  95. $db_file = "../appdata/palicanon/templet/" . $get_book . "_tpl.db3";
  96. break;
  97. case "heading":
  98. //$db_file = "../appdata/palicanon/templet/toc.db3";
  99. $db_file = "../appdata/palicanon/pali_text/" . $get_book . "_pali.db3";
  100. break;
  101. }
  102. } else {
  103. switch ($get_res_type) {
  104. case "heading":
  105. $db_file = "../appdata/palicanon/heading/toc.db3";
  106. break;
  107. default:
  108. $db_file = "../appdata/palicanon/" . $get_res_type . "/" . $get_book . "_" . $get_res_type . ".db3";
  109. break;
  110. }
  111. }
  112. //open database
  113. PDO_Connect("$db_file");
  114. switch ($get_res_type) {
  115. case "translate":
  116. case "note":
  117. $query = "SELECT * FROM \"data\" WHERE (\"paragraph\" BETWEEN " . $PDO->quote($get_par_begin) . " AND " . $PDO->quote($get_par_end) . ") AND \"language\" = " . $PDO->quote($language) . " AND \"author\" = " . $PDO->quote($author) . " AND \"editor\" = " . $PDO->quote($editor) . " AND \"edition\" = " . $PDO->quote($edition) . " AND \"subver\" = " . $PDO->quote($subver);
  118. $Fetch = PDO_FetchAll($query);
  119. $iFetch = count($Fetch);
  120. if ($iFetch > 0) {
  121. for ($i = 0; $i < $iFetch; $i++) {
  122. switch ($get_res_type) {
  123. case "translate":
  124. $outHtml = "<p>" . $Fetch[$i]["text"] . "</p>";
  125. break;
  126. case "note":
  127. $outHtml = "<p>" . $Fetch[$i]["text"] . "</p>";
  128. break;
  129. break;
  130. }
  131. echo $outHtml;
  132. }
  133. }
  134. break;
  135. case "heading":
  136. if ($author == "templet") {
  137. $query = "SELECT * FROM \"data\" WHERE \"book\" = " . $PDO->quote($get_book) . " AND (\"paragraph\" BETWEEN " . $PDO->quote($get_par_begin) . " AND " . $PDO->quote($get_par_end) . ") AND \"level\">'0'";
  138. } else {
  139. $query = "SELECT * FROM \"data\" WHERE book=" . $PDO->quote($get_book) . " AND (\"paragraph\" BETWEEN " . $PDO->quote($get_par_begin) . " AND " . $PDO->quote($get_par_end) . ") AND \"language\" = " . $PDO->quote($language) . " AND \"author\" = " . $PDO->quote($author) . " AND \"editor\" = " . $PDO->quote($editor) . " AND \"edition\" = " . $PDO->quote($edition);
  140. }
  141. $Fetch = PDO_FetchAll($query);
  142. $iFetch = count($Fetch);
  143. if ($iFetch > 0) {
  144. for ($i = 0; $i < $iFetch; $i++) {
  145. $level = $Fetch[$i]["level"];
  146. $outHtml = "<h$level>" . $Fetch[$i]["text"] . "</h$level>";
  147. echo $outHtml;
  148. }
  149. }
  150. break;
  151. case "wbw":
  152. for ($iPar = $get_par_begin; $iPar <= $get_par_end; $iPar++) {
  153. if ($author == "templet") {
  154. $query = "SELECT * FROM \"main\" WHERE (\"paragraph\" = " . $PDO->quote($iPar) . " ) ";
  155. } else {
  156. $query = "SELECT * FROM \"main\" WHERE (\"paragraph\" = " . $PDO->quote($iPar) . " ) AND \"language\" = " . $PDO->quote($language) . " AND \"author\" = " . $PDO->quote($author) . " AND \"editor\" = " . $PDO->quote($editor) . " AND \"edition\" = " . $PDO->quote($edition) . " AND \"subver\" = " . $PDO->quote($subver);
  157. }
  158. echo "<h2>$iPar</h2>";
  159. $Fetch = PDO_FetchAll($query);
  160. $iFetch = count($Fetch);
  161. if ($iFetch > 0) {
  162. echo "<div class='wbw_par'>";
  163. for ($i = 0; $i < $iFetch; $i++) {
  164. $outHtml = "<div class='word' onmouseover=\"mOver(this)\" onmouseout=\"mOut(this)\" >";
  165. $outHtml .= "<p class='pali'>" . $Fetch[$i]["word"] . "</p>";
  166. $outHtml .= "<p class='mean'>" . $Fetch[$i]["mean"] . "</p>";
  167. $outHtml .= "<p class='org'>" . $Fetch[$i]["part"] . "</p>";
  168. $outHtml .= "<p class='om'>" . $Fetch[$i]["partmean"] . "</p>";
  169. $outHtml .= "<p class='case'>" . $Fetch[$i]["type"] . "#" . $Fetch[$i]["gramma"] . "</p>";
  170. $outHtml .= "</div>";
  171. echo $outHtml;
  172. }
  173. echo "<div class='cls'></div>";
  174. echo "</div>";
  175. }
  176. }
  177. break;
  178. }
  179. /*查询结束*/
  180. ?>
  181. </body>
  182. </html>