/** Returns a JSON array of all Names in the Studies table. */ case 'studies': echo Config::toJSON(Translation::studies()); break; /** Fetches the complete Page_Translations table. @returns A JSON Array with JSON Objects inside. Fields of contained JSON Objects are named as in db. */ /** Fetches the complete Page_Translations table. @returns A JSON Array with JSON Objects inside. Fields of contained JSON Objects are named as in db. */ case 'translations': echo Config::toJSON(Translation::translations()); break; /** @param $_GET['TranslationId'] @param $_GET['Payload'] The payload that determines what will be updated. @param $_GET['Update'] The update value to write @param $_GET['Provider'] The Provider to perform the update to */ /** @param $_GET['TranslationId'] @param $_GET['Payload'] The payload that determines what will be updated. @param $_GET['Update'] The update value to write @param $_GET['Provider'] The Provider to perform the update to */ case 'update': Translation::update($_GET['TranslationId'], $_GET['Payload'], $_GET['Update'], $_GET['Provider']);
<tbody> <?php $rfcLangs = Translation::getRfcLanguages(); $genRfcLangOptions = function ($rfcLang) use($rfcLangs) { $sel = array_key_exists($rfcLang, $rfcLangs) ? '' : ' selected="selected"'; $opts = "<option class='default'{$sel} value='null'>none</option>"; foreach ($rfcLangs as $rfc => $sn) { $sel = $rfc === $rfcLang ? ' selected="selected"' : ''; $opts .= "<option{$sel} value='{$rfc}'>{$sn}</option>"; } return "<select>{$opts}</select>"; }; $genTextInput = function ($txt) { return "<input type='text' value='{$txt}'>"; }; foreach (Translation::translations() as $t) { //Fields to represent: $tId = $t['TranslationId']; $name = $t['TranslationName']; $bm = $t['BrowserMatch']; $img = $t['ImagePath']; $rfcL = $t['RfcLanguage']; $act = $t['Active']; //Transformations: $sLnk = "<a href='?action=translation&tId={$tId}' class='btn btn-info'>Translate</a>"; $dLnk = session_mayEdit() ? "<a href='query/translation.php?action=deleteTranslation&TranslationId={$tId}' class='btn btn-danger'>Delete</a>" : ''; $name = $genTextInput($name); $bm = $genTextInput($bm); $rfcL = $genRfcLangOptions($rfcL); $chk = $act == 1 ? ' checked="checked"' : ''; $act = "<input type='checkbox'{$chk}>";