mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 21:12:15 +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->title = utf8_mbencode($obj->title);
|
||||||
$obj->content = utf8_mbencode($obj->content);
|
$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.
|
// Set lang_code if the original document doesn't have it.
|
||||||
if($source_obj->get('lang_code') != Context::getLangType())
|
|
||||||
{
|
|
||||||
// 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'))
|
if (!$source_obj->get('lang_code'))
|
||||||
{
|
{
|
||||||
$lang_code_args = new stdClass();
|
$output = executeQuery('document.updateDocumentsLangCode', [
|
||||||
$lang_code_args->document_srl = $source_obj->get('document_srl');
|
'document_srl' => $source_obj->get('document_srl'),
|
||||||
$lang_code_args->lang_code = Context::getLangType();
|
'lang_code' => Context::getLangType(),
|
||||||
$output = executeQuery('document.updateDocumentsLangCode', $lang_code_args);
|
]);
|
||||||
}
|
}
|
||||||
else
|
// 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 = new stdClass;
|
||||||
$extra_content->title = $obj->title;
|
$extra_content->title = $obj->title;
|
||||||
$extra_content->content = $obj->content;
|
$extra_content->content = $obj->content;
|
||||||
|
|
||||||
$document_args = new stdClass;
|
$document_output = executeQuery('document.getDocument', ['document_srl' => $source_obj->get('document_srl')], ['title', 'content']);
|
||||||
$document_args->document_srl = $source_obj->get('document_srl');
|
if (isset($document_output->data->title))
|
||||||
$document_output = executeQuery('document.getDocument', $document_args);
|
{
|
||||||
$obj->title = $document_output->data->title;
|
$obj->title = $document_output->data->title;
|
||||||
$obj->content = $document_output->data->content;
|
$obj->content = $document_output->data->content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if temporary document, regdate is now setting
|
// 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
|
// Insert data into the DB
|
||||||
$output = executeQuery('document.updateDocument', $obj);
|
$output = executeQuery('document.updateDocument', $obj);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue