edit_wbw.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. //工程文件操作
  3. //建立,
  4. require_once '../config.php';
  5. require_once "../public/_pdo.php";
  6. require_once "../public/function.php";
  7. require_once "../public/load_lang.php";
  8. $_book = $_POST["book"];
  9. $_para = json_decode($_POST["para"]);
  10. //判断单词数量 太大的不能加载
  11. PDO_Connect(_FILE_DB_PALITEXT_);
  12. $params = array(1, 21, 63, 171);
  13. /* 创建一个填充了和params相同数量占位符的字符串 */
  14. $place_holders = implode(',', array_fill(0, count($_para), '?'));
  15. $query = "SELECT sum(lenght) FROM pali_text WHERE paragraph IN ($place_holders) AND book = ?";
  16. $_para[] = $_book;
  17. $sum_len = PDO_FetchOne($query,$_para);
  18. if($sum_len>15000){
  19. echo $_local->gui->oversize_to_load;
  20. exit;
  21. }
  22. # 选择channel
  23. echo "<div class='fun_block'>";
  24. echo "<h2>编辑逐词解析</h2>";
  25. echo "<form action=\"{$thisFileName}\" method=\"post\">";
  26. echo "<input type='hidden' name='op' value='{$op}'/>";
  27. echo "<input type='hidden' name='data' value='{$data}'/>";
  28. echo "<fieldset>";
  29. echo "<legend>{$_local->gui->title} ({$_local->gui->required})</legend>";
  30. echo "<div>";
  31. echo "<input type='input' name='title' value='{$title}'/>";
  32. echo "</div>";
  33. echo "</fieldset>";
  34. echo "<fieldset>";
  35. echo "<legend>{$_local->gui->channel} ({$_local->gui->required})</legend>";
  36. echo "<div>";
  37. PDO_Connect(_FILE_DB_CHANNAL_,_DB_USERNAME_,_DB_PASSWORD_);
  38. $query = "SELECT * from "._TABLE_CHANNEL_." where owner_uid = ? limit 100";
  39. $Fetch = PDO_FetchAll($query,array($_COOKIE["user_uid"]));
  40. $i=0;
  41. foreach($Fetch as $row){
  42. echo '<div class="file_list_row" style="padding:5px;">';
  43. echo '<div class="pd-10" style="max-width:2em;flex:1;">';
  44. echo '<input name="channal" value="'.$row["uid"].'" ';
  45. if($i==0){
  46. echo "checked";
  47. }
  48. echo ' type="radio" />';
  49. echo '</div>';
  50. echo '<div class="title" style="flex:3;padding-bottom:5px;">'.$row["name"].'</div>';
  51. echo '<div class="title" style="flex:3;padding-bottom:5px;">'.$row["lang"].'</div>';
  52. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  53. // 查询逐词解析库
  54. PDO_Connect(_FILE_DB_USER_WBW_);
  55. #TODO $strQueryParaList 改为预处理
  56. $query = "SELECT count(*) from "._TABLE_USER_WBW_BLOCK_." where channel_uid = ? and book_id=? and paragraph in {$strQueryParaList} limit 100";
  57. $FetchWBW = PDO_FetchOne($query,array($row["uid"],$book));
  58. echo '</div>';
  59. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  60. if($FetchWBW==0){
  61. echo $_local->gui->blank;
  62. echo "<a>快捷编辑</a>";
  63. }
  64. else{
  65. echo $FetchWBW.$_local->gui->para;
  66. echo "<a href='../studio/editor.php?op=openchannal&book=$book&para={$paraList}&channal={$row["uid"]}'>open</a>";
  67. }
  68. echo '</div>';
  69. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  70. PDO_Connect(_FILE_DB_SENTENCE_,_DB_USERNAME_, _DB_PASSWORD_);
  71. #TODO $strQueryParaList 改为预处理
  72. $query = "SELECT count(*) from "._TABLE_SENTENCE_." where channel_uid = ? and book_id= ? and paragraph in {$strQueryParaList} limit 100";
  73. $FetchWBW = PDO_FetchOne($query,array($row["uid"],$book));
  74. echo '</div>';
  75. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  76. if($FetchWBW==0){
  77. echo $_local->gui->blank;
  78. }
  79. else{
  80. echo $FetchWBW.$_local->gui->para;
  81. }
  82. echo '</div>';
  83. echo '<div class="summary" style="flex:1;padding-bottom:5px;">'.$row["status"].'</div>';
  84. echo '<div class="author" style="flex:1;padding-bottom:5px;">'.$row["create_time"].'</div>';
  85. echo '</div>';
  86. $i++;
  87. }
  88. echo '<div class="file_list_row" style="padding:5px;">';
  89. echo '</div>';
  90. echo "</div>";
  91. echo "</fieldset>";
  92. echo "<fieldset>";
  93. echo "<legend>{$_local->gui->language}</legend>";
  94. echo "<select name='lang'>";
  95. $lang_list = new lang_enum;
  96. foreach ($user_setting['studio.translation.lang'] as $key => $value) {
  97. echo "<option value='{$value}'>".$lang_list->getName($value)["name"]."</option>";
  98. }
  99. echo "</select>";
  100. echo "</fieldset>";
  101. echo "<input type=\"submit\" value='Create 建立'>";
  102. echo "<input type='hidden' name='format' value='db'>";
  103. echo "</form>";
  104. echo "</div>";
  105. ?>