function create_multi(&$question, $qid, $varname, $scale_id = false, $free = false, $other = false) { global $dom; global $dbprefix; global $connect; global $quexmllang; global $surveyid; global $qlang; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $Query = "SELECT * FROM {$dbprefix}questions WHERE parent_qid = {$qid} AND language='{$quexmllang}' "; if ($scale_id != false) { $Query .= " AND scale_id = {$scale_id} "; } $Query .= " ORDER BY question_order ASC"; //$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error()); $QueryResult = db_execute_assoc($Query); $nextcode = ""; while ($Row = $QueryResult->FetchRow()) { $response = $dom->create_element("response"); if ($free == false) { $fixed = $dom->create_element("fixed"); $category = $dom->create_element("category"); $label = $dom->create_element("label"); $label->set_content(cleanup($Row['question'])); $value = $dom->create_element("value"); //$value->set_content(cleanup($Row['title'])); $value->set_content("1"); $nextcode = $Row['title']; $category->append_child($label); $category->append_child($value); $st = skipto($qid, 'Y', " AND c.cfieldname LIKE '+{$surveyid}" . "X" . $Row['gid'] . "X" . $qid . $Row['title'] . "' "); if ($st !== false) { $skipto = $dom->create_element("skipTo"); $skipto->set_content($st); $category->append_child($skipto); } $fixed->append_child($category); $response->append_child($fixed); } else { $response->append_child(create_free($free['f'], $free['len'], $Row['question'])); } $response->set_attribute("varName", $varname . cleanup($Row['title'])); $question->append_child($response); } if ($other && $free == false) { $response = $dom->create_element("response"); $fixed = $dom->create_element("fixed"); $category = $dom->create_element("category"); $label = $dom->create_element("label"); $label->set_content(get_length($qid, "other_replace_text", $qlang->gT("Other"))); $value = $dom->create_element("value"); //Get next code if (is_numeric($nextcode)) { $nextcode++; } else { if (is_string($nextcode)) { $nextcode = chr(ord($nextcode) + 1); } } $value->set_content(1); $category->append_child($label); $category->append_child($value); $contingentQuestion = $dom->create_element("contingentQuestion"); $length = $dom->create_element("length"); $text = $dom->create_element("text"); $text->set_content(get_length($qid, "other_replace_text", $qlang->gT("Other"))); $length->set_content(24); $contingentQuestion->append_child($text); $contingentQuestion->append_child($length); $contingentQuestion->set_attribute("varName", $varname . 'other'); $category->append_child($contingentQuestion); $fixed->append_child($category); $response->append_child($fixed); $response->set_attribute("varName", $varname . cleanup($nextcode)); $question->append_child($response); } return; }
function create_multi(&$question, $qid, $varname, $scale_id = false, $free = false) { global $dom; global $dbprefix; global $connect; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $Query = "SELECT * FROM {$dbprefix}questions WHERE parent_qid = {$qid} "; if ($scale_id != false) { $Query .= " AND scale_id = {$scale_id} "; } $Query .= " ORDER BY question_order ASC"; //$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error()); $QueryResult = db_execute_assoc($Query); while ($Row = $QueryResult->FetchRow()) { $response = $dom->create_element("response"); if ($free == false) { $fixed = $dom->create_element("fixed"); $category = $dom->create_element("category"); $label = $dom->create_element("label"); $label->set_content(cleanup($Row['question'])); $value = $dom->create_element("value"); //$value->set_content(cleanup($Row['title'])); $value->set_content("1"); $category->append_child($label); $category->append_child($value); $fixed->append_child($category); $response->append_child($fixed); } else { $response->append_child(create_free($free['f'], $free['len'], $Row['question'])); } $response->set_attribute("varName", $varname . "_" . cleanup($Row['title'])); $question->append_child($response); } return; }