gui->title; ?>
" /> " />

单击段落文字添加批注
单击文字选择段落
单击按钮调整段落
_sent_id='{$_GET["sent"]}';"; } if (isset($_GET["book"])) { $book = $_GET["book"]; } else { echo "no book id"; } if (substr($book, 0, 1) == 'p') { $book = substr($book, 1); } if (isset($_GET["paragraph"])) { $paragraph = $_GET["paragraph"]; } else if (isset($_GET["para"])) { $paragraph = $_GET["para"]; } else { $paragraph = -1; } if (isset($_GET["view"])) { $_view = $_GET["view"]; } else { echo "Error : 未定义必要的参数view"; exit; } if (isset($_GET["display"])) { $_display = $_GET["display"]; } else { if ($_view == "para" || $_view == "sent") { $_display = "sent"; //默认值 } else { $_display = "para"; } } $tocList = array(); $FetchChannal = array(); if ($_view == "chapter" || $_view == "para" || $_view == "sent") { PDO_Connect( _FILE_DB_PALITEXT_); //生成目录 $htmlToc2 = "
页首
"; //找到该位置对应的书 $query = "select paragraph,level,chapter_len,parent from 'pali_text' where book='$book' and paragraph='$paragraph'"; $FetchParInfo = PDO_FetchAll($query); $deep = 0; if (count($FetchParInfo) > 0) { $para = $FetchParInfo[0]["paragraph"]; $level = $FetchParInfo[0]["level"]; $chapter_len = $FetchParInfo[0]["chapter_len"]; $parent = $FetchParInfo[0]["parent"]; $currParaBegin = $para; $currParaEnd = $para + $chapter_len; $currParaLevel = $level; $currParaParentLevel = 0; //循环查找父标题 找到level=1的段落 也就是书名 while ($parent > -1) { $query = "select paragraph,level,parent,chapter_len from pali_text where \"book\" = '{$book}' and \"paragraph\" = '{$parent}' limit 0,1"; $FetParent = PDO_FetchAll($query); if (count($FetParent) > 0) { $para = $FetParent[0]["paragraph"]; $level = $FetParent[0]["level"]; $chapter_len = $FetParent[0]["chapter_len"]; $parent = $FetParent[0]["parent"]; if ($currParaParentLevel == 0) { $currParaParentLevel = $level; } } $deep++; if ($deep > 8) { break; } } $paraBegin = $para + 1; $paraEnd = $para + $chapter_len; $query = "SELECT toc,paragraph,level,chapter_len,parent FROM 'pali_text' WHERE book='$book' AND (paragraph BETWEEN '$paraBegin' AND '$paraEnd') and level<100"; $chapter_toc = PDO_FetchAll($query); $tocMaxLevel = 0; $tocMinLevel = 0; $tocBegin = 0; $tocEnd = 0; $toc1Level = 0; $toc2Level = 0; echo "
"; foreach ($chapter_toc as $key => $value) { $tocList[$value["paragraph"]] = $value["level"]; $classCurrToc = ""; $classCurrToc2 = ""; $classCurrTocTitle2 = ""; if ($paragraph >= $value["paragraph"] && $paragraph < $value["paragraph"] + $value["chapter_len"]) { $classCurrToc = " curr_chapter"; $classCurrToc2 = " toc_curr_chapter2"; $classCurrTocTitle2 = " curr_chapter_title2"; } if ($tocBegin == 0 || ($tocBegin > 0 && $value["paragraph"] >= $tocEnd)) { //开始新的标题1 $tocBegin = $value["paragraph"]; $tocEnd = $tocBegin + $value["chapter_len"]; $toc1Level = $value["level"]; if (isset($chapter_toc[$key + 1])) { if ($chapter_toc[$key + 1]["level"] > $toc1Level) { $toc2Level = $chapter_toc[$key + 1]["level"]; } else { $tocBegin = 0; } } $tocHtml .= "
"; $tocHtml .= "
{$value["toc"]}
"; } else { //下一级标题 if ($value["level"] == $toc2Level) { $tocHtml .= ""; } } //右侧目录 if ($value["paragraph"] > $currParaBegin && $value["paragraph"] < $currParaEnd) { //$tocList[$value["paragraph"]] = $value["level"]; $htmlToc2 .= "
{$value["toc"]}
"; } } echo "
"; } $htmlToc2 .= "
导航
"; $htmlToc2 .= "
相关文档
"; //获取段落信息 如 父段落 下一个段落等 $query = "select * from 'pali_text' where book='$book' and paragraph='$paragraph'"; $FetchParInfo = PDO_FetchAll($query); if (count($FetchParInfo) == 0) { echo "Error:no paragraph info"; echo $query; } $currLevel = $FetchParInfo[0]["level"]; $par_begin = $paragraph + 1 - 1; if ($_view == "para") { $par_end = $par_begin; } else { $par_end = $par_begin + $FetchParInfo[0]["chapter_len"] - 1; } $par_next = $FetchParInfo[0]["next_chapter"]; $par_prev = $FetchParInfo[0]["prev_chapter"]; $par_parent = $FetchParInfo[0]["parent"]; if ($par_parent >= 0) { $query = "select toc from 'pali_text' where book='$book' and paragraph='$par_parent'"; $FetchToc = PDO_FetchAll($query); if (count($FetchToc) > 0) { $_parent_title = $FetchToc[0]["toc"]; } } //查询标题 if ($_view == "chapter") { $par_title = $FetchParInfo[0]["toc"]; } else { $par_title = $_parent_title; } //导航按钮 if ($_view == "sent") { $next_para_link = ""; $prev_para_link = ""; } else { if ($par_next != -1) { $query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_next' "; $FetchPara = PDO_FetchAll($query); if (count($FetchPara) > 0) { $next_para_link = "{$FetchPara[0]["toc"]}"; $next_para_link .= ""; $next_para_link .= ""; } else { $next_para_link = $_local->gui->text_without_title; } } else { $next_para_link = $_local->gui->end_of_text; } if ($par_prev != -1) { $query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_prev' "; $FetchPara = PDO_FetchAll($query); if (count($FetchPara) > 0) { $prev_para_link = ""; $prev_para_link .= ""; if ($FetchPara[0]["toc"] == "") { $prev_para_link .= "({$_local->gui->text_without_title})"; } else { $prev_para_link .= "{$FetchPara[0]["toc"]}"; } } else { $prev_para_link = $_local->gui->text_without_title; } } else { $prev_para_link = $_local->gui->begin_of_text; } } //设置标题栏的经文名称 echo ""; } if ($currParaLevel == 1 || $currParaParentLevel == 1) { echo $_local->gui->chapter_select; } else { //上一级 echo "
"; switch ($_view) { case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; case 5: break; case 6: break; case "chapter": if ($par_parent >= 0 && $currLevel > $tocMinLevel) { echo ""; echo ""; echo "{$_parent_title}"; } break; case "para": if ($par_parent >= 0) { echo ""; echo ""; echo "{$_parent_title}"; } break; case "sent": echo ""; echo ""; echo "{$paragraph}"; break; case 10: break; } echo "
"; //生成一个段落空壳 等会儿查询数据,按照不同数据类型填充进去 PDO_Connect(_FILE_DB_PALI_SENTENCE_); if ($_display == "sent") { //逐句显示 for ($iPar = $par_begin; $iPar <= $par_end; $iPar++) { if ($_view == "sent") { $query = "select html, begin, end from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'"; } else { $query = "select html, begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'"; } if (isset($tocList[$iPar])) { $sentClass = " sent_toc"; } else { $sentClass = ""; } $FetchSent = PDO_FetchAll($query); echo "
"; if ($_view == "chapter") { echo "$iPar"; } foreach ($FetchSent as $key => $value) { echo "
"; $pali_sent = $value["html"]; echo ""; echo "" . $pali_sent . ""; echo ""; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; } echo "
"; } } else { //段落显示 for ($iPar = $par_begin; $iPar <= $par_end; $iPar++) { if (isset($tocList[$iPar])) { $sentClass = " sent_toc"; } else { $sentClass = ""; } $query = "select html , begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'"; $FetchSent = PDO_FetchAll($query); echo "
"; echo "
"; if ($_view == "chapter") { echo "$iPar"; } foreach ($FetchSent as $key => $value) { $pali_sent = $value["html"]; echo ""; echo "{$pali_sent}"; echo ""; } echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; } } $strSimSent = ""; if ($_GET["view"] == "sent") { $query = "select sim_sents from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'"; $FetchSent = PDO_FetchOne($query); if (!empty($FetchSent)) { $sim_sents = str_replace(",", "','", $FetchSent); $sim_sents = "'" . $sim_sents . "'"; $query = "SELECT book, paragraph,begin, end, text from 'pali_sent' where id IN ( {$sim_sents} ) "; $FetchSim = PDO_FetchAll($query); foreach ($FetchSim as $key => $value) { $strSimSent .= "
" . $value["text"] . "
"; $strSimSent .= "
" . _get_para_path($value["book"], $value["paragraph"]) . "

"; } } } if (isset($_GET["sent_mode"])) { } //查询编辑者数量 //查询句子译文内容 PDO_Connect(_FILE_DB_SENTENCE_); $dbh = new PDO(_FILE_DB_PALI_SENTENCE_, "", ""); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); //查询channal数量 switch ($_view) { case 'chapter': $query = "SELECT channal from 'sentence' where book= ? and (paragraph between ? and ? ) group by channal"; $FetchChannal = PDO_FetchAll($query, array($book, $par_begin, $par_end)); break; case 'para': # code... $query = "SELECT channal from 'sentence' where book= ? and paragraph = ? group by channal"; $FetchChannal = PDO_FetchAll($query, array($book, $par_begin)); break; case 'sent': # code... $query = "SELECT channal from 'sentence' where book= ? and paragraph = ? AND begin = ? AND end = ? group by channal"; $FetchChannal = PDO_FetchAll($query, array($book, $par_begin, $_GET["begin"], $_GET["end"])); break; default: $FetchChannal = array(); break; } for ($iPar = $par_begin; $iPar <= $par_end; $iPar++) { if ($_view == "sent") { $FetchPaliSent = array(array("begin" => $_GET["begin"], "end" => $_GET["end"])); } else { $query = "select begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'"; $stmt = $dbh->query($query); $FetchPaliSent = $stmt->fetchAll(PDO::FETCH_ASSOC); } //使用巴利语句子列表 查询译文 foreach ($FetchPaliSent as $key => $value) { $begin = $value["begin"]; $end = $value["end"]; $query_channal = ""; if (isset($_GET["channal"])) { $query_channal = " AND channal=" . $PDO->quote($_GET["channal"]); } $sent_count = 1; if ($_view == "sent") { //显示一个巴利句子 以及相应的译文 if (isset($_GET["sent"])) { //如果指定译文句子编号,只显示该句子(和后面的跟帖) $query = "SELECT * FROM \"sentence\" WHERE id = " . $PDO->quote($_GET["sent"]); } else { $query = "SELECT * FROM \"sentence\" WHERE (book = " . $PDO->quote($book) . " AND \"paragraph\" = " . $PDO->quote($iPar) . " AND begin = '$begin' AND end = '$end' AND strlen <> 0 AND (parent = '' OR parent IS NULL) ) {$query_channal} order by modify_time DESC"; } } else { $query = "SELECT * FROM \"sentence\" WHERE book = " . $PDO->quote($book) . " AND \"paragraph\" = " . $PDO->quote($iPar) . " AND begin = '$begin' AND end = '$end' AND strlen <> 0 {$query_channal} order by modify_time DESC limit 0, 1"; $query_count = "SELECT count(book) FROM \"sentence\" WHERE book = " . $PDO->quote($book) . " AND \"paragraph\" = " . $PDO->quote($iPar) . " AND begin = '$begin' AND end = '$end' AND strlen > 0 {$query_channal} "; $sent_count = PDO_FetchOne($query_count); if ($sent_count > 9) { $sent_count = "9+"; } } $FetchText = PDO_FetchAll($query); $i = 0; foreach ($FetchText as $key => $value) { $thisSent = $value; $sentClass = ""; # 找出句子中 我贡献的,优先显示 if ($_view != "sent") { if (isset($_COOKIE["userid"])) { if ($thisSent["editor"] !== $_COOKIE["userid"]) { $query = "SELECT * FROM sentence WHERE parent = " . $PDO->quote($thisSent["id"]) . " AND editor = " . $PDO->quote($_COOKIE["userid"]) . " order by modify_time DESC limit 0,1"; $myText = PDO_FetchAll($query); if (count($myText) > 0) { $thisSent = $myText[0]; $sentClass = "mine"; } } } } echo render_sent($thisSent, $i, $_display, $sent_count, $sentClass); $i++; } if (count($FetchText) > 0) { if (isset($_GET["sent"])) { //如果指定句子译文编号,显示句子的跟帖 $query = "SELECT * FROM \"sentence\" WHERE parent = " . $PDO->quote($_GET["sent"]); $FetchChildren = PDO_FetchAll($query); $i = 0; echo "
"; foreach ($FetchChildren as $key => $value) { echo render_sent($value, $i, $_display, $sent_count); $i++; } echo "
"; } } } } //查询句子译文内容结束 echo "
"; echo "
"; echo ""; echo "$prev_para_link
"; echo "
$next_para_link"; echo ""; echo "
"; echo "
"; } ?> ", $sent_data["text"]); $tran_text = str_replace("]]", "", $tran_text); $output .= ""; if ($display_mode == "sent") { $output .= ""; $output .= ""; $name = $_userinfo->getName($sent_data["editor"]); $output .= mb_substr($name["nickname"], 0, 2); $output .= ""; $output .= ""; } $output .= ""; $output .= ""; $output .= ""; if ($_GET["view"] == "sent") { $channalInfo = $_channal->getChannal($sent_data["channal"]); $query = "SELECT count(*) FROM \"sentence\" WHERE parent = " . $PDO->quote($sent_data["id"]); $edit_count = PDO_FetchOne($query); $output .= "
{$name["nickname"]} @{$name["username"]} · {$channalInfo["name"]}
"; $output .= "
"; if ($sent_data["editor"] == $_COOKIE["userid"]) { $output .= "{$_local_arr["gui"]["revise"]}"; } else { $output .= "{$_local_arr["gui"]["revise"]}"; } $output .= "{$edit_count} "; if ($sent_data["editor"] != $_COOKIE["userid"]) { $output .= "采纳"; } $output .= ''; $output .= '0'; $output .= "
"; } echo "
"; $output .= "
"; if ($_GET["view"] != "sent") { $output .= ""; } return $output; } ?>
相似句子
相关段落
gui->title; ?>:
gui->introduction; ?>:
gui->tag; ?>:
跳转到
= $tocMinLevel) { echo $htmlToc2; } ?>
CSCD4 Paragraph Number
译文语言
贡献者
"; echo ""; echo "全部"; echo ""; echo "
"; foreach ($FetchChannal as $key => $value) { if (!$value["channal"]) { continue; } # code... $channalInfo = $_channal->getChannal($value["channal"]); if ($channalInfo) { $user = $_userinfo->getName($channalInfo["owner"]); } else { $user = null; } echo "
"; echo "
"; echo ""; echo mb_substr($user["nickname"], 0, 2); echo ""; echo "
"; echo "
"; echo "
"; echo ""; if ($channalInfo) { echo $user["nickname"]; echo '/' . $channalInfo["name"]; } echo ""; echo "
"; echo "
"; echo "@" . $user["username"]; echo "
"; echo "
"; echo "
"; } ?>
译文修改