mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Clean up code concerning multilang document support
This commit is contained in:
parent
a30647d988
commit
ba33e59897
1 changed files with 20 additions and 19 deletions
|
|
@ -913,33 +913,34 @@ class documentController extends document
|
|||
$obj->title = utf8_mbencode($obj->title);
|
||||
$obj->content = utf8_mbencode($obj->content);
|
||||
|
||||
// Change not extra vars but language code of the original document if document's lang_code is different from author's setting.
|
||||
if($source_obj->get('lang_code') != Context::getLangType())
|
||||
// Set lang_code if the original document doesn't have it.
|
||||
if (!$source_obj->get('lang_code'))
|
||||
{
|
||||
// Change not extra vars but language code of the original document if document's lang_code doesn't exist.
|
||||
if(!$source_obj->get('lang_code'))
|
||||
{
|
||||
$lang_code_args = new stdClass();
|
||||
$lang_code_args->document_srl = $source_obj->get('document_srl');
|
||||
$lang_code_args->lang_code = Context::getLangType();
|
||||
$output = executeQuery('document.updateDocumentsLangCode', $lang_code_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra_content = new stdClass;
|
||||
$extra_content->title = $obj->title;
|
||||
$extra_content->content = $obj->content;
|
||||
$output = executeQuery('document.updateDocumentsLangCode', [
|
||||
'document_srl' => $source_obj->get('document_srl'),
|
||||
'lang_code' => Context::getLangType(),
|
||||
]);
|
||||
}
|
||||
// Move content to extra vars if the current language is different from the original document's lang_code.
|
||||
elseif ($source_obj->get('lang_code') !== Context::getLangType())
|
||||
{
|
||||
$extra_content = new stdClass;
|
||||
$extra_content->title = $obj->title;
|
||||
$extra_content->content = $obj->content;
|
||||
|
||||
$document_args = new stdClass;
|
||||
$document_args->document_srl = $source_obj->get('document_srl');
|
||||
$document_output = executeQuery('document.getDocument', $document_args);
|
||||
$document_output = executeQuery('document.getDocument', ['document_srl' => $source_obj->get('document_srl')], ['title', 'content']);
|
||||
if (isset($document_output->data->title))
|
||||
{
|
||||
$obj->title = $document_output->data->title;
|
||||
$obj->content = $document_output->data->content;
|
||||
}
|
||||
}
|
||||
|
||||
// if temporary document, regdate is now setting
|
||||
if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
|
||||
if ($source_obj->get('status') == $this->getConfigStatus('temp'))
|
||||
{
|
||||
$obj->regdate = date('YmdHis');
|
||||
}
|
||||
|
||||
// Insert data into the DB
|
||||
$output = executeQuery('document.updateDocument', $obj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue