88class Multilingual extends AbstractExternalModule
99{
1010 function redcap_survey_page ($ project_id , $ record , $ instrument ){
11- echo '<script type="text/javascript"> ' . str_replace ('APP_PATH_IMAGES ' , APP_PATH_IMAGES , str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true ), file_get_contents ($ this ->getModulePath () . 'js/multilingual_survey.js ' )))) . '</script> ' ;
11+ $ api_endpoint = $ this ->getProjectSetting ('use-api-endpoint ' , $ project_id );
12+ echo '<script type="text/javascript"> ' . str_replace ('APP_PATH_IMAGES ' , APP_PATH_IMAGES , str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true , ($ api_endpoint == true ? true : false )), file_get_contents ($ this ->getModulePath () . 'js/multilingual_survey.js ' )))) . '</script> ' ;
1213 echo '<link rel="stylesheet" type="text/css" href=" ' . $ this ->getUrl ('css/multilingual.css ' ) . '"> ' ;
1314 }
1415
1516 function redcap_survey_complete ($ project_id , $ record , $ instrument ){
16- echo '<script type="text/javascript"> ' . str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true ), file_get_contents ($ this ->getModulePath () . 'js/multilingual_survey_complete.js ' ))) . '</script> ' ;
17+ $ api_endpoint = $ this ->getProjectSetting ('use-api-endpoint ' , $ project_id );
18+ echo '<script type="text/javascript"> ' . str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true , ($ api_endpoint == true ? true : false )), file_get_contents ($ this ->getModulePath () . 'js/multilingual_survey_complete.js ' ))) . '</script> ' ;
1719 }
1820
1921 function redcap_data_entry_form ($ project_id , $ record , $ instrument ){
@@ -22,6 +24,8 @@ function redcap_data_entry_form($project_id, $record, $instrument){
2224 }
2325
2426 function redcap_every_page_top ($ project_id ){
27+ $ api_endpoint = $ this ->getProjectSetting ('use-api-endpoint ' , $ project_id );
28+
2529 if (strpos ($ _SERVER ['REQUEST_URI ' ], 'online_designer.php ' ) !== false && isset ($ _GET ['page ' ])){
2630 echo '<link rel="stylesheet" type="text/css" href=" ' . $ this ->getUrl ('css/multilingual.css ' ) . '"> ' ;
2731 echo '<script type="text/javascript"> ' . str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true ), file_get_contents ($ this ->getModulePath () . 'js/multilingual_setup.js ' ))) . '</script> ' ;
@@ -30,8 +34,8 @@ function redcap_every_page_top($project_id){
3034 echo '<script type="text/javascript"> ' . str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true ), file_get_contents ($ this ->getModulePath () . 'js/multilingual_export.js ' ))) . '</script> ' ;
3135 }
3236 elseif ($ _GET ['__return ' ] == 1 ){
33- echo '<script type="text/javascript"> ' . str_replace ('APP_PATH_IMAGES ' , APP_PATH_IMAGES , str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true ), file_get_contents ($ this ->getModulePath () . 'js/multilingual_survey_return.js ' )))) . '</script> ' ;
34- echo '<link rel="stylesheet" type="text/css" href=" ' . $ this ->getUrl ('css/multilingual.css ' ) . '"> ' ;
37+ echo '<script type="text/javascript"> ' . str_replace ('APP_PATH_IMAGES ' , APP_PATH_IMAGES , str_replace ('REDCAP_LANGUAGE_VARIABLE ' , $ this ->languageVariable ($ project_id ), str_replace ('REDCAP_AJAX_URL ' , $ this ->getUrl ("index.php " , true , ( $ api_endpoint == true ? true : false ) ), file_get_contents ($ this ->getModulePath () . 'js/multilingual_survey_return.js ' )))) . '</script> ' ;
38+ echo '<link rel="stylesheet" type="text/css" href=" ' . $ this ->getUrl ('css/multilingual.css ' , true , ( $ api_endpoint == true ? true : false ) ) . '"> ' ;
3539 }
3640 }
3741
0 commit comments