diff --git a/admin/quota.php b/admin/quota.php index cec45221..f61ac96d 100755 --- a/admin/quota.php +++ b/admin/quota.php @@ -196,9 +196,12 @@ if ($questionnaire_id != false) $rs = lime_list_questions($questionnaire_id); - var_dump($rs); die(); //TODO: make sure query below works with this function - - display_chooser($rs,"sgqa","sgqa",true,"questionnaire_id=$questionnaire_id&sample_import_id=$sample_import_id",true,true,false,true,"form-group"); + for ($i=0; $i"; @@ -244,13 +247,16 @@ if ($questionnaire_id != false) $rs = lime_list_answeroptions($questionnaire_id,$sgqa); - //TODO: Check this result - var_dump($rs); die(); + $list = array(); - if (!isset($rs) || empty($rs)) + foreach($rs['answeroptions'] as $key=>$val) { + $list[] = array('code' => $key, 'answer' => $val['answer']); + } + + if (!isset($rs['answeroptions']) || is_string($rs['answeroptions'])) print "

" . T_("No labels defined for this question") ."

"; else - xhtml_table($rs,array('code','title'),array(T_("Code value"), T_("Description"))); + xhtml_table($list,array('code','answer'),array(T_("Code value"), T_("Description"))); print ""; diff --git a/functions/functions.limesurvey.php b/functions/functions.limesurvey.php index e20a1928..4502000c 100644 --- a/functions/functions.limesurvey.php +++ b/functions/functions.limesurvey.php @@ -133,14 +133,15 @@ function lime_list_answeroptions($qid,$qcode) if ($q !== false) { - foreach($q as $qid => $val) { - if ($val['title'] == $qcode) { - $qp = $limeRPC->get_question_properties($limeKey,$qid,array('answeroptions')); - if (!isset($qp['status'])) { - $ret = $qp; - } - break; + foreach($q as $tmp => $val) { + if ($val['title'] == $qcode) { + limerpc_init_qid($qid); + $qp = $limeRPC->get_question_properties($limeKey,$val['qid'],array('answeroptions')); + if (!isset($qp['status'])) { + $ret = $qp; } + break; + } } }