"; $translateoutput .= showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname); $translateoutput .= ""; $translateoutput .= "

 

\n"; //CSS Firefox 2 transition fix $translateoutput .= "
".$clang->gT("Translate survey")."
\n"; // $tab_names=array("title", "description", "welcome", "end", "group", "group_desc", "question", "question_help", "answer"); // $tab_names=array("title", "description", "invitation", "reminder"); $tab_names=array("title", "welcome", "group", "question", "subquestion", "answer", "emailinvite", "emailreminder", "emailconfirmation", "emailregistration"); if ($tolang != "" && $actionvalue=="translateSave") // Saves translated values to database { $tab_names_full = ""; foreach($tab_names as $type) { $tab_names_full[] = $type; $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); $type2 = $amTypeOptions["associated"]; if ($type2 != "") { $tab_names_full[] = $type2; } } foreach($tab_names_full as $type) { $size = 0; if(isset($_POST["{$type}_size"])) { $size = $_POST["{$type}_size"]; } // start a loop in order to update each record $i = 0; while ($i < $size) { // define each variable if (isset($_POST["{$type}_newvalue_{$i}"])) { $old = $_POST["{$type}_oldvalue_{$i}"]; $new = $_POST["{$type}_newvalue_{$i}"]; // check if the new value is different from old, and then update database if ($new != $old) { $id1 = $_POST["{$type}_id1_{$i}"]; $id2 = $_POST["{$type}_id2_{$i}"]; $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang, $id1, $id2, $new); $query = $amTypeOptions["queryupdate"]; $connect->execute($query); } } ++$i; } // end while } // end foreach $actionvalue = ""; } // end if if ($tolang != "") // Display tabs with fields to translate, as well as input fields for translated values { $sGoogleApiError = $clang->gT("There was an error using the Google API."); $sDetailedError = $clang->gT("Detailed Error"); $translateoutput .= "

".$clang->gT("Loading translations")."...

"; $translateoutput .= "
\n" ."\n" ."\n" ."\n" ."\n" ."\n" ."\n"; $translateoutput.=<< sGoogleApiError = "$sGoogleApiError"; sDetailedError = "$sDetailedError"; END; // set up tabs $translateoutput .= "" ."
\n" ."\t
    \n"; foreach($tab_names as $type) { $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); $translateoutput .= "" ."\t\t
  • ".$amTypeOptions["description"]."
  • \n"; } $translateoutput .= "" ."\t
\n"; // Define content of each tab foreach($tab_names as $type) { $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); $type2 = $amTypeOptions["associated"]; if ($type2 != "") { $associated = TRUE; $amTypeOptions2 = setupTranslateFields($surveyid, $type2, $tolang, $baselang); } else { $associated = FALSE; } // Create tab names and heading $translateoutput .= "\t
\n"; $translateoutput .= PrepareEditorScript(); // Setup form // start a counter in order to number the input fields for each record $i = 0; $evenRow = FALSE; $all_fields_empty = TRUE; $querybase = $amTypeOptions["querybase"]; $resultbase = db_execute_assoc($querybase); if ($associated) { $querybase2 = $amTypeOptions2["querybase"]; $resultbase2 = db_execute_assoc($querybase2); } $queryto = $amTypeOptions["queryto"]; $resultto = db_execute_assoc($queryto); if ($associated) { $queryto2 = $amTypeOptions2["queryto"]; $resultto2 = db_execute_assoc($queryto2); } $translateoutput .="
\n"; $translateoutput .=""; $translateoutput .="\n"; $translateoutput .= displayTranslateFieldsHeader($baselangdesc, $tolangdesc, $type); while ($rowfrom = $resultbase->FetchRow()) { $textfrom = htmlspecialchars_decode($rowfrom[$amTypeOptions["dbColumn"]]); if ($associated) { $rowfrom2 = $resultbase2->FetchRow(); $textfrom2 = htmlspecialchars_decode($rowfrom2[$amTypeOptions2["dbColumn"]]); } $gid = NULL; if($amTypeOptions["gid"]==TRUE) $gid = $rowfrom['gid']; $qid = NULL; if($amTypeOptions["qid"]==TRUE) $qid = $rowfrom['qid']; $rowto = $resultto->FetchRow(); $textto = $rowto[$amTypeOptions["dbColumn"]]; if ($associated) { $rowto2 = $resultto2->FetchRow(); $textto2 = $rowto2[$amTypeOptions2["dbColumn"]]; } if (strlen(trim((string)$textfrom)) > 0) { $all_fields_empty = FALSE; $evenRow = !($evenRow); // Display translation fields $translateoutput .= displayTranslateFields($surveyid, $gid, $qid, $type, $amTypeOptions, $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow); if ($associated && strlen(trim((string)$textfrom2)) > 0) { $evenRow = !($evenRow); $translateoutput .= displayTranslateFields($surveyid, $gid, $qid, $type2, $amTypeOptions2, $baselangdesc, $tolangdesc, $textfrom2, $textto2, $i, $rowfrom2, $evenRow); } } else { $translateoutput .= ""; } ++$i; } // end while $translateoutput .= displayTranslateFieldsFooter(); $translateoutput .= "
"; if ($all_fields_empty) { $translateoutput .= "

".$clang->gT("Nothing to translate on this page")."


"; } $translateoutput .= ""; if ($associated) { $translateoutput .= ""; } $translateoutput .= "
\n"; // tab-page } // end foreach // Submit button $translateoutput .= "

" ."\n"; $translateoutput .= "
\n"; $translateoutput .= "\n"; } // end if ?>