'', 'variable' => '', 'created' => '', 'createdby' => '', 'updated' => '', 'updatedby' => '', 'accounthierarchy' => '' ]; if (isset($_GET['rowID'])) { //CALL TO API $api_url = '/v2/translations/rowID='.$_GET['rowID']; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = null;} $text_variable = json_decode(json_encode($responses[0]), true); //CALL TO API FOR RELATED TRANSLATIONS $api_url = '/v2/translations_details/variable_ID='.$_GET['rowID']; $text_variable_translations = ioServer($api_url,''); //Decode Payload if (!empty($text_variable_translations)){$text_variable_translations = json_decode($text_variable_translations,true);}else{$text_variable_translations = null;} if ($update_allowed === 1){ if (isset($_POST['submit'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/translations', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=translations&success_msg=2'); exit; } } if (isset($_POST['add'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/translations_details', $payload); if ($responses === 'NOK'){ } else { if ($_SESSION['permission'] == 4){ generateLanguageFile($_POST['language_key'],$_SESSION['userkey']); } header('Location: index.php?page=translation_manage&rowID='.$_GET['rowID'].''); exit; } } if (isset($_POST['update']) && isset($_POST['item'])) { //Indicator if update has errors $NOK_error = 0; //RUN through all POST items foreach ($_POST['item'] as $attr){ //GET ALL POST DATA $payload = json_encode($attr, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/translations_details', $payload); if ($responses === 'NOK'){ //NOT correct exit procedure $NOK_error++; exit; } else { $attr_language = $attr['language_key']; } } if ($NOK_error == 0){ //NO errors generatelanguagefile if ($_SESSION['permission'] == 4){ generateLanguageFile($attr_language,$_SESSION['userkey']); } } header('Location: index.php?page=translation_manage&rowID='.$_GET['rowID'].''); exit; } } if ($delete_allowed === 1){ if (isset($_POST['delete'])) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/translations', $payload); // Redirect and delete product if ($responses === 'NOK'){ } else { header('Location: index.php?page=translations&success_msg=3'); exit; } } } } else { // Create a new variable if (isset($_POST['submit']) && $create_allowed === 1) { //GET ALL POST DATA $payload = json_encode($_POST, JSON_UNESCAPED_UNICODE); //API call $responses = ioServer('/v2/translations', $payload); if ($responses === 'NOK'){ } else { //GET ROWID OF CREATED ITEM $variable_rowID = json_decode($responses,true); header('Location: index.php?page=translation_manage&rowID='.$variable_rowID['rowID'].''); exit; } } } //EMPTY VIEW $view = ''; // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 0) { $success_msg = $error_msg_0; } } template_header('Translation', 'translation', 'manage'); if (isset($success_msg)){ $view .= '

'.$success_msg.'

'; } $view .='

'.($text_variables_h2 ?? '').'

'; if ($delete_allowed === 1){ $view .= ''; } if ($update_allowed === 1){ $view .= ''; } $view .= '
'; $view .= '
'.$tab1 .' '.$tab3.'
'; //Define Service and User enabled $view .= '
'; $view .= '
'; $view .= '
'; $view .= '
'; $view .= '
'; if (empty($text_variable_translations)){ $view .= ' '; } else { foreach ($text_variable_translations as $translation){ $view .= ' '; } } $view .= '
'.($text_variable_translation_languagekey ?? '').' '.($text_variable_translation_translation ?? '').' '.$general_created.' '.$general_actions.'
'.($message_no_text_variables ?? '').'
'.getRelativeTime($translation['created']).'
'; //Output echo $view; template_footer() ?>