edit_wbw.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. //工程文件操作
  3. //建立,
  4. require_once '../path.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_);
  38. $query = "SELECT * from channal where owner = ? limit 0,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["id"].'" ';
  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. $query = "SELECT count(*) from "._TABLE_USER_WBW_BLOCK_." where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList} limit 0,100";
  56. $FetchWBW = PDO_FetchOne($query);
  57. echo '</div>';
  58. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  59. if($FetchWBW==0){
  60. echo $_local->gui->blank;
  61. echo "<a>快捷编辑</a>";
  62. }
  63. else{
  64. echo $FetchWBW.$_local->gui->para;
  65. echo "<a href='../studio/editor.php?op=openchannal&book=$book&para={$paraList}&channal={$row["id"]}'>open</a>";
  66. }
  67. echo '</div>';
  68. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  69. PDO_Connect(""._FILE_DB_SENTENCE_);
  70. $query = "select count(*) from sentence where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList} limit 0,100";
  71. $FetchWBW = PDO_FetchOne($query);
  72. echo '</div>';
  73. echo '<div class="title" style="flex:2;padding-bottom:5px;">';
  74. if($FetchWBW==0){
  75. echo $_local->gui->blank;
  76. }
  77. else{
  78. echo $FetchWBW.$_local->gui->para;
  79. }
  80. echo '</div>';
  81. echo '<div class="summary" style="flex:1;padding-bottom:5px;">'.$row["status"].'</div>';
  82. echo '<div class="author" style="flex:1;padding-bottom:5px;">'.$row["create_time"].'</div>';
  83. echo '</div>';
  84. $i++;
  85. }
  86. echo '<div class="file_list_row" style="padding:5px;">';
  87. echo '</div>';
  88. echo "</div>";
  89. echo "</fieldset>";
  90. echo "<fieldset>";
  91. echo "<legend>{$_local->gui->language}</legend>";
  92. echo "<select name='lang'>";
  93. $lang_list = new lang_enum;
  94. foreach ($user_setting['studio.translation.lang'] as $key => $value) {
  95. echo "<option value='{$value}'>".$lang_list->getName($value)["name"]."</option>";
  96. }
  97. echo "</select>";
  98. echo "</fieldset>";
  99. echo "<input type=\"submit\" value='Create 建立'>";
  100. echo "<input type='hidden' name='format' value='db'>";
  101. echo "</form>";
  102. echo "</div>";
  103. ?>