Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Limesurvey 2.0 customized translation tool

Limesurvey 2.0 customized translation tool 1 Jahr 3 Monate her #97483

  • kangur91
  • kangur91s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
Hi everyone,

In the past, we modified the translation tool in limesurvey 1.92 so that it only displays unique questions, sub-questions and answers and automatically updates all matching ones.

We are currently trying to recreate this tool in limesurvey 2.0. But we are currently having difficulty modifying the queries for the querybase, queryto and queryudpate in limesurvey 2.0.

Specifically, we don't know how to use joints or subqueries to the findAllByAttributes function.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Limesurvey 2.0 customized translation tool 1 Jahr 3 Monate her #97484

  • kangur91
  • kangur91s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
We used the following queries in limesurvey 1.92 to pull unique questions, sub-questions and answers

For questions:

$stmt = "SELECT qf.qid FROM ".db_table_name('questions')." qf ";
$stmt.= " WHERE qf.sid=".db_quoteall($surveyid,true)." ";
$stmt.= " AND qf.language='".$baselang."' ";
$stmt.= " AND qf.parent_qid=0 ";
$stmt.= " GROUP BY qf.question ";

$amTypeOptions = array(
"querybase" => "SELECT q.qid as questionid, q.title, q.question, q.qid, q.gid "
." FROM ".db_table_name('questions')." q "
." JOIN ".db_table_name('groups')." g ON g.gid=q.gid "
." WHERE q.sid=".db_quoteall($surveyid,true)
." AND q.language='{$baselang}' "
." AND g.language='{$baselang}' "
." AND q.parent_qid=0 "
." AND q.qid IN ($stmt) "
." ORDER BY g.group_order,q.question_order, q.scale_id ",
"queryto" => "SELECT q.qid as questionid, q.title, q.question, q.qid, q.gid "
." FROM ".db_table_name('questions')." q "
." JOIN ".db_table_name('groups')." g ON g.gid=q.gid "
." WHERE q.sid=".db_quoteall($surveyid,true)
." AND q.language='{$tolang}' "
." AND g.language='{$tolang}' "
." AND q.parent_qid=0 "
." AND q.qid IN ($stmt) "
." ORDER BY g.group_order,q.question_order, q.scale_id ",
"queryupdate" => "UPDATE ".db_table_name('questions')
." SET question = ".db_quoteall($new,true)
." WHERE qid = '{$id1}' "
." AND sid=".db_quoteall($surveyid,true)
." AND parent_qid=0 "
." AND language='{$tolang}'",
"dbColumn" => 'question',
"id1" => 'qid',
"id2" => "",
"gid" => TRUE,
"qid" => TRUE,
"description" => $clang->gT("Questions"),
"HTMLeditorType" => "question", // This value is passed to HTML editor and determines LimeReplacementFields
"HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or ""
"associated" => ""
);
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Limesurvey 2.0 customized translation tool 1 Jahr 3 Monate her #97485

  • kangur91
  • kangur91s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
For sub-questions:


$stmt = "SELECT qf.qid FROM ".db_table_name('questions')." qf ";
$stmt.= " WHERE qf.sid=".db_quoteall($surveyid,true)." ";
$stmt.= " AND qf.language='".$baselang."' ";
$stmt.= " AND qf.parent_qid!=0 ";
$stmt.= " GROUP BY qf.question ";

$amTypeOptions = array(
"querybase" => "SELECT q.qid as questionid, q.title, sq.qid, sq.question, sq.gid "
." FROM ".db_table_name('questions')." sq "
." JOIN ".db_table_name('questions')." q ON sq.parent_qid=q.qid "
." JOIN ".db_table_name('groups')." g ON g.gid=q.gid "
." WHERE sq.sid=".db_quoteall($surveyid,true)
." AND sq.language='{$baselang}' AND q.language='{$baselang}' AND g.language='{$baselang}' AND sq.parent_qid>0 "
." AND sq.qid IN ($stmt) "
." ORDER BY g.group_order, q.question_order,q.scale_id, sq.scale_id, sq.question_order ",
"queryto" => "SELECT sq.question "
." FROM ".db_table_name('questions')." sq "
." JOIN ".db_table_name('questions')." q ON sq.parent_qid=q.qid "
." JOIN ".db_table_name('groups')." g ON g.gid=q.gid "
." WHERE sq.sid=".db_quoteall($surveyid,true)
." AND sq.language=".db_quoteall($tolang,true)." AND q.language=".db_quoteall($tolang,true)." AND g.language=".db_quoteall($tolang,true)." AND sq.parent_qid>0 "
." AND sq.qid IN ($stmt) "
." ORDER BY g.group_order, q.question_order,q.scale_id, sq.scale_id, sq.question_order ",
"queryupdate" => "UPDATE ".db_table_name('questions')
." SET question = ".db_quoteall($new,true)
." WHERE qid = '{$id1}' "
." AND sid=".db_quoteall($surveyid,true)
." AND language='{$tolang}'",
"dbColumn" => 'question',
"id1" => 'qid',
"id2" => "",
"gid" => TRUE,
"qid" => TRUE,
"description" => $clang->gT("Subquestions"),
"HTMLeditorType" => "question", // This value is passed to HTML editor and determines LimeReplacementFields
"HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None
"associated" => ""
);
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Limesurvey 2.0 customized translation tool 1 Jahr 3 Monate her #97486

  • kangur91
  • kangur91s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
For answers:


$stmt = "SELECT af.qid,af.code,af.scale_id FROM ".db_table_name('answers')." af ";
$stmt.= " JOIN ".db_table_name('questions')." qf ON af.qid=qf.qid ";
$stmt.= " WHERE af.language='".$baselang."' ";
$stmt.= " AND qf.language='".$baselang."' ";
$stmt.= " AND qf.sid='{$surveyid}' GROUP BY af.answer ";

$amTypeOptions = array(
"querybase" => "SELECT q.qid as questionid, a.code, a.answer, q.qid, q.title "
." FROM ".db_table_name('answers')." a "
." JOIN ".db_table_name('questions')." q ON a.qid=q.qid "
." JOIN ".db_table_name('groups')." g ON g.gid=q.gid "
." JOIN ($stmt) af2 ON af2.qid=a.qid AND af2.code=a.code AND af2.scale_id=a.scale_id "
." WHERE q.sid ='{$surveyid}' "
." AND q.qid = q.qid "
." AND a.language = '{$baselang}'"
." AND q.language = '{$baselang}'"
." AND g.language = '{$baselang}'"
." ORDER BY g.group_order, q.question_order, a.scale_id, a.sortorder",
"queryto" => "SELECT a.code, a.answer, q.qid, q.title "
." FROM ".db_table_name('answers')." a "
." JOIN ".db_table_name('questions')." q ON a.qid=q.qid "
." JOIN ".db_table_name('groups')." g ON g.gid=q.gid "
." JOIN ($stmt) af2 ON af2.qid=a.qid AND af2.code=a.code AND af2.scale_id=a.scale_id "
." WHERE q.sid ='{$surveyid}' "
." AND q.qid = q.qid "
." AND a.language = ".db_quoteall($tolang,true)
." AND q.language = ".db_quoteall($tolang,true)
." AND g.language = ".db_quoteall($tolang,true)
." ORDER BY g.group_order, q.question_order, a.sortorder, a.scale_id",
"queryupdate" => "UPDATE ".db_table_name('answers')
." SET answer = ".db_quoteall($new,true)
." WHERE qid = '{$id1}' "
." AND code='{$id2}' "
." AND language='{$tolang}'",
"dbColumn" => 'answer',
"id1" => 'qid',
"id2" => 'code',
"gid" => FALSE,
"qid" => TRUE,
"description" => $clang->gT("Answer options"),
"HTMLeditorType" => "subquestion", // This value is passed to HTML editor and determines LimeReplacementFields
"HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None
"associated" => ""
);
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Limesurvey 2.0 customized translation tool 1 Jahr 3 Monate her #97487

  • kangur91
  • kangur91s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
Please advice how we could use the same queries limesurvey 2.0.

Thank you!
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.132 Sekunden
Donation Image