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

单击段落文字添加批注
单击文字选择段落
单击按钮调整段落
页首
"; //找到该位置对应的书 $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($tocMinLevel==0){ if($value["level"]>$tocMaxLevel){ $tocMinLevel = $value["level"]; $tocHtml .= ""; } else{ $tocHtml .= "
"; $tocHtml .= "
{$value["toc"]}
"; } } else{ if($value["level"] == $tocMaxLevel){ $tocHtml .= "
"; $tocHtml .= "
{$value["toc"]}
"; } else if($value["level"] == $tocMinLevel){ $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("sqlite:"._FILE_DB_PALI_SENTENCE_); if($_display=="sent"){ //逐句显示 for($iPar=$par_begin;$iPar<=$par_end;$iPar++){ if($_view=="sent"){ $query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'"; } else{ $query = "select text, 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 "
"; echo "$iPar"; foreach ($FetchSent as $key => $value) { echo "
"; $pali_sent = str_replace("{","",$value["text"]); $pali_sent = str_replace("}","",$pali_sent); echo "".$pali_sent.""; 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 text , begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'"; $FetchSent = PDO_FetchAll($query); echo "
"; echo "
"; echo "$iPar"; foreach ($FetchSent as $key => $value) { $sent_text = str_replace("{","",$value["text"]) ; $sent_text = str_replace("}","",$sent_text) ; echo "{$sent_text}"; } 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("sqlite:"._FILE_DB_SENTENCE_); $dbh = new PDO("sqlite:"._FILE_DB_PALI_SENTENCE_, "", ""); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); 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"]; if($_view=="sent"){ $query="SELECT * FROM \"sentence\" WHERE (book = '{$book}' AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 ) order by modify_time DESC"; } else{ $query = "SELECT * FROM \"sentence\" WHERE book = '{$book}' AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 order by modify_time DESC limit 0, 1"; } $query_count = "SELECT count(book) FROM \"sentence\" WHERE book = '{$book}' AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 "; $sent_count = PDO_FetchOne($query_count); if($sent_count>9){ $sent_count = "9+"; } $FetchText = PDO_FetchAll($query); $iFetchText=count($FetchText); if($iFetchText>0){ for($i=0;$i<$iFetchText;$i++){ $currParNo=$iPar; if($_display=="sent"){ $sent_style = "display:block"; } else{ $sent_style = ""; } $tran_text = str_replace("[[","",$FetchText[$i]["text"]); $tran_text = str_replace("]]","",$tran_text); echo "".$tran_text; if($_view!="sent" && $_display=="sent"){ echo "$sent_count"; } echo ""; echo ""; } } } } //查询句子译文内容 //查询句子译文内容结束 echo "
"; echo "
"; echo ""; echo "$prev_para_link
"; echo "
$next_para_link"; echo ""; echo "
"; echo "
"; } ?>
相似句子
相关段落
标题:
简介:
标签:
=$tocMinLevel){ echo $htmlToc2; } ?>