|
|
@@ -69,7 +69,7 @@ class CorpusController extends Controller
|
|
|
{
|
|
|
//
|
|
|
}
|
|
|
- public function getSentTpl($id,$channels){
|
|
|
+ public function getSentTpl($id,$channels,$mode='edit',$onlyProps=false){
|
|
|
$sent = [];
|
|
|
$sentId = \explode('-',$id);
|
|
|
$channelId = ChannelApi::getSysChannel('_System_Wbw_VRI_');
|
|
|
@@ -84,10 +84,20 @@ class CorpusController extends Controller
|
|
|
->whereIn('channel_uid',$channels)
|
|
|
->get();
|
|
|
Log::info("sent count:".count($record));
|
|
|
+
|
|
|
+
|
|
|
$channelIndex = $this->getChannelIndex($channels);
|
|
|
|
|
|
- $content = $this->makeContent($record,"edit",$channelIndex);
|
|
|
- return $content;
|
|
|
+ //获取wbw channel
|
|
|
+ //目前默认的 wbw channel 是第一个translation channel
|
|
|
+ foreach ($channels as $channel) {
|
|
|
+ # code...
|
|
|
+ if($channelIndex[$channel]->type==='translation'){
|
|
|
+ $this->wbwChannels[] = $channel;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $this->makeContent($record,$mode,$channelIndex,[],$onlyProps);
|
|
|
}
|
|
|
/**
|
|
|
* Display the specified resource.
|
|
|
@@ -260,7 +270,7 @@ class CorpusController extends Controller
|
|
|
* $indexChannel channel索引
|
|
|
* $indexedHeading 标题索引 用于给段落加标题标签 <h1> ect.
|
|
|
*/
|
|
|
- private function makeContent($record,$mode,$indexChannel,$indexedHeading=[]){
|
|
|
+ private function makeContent($record,$mode,$indexChannel,$indexedHeading=[],$onlyProps=false){
|
|
|
$content = [];
|
|
|
$lastSent = "0-0";
|
|
|
$sentCount = 0;
|
|
|
@@ -382,10 +392,15 @@ class CorpusController extends Controller
|
|
|
}
|
|
|
|
|
|
$sentCount++;
|
|
|
+ }
|
|
|
+ if($onlyProps){
|
|
|
+ return $sent;
|
|
|
}
|
|
|
$content = $this->pushSent($content,$sent,0,$mode);
|
|
|
- return \implode("",$content);
|
|
|
+ $output = \implode("",$content);
|
|
|
+ return "<xml>{$output}</xml>";
|
|
|
}
|
|
|
+
|
|
|
private function pushSent($result,$sent,$level=0,$mode='read'){
|
|
|
|
|
|
$sentProps = base64_encode(\json_encode($sent)) ;
|