diff --git a/modules/module/conf/module.xml b/modules/module/conf/module.xml index 2067106ef..1a389a3d5 100644 --- a/modules/module/conf/module.xml +++ b/modules/module/conf/module.xml @@ -28,6 +28,7 @@ + diff --git a/modules/module/module.admin.model.php b/modules/module/module.admin.model.php index 7c6ff7773..113db57ff 100644 --- a/modules/module/module.admin.model.php +++ b/modules/module/module.admin.model.php @@ -188,10 +188,12 @@ { $args = Context::getRequestVars(); if(!$args->site_srl) $args->site_srl = 0; - $args->langName = $args->lang_name; + $columnList = array('lang_code', 'value'); $langList = array(); + + $args->langName = preg_replace('/\$user_lang->/', '', $args->lang_name); $output = executeQueryArray('module.getLangListByName', $args, $columnList); if($output->toBool()) $langList = $output->data; @@ -199,6 +201,34 @@ $this->add('lang_name', $args->langName); } + /** + * @brief Return lang list + **/ + function getModuleAdminLangListByValue() + { + $args = Context::getRequestVars(); + if(!$args->site_srl) $args->site_srl = 0; + + + $langList = array(); + + $args->value = $args->lang_name; + + // search value + $output = executeQueryArray('module.getLangNameByValue', $args); + if ($output->toBool()){ + unset($args->value); + + $args->langName = $output->data[0]->name; + $columnList = array('lang_code', 'value'); + $output = executeQueryArray('module.getLangListByName', $args, $columnList); + + if($output->toBool()) $langList = $output->data; + } + + $this->add('lang_list', $langList); + $this->add('lang_name', $args->langName); + } /** * @brief Return current lang list **/ diff --git a/modules/module/module.model.php b/modules/module/module.model.php index f5001bf9b..6dd1733fd 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -1391,12 +1391,27 @@ function getLangListByLangcodeForAutoComplete() { $keyword = Context::get('search_keyword'); - $list = array( - array('name'=>'key1', 'value'=>'value1'), - array('name'=>'key2', 'value'=>'value2'), - array('name'=>'key3', 'value'=>'value3') - ); + $requestVars = Context::getRequestVars(); + $args->site_srl = (int)$requestVars->site_srl; + $args->page = 1; // /< Page + $args->list_count = 100; // /< the number of posts to display on a single page + $args->page_count = 5; // /< the number of pages that appear in the page navigation + $args->sort_index = 'name'; + $args->order_type = 'asc'; + $args->search_keyword = Context::get('search_keyword'); // /< keyword to search*/ + + $output = executeQueryArray('module.getLangListByLangcode', $args); + + $list = array(); + + if($output->toBool()){ + foreach($output->data as $code_info){ + unset($codeInfo); + $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); + $list[] = $codeInfo; + } + } $this->add('results', $list); } } diff --git a/modules/module/queries/getLangNameByValue.xml b/modules/module/queries/getLangNameByValue.xml new file mode 100644 index 000000000..494bd8c81 --- /dev/null +++ b/modules/module/queries/getLangNameByValue.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +