Translations of ''
/ pop: / belongs to
You are translating: / ID: () / hint: / occurrence: URL / belongs to PSC
";
echo var_dump($languagequery);
echo "";
*/
?>
";
echo var_dump($_POST);
echo "";
*/
foreach ($_POST as $field => $value){
if (($field == 'button') || ($field == 't') || ($field == 'q') || ($field == 'type')){
// field which should not be processed
} elseif ($value != "") {
// allowed post field
if($type == "region"){
// special saving for region
$sql = sprintf("select save_data('name', '%s', ", pg_escape_string($value));
$sql .= sprintf("%u, ", $q);
$sql .= "'translation tool', ";
$sql .= sprintf("%u, ", $_SESSION['account_id']);
$sql .= sprintf("'%s'); ", $field);
} else {
// all other types
if ($type == "category"){
$sql = "update category set ";
} elseif ($type == "datatype"){
$sql = "update datatype set ";
} elseif ($type == "webtext"){
$sql = "update webtext set ";
} elseif ($type == "regiontype"){
$sql = "update regiontype set ";
}
if($value == "-" && $field != "en"){
// copy english text to this language field
$sql .= sprintf("name_%s = name_en ", $field);
} elseif ($value == "!" && $field != "en"){
// delete this language field
$sql .= sprintf("name_%s = NULL ", $field);
} else {
$sql .= sprintf("name_%s = ", $field);
$sql .= sprintf("'%s' ", pg_escape_string($value));
}
if($type == "category"){
$sql .= sprintf("where lower(categoryid) = '%s' ", strtolower($q));
} elseif($type == "datatype"){
$sql .= sprintf("where lower(datatypeid) = '%s' ", strtolower($q));
} elseif($type == "webtext"){
$sql .= sprintf("where id = %u ", $q);
} elseif($type == "regiontype"){
$sql .= sprintf("where id = %u ", $q);
}
}
// run the query
query($sql);
/*
echo $sql . '
';
$result = query($sql);
echo $sql . '
';
echo $field . '
';
echo $value . '
';
*/
/*
echo "
";
echo $row;
echo "";
*/
}
}
if($type == "region"){
$elasticresult = Elasticsearch::setBulkRegions(array("id" => intval($q)));
}
}
if($type == "category"){
$showtitle = "Categories";
$gettranslations = "select *, categoryid as fieldid from category ";
$gettranslations .= "LEFT JOIN definition ON category.definitionid = definition.id ";
if($q != ""){
if(is_numeric($q)){
$gettranslations .= sprintf("where categoryid = %u ", $q);
} else {
$gettranslations .= "where ( ";
$gettranslations .= sprintf("lower(name_en) like '%s' ", strtolower($q));
$gettranslations .= sprintf("or categoryid like '%s' ", strtolower($q));
$gettranslations .= ") ";
}
} else {
$gettranslations .= sprintf("where length(name_%s) IS NULL ", $iso);
}
$gettranslations .= "and category.deleted = false ";
$gettranslations .= "order by name_en nulls last ";
$content_vars['gettranslations'] = query($gettranslations);
} elseif ($type == "datatype"){
$showtitle = "Data types";
$gettranslations = "select *, datatypeid as fieldid from datatype ";
$gettranslations .= "LEFT JOIN definition ON datatype.definitionid = definition.id ";
if($q != ""){
if(is_numeric($q)){
$gettranslations .= sprintf("where datatypeid = %u ", $q);
} else {
$gettranslations .= "where ( ";
$gettranslations .= sprintf("lower(name_en) like '%s' ", strtolower($q));
$gettranslations .= sprintf("or datatypeid like '%s' ", strtolower($q));
$gettranslations .= ") ";
}
} else {
$gettranslations .= sprintf("where length(name_%s) IS NULL ", $iso);
}
$gettranslations .= "and datatype.deleted = false ";
$gettranslations .= "order by name_en nulls last ";
$content_vars['gettranslations'] = query($gettranslations);
} elseif ($type == "webtext"){
$showtitle = "Webtexts";
$gettranslations = "select *, id as fieldid from webtext ";
if($q != ""){
if(is_numeric($q)){
$gettranslations .= sprintf("where id = %u ", $q);
} else {
$gettranslations .= "where ( ";
$gettranslations .= sprintf("lower(name_en) like '%s' ", strtolower($q));
$gettranslations .= sprintf("or id like '%s' ", strtolower($q));
$gettranslations .= ") ";
}
} else {
$gettranslations .= sprintf("where length(name_%s) IS NULL ", $iso);
}
$gettranslations .= "and deleted = false ";
$gettranslations .= "order by name_en nulls last ";
$content_vars['gettranslations'] = query($gettranslations);
} elseif ($type == "regiontype"){
$showtitle = "Region types";
$gettranslations = "select *, id as fieldid from regiontype ";
if($q != ""){
if(is_numeric($q)){
$gettranslations .= sprintf("where id = %u ", $q);
} else {
$gettranslations .= "where ( ";
$gettranslations .= sprintf("lower(name_en) like '%s' ", strtolower($q));
$gettranslations .= sprintf("or id like '%s' ", strtolower($q));
$gettranslations .= ") ";
}
} else {
$gettranslations .= sprintf("where length(name_%s) IS NULL ", $iso);
}
$gettranslations .= "and deleted = false ";
$gettranslations .= "order by name_en nulls last ";
$content_vars['gettranslations'] = query($gettranslations);
} elseif ($type == "region"){
$showtitle = "Regions";
$gettranslations = "select *, region.id as fieldid from region ";
// $gettranslations = "select *, region.id as fieldid, regiontype.name_en as regiontypename from region";
// $gettranslations .= "Inner Join regiontype ON region.regiontypeid = regiontype.id ";
if($q != ""){
if(is_numeric($q)){
$gettranslations .= sprintf("where region.id = %u ", $q);
} else {
$gettranslations .= sprintf("where lower(region.name_en) like '%s' ", $q);
}
} else {
$gettranslations .= sprintf("where length(region.name_%s) IS NULL ", $iso);
$gettranslations .= sprintf("and population > %u ", $pop);
}
/*
if($limit != ""){
$gettranslations .= sprintf("and importantfortranslation = %s ", $limit);
}
*/
$gettranslations .= "and region.deleted = false ";
$gettranslations .= "order by population desc nulls last, region.name_en nulls last ";
$content_vars['gettranslations'] = query($gettranslations);
}
?>
/ pop: / belongs to
You are translating: / ID: () / hint: / occurrence: URL / belongs to PSC