mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Updated by Tim Wahrendorff to work with adodb instead of mysql_connect
This commit is contained in:
@@ -33,7 +33,7 @@ if (!$surveyid)
|
|||||||
._ERROR."</font></strong><br />\n"
|
._ERROR."</font></strong><br />\n"
|
||||||
._ES_NOSID."<br />\n"
|
._ES_NOSID."<br />\n"
|
||||||
."<br /><input type='submit' $btstyle value='"
|
."<br /><input type='submit' $btstyle value='"
|
||||||
._GO_ADMIN."' onClick=\"window.open('$scriptname', '_self')\">\n"
|
._GO_ADMIN."' onClick=\"window.open('$scriptname', '_top')\">\n"
|
||||||
."\t</td></tr>\n"
|
."\t</td></tr>\n"
|
||||||
."</table>\n"
|
."</table>\n"
|
||||||
."</body></html>\n";
|
."</body></html>\n";
|
||||||
@@ -103,16 +103,19 @@ function fixed_array($array)
|
|||||||
function create_fixed($qlid,$rotate=false,$labels=true)
|
function create_fixed($qlid,$rotate=false,$labels=true)
|
||||||
{
|
{
|
||||||
global $dom;
|
global $dom;
|
||||||
global $dbprefix;
|
global $connect ;
|
||||||
|
global $dbprefix ;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||||
if ($labels)
|
if ($labels)
|
||||||
$Query = "SELECT * FROM {$dbprefix}labels WHERE lid = $qlid ORDER BY sortorder ASC";
|
$Query = "SELECT * FROM {$dbprefix}labels WHERE lid = $qlid ORDER BY sortorder ASC";
|
||||||
else
|
else
|
||||||
$Query = "SELECT code,answer as title,sortorder FROM {$dbprefix}answers WHERE qid = $qlid ORDER BY sortorder ASC";
|
$Query = "SELECT code,answer as title,sortorder FROM {$dbprefix}answers WHERE qid = $qlid ORDER BY sortorder ASC";
|
||||||
$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
//$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
||||||
|
$QueryResult = db_execute_assoc($Query);
|
||||||
|
|
||||||
$fixed = $dom->create_element("fixed");
|
$fixed = $dom->create_element("fixed");
|
||||||
|
|
||||||
while ($Row = mysql_fetch_assoc($QueryResult))
|
while ($Row = $QueryResult->FetchRow())
|
||||||
{
|
{
|
||||||
$category = $dom->create_element("category");
|
$category = $dom->create_element("category");
|
||||||
|
|
||||||
@@ -137,10 +140,14 @@ function get_length($qid,$attribute,$default)
|
|||||||
{
|
{
|
||||||
global $dom;
|
global $dom;
|
||||||
global $dbprefix;
|
global $dbprefix;
|
||||||
$Query = "SELECT value FROM {$dbprefix}question_attributes WHERE qid = $qid AND attribute = '$attribute'";
|
global $connect ;
|
||||||
$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||||
|
|
||||||
$Row = mysql_fetch_assoc($QueryResult);
|
$Query = "SELECT value FROM {$dbprefix}question_attributes WHERE qid = $qid AND attribute = '$attribute'";
|
||||||
|
//$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
||||||
|
$QueryResult = db_execute_assoc($Query);
|
||||||
|
|
||||||
|
$Row = $QueryResult->FetchRow();
|
||||||
if ($Row)
|
if ($Row)
|
||||||
return $Row['value'];
|
return $Row['value'];
|
||||||
else
|
else
|
||||||
@@ -153,10 +160,14 @@ function create_multi(&$question,$qid,$varname)
|
|||||||
{
|
{
|
||||||
global $dom;
|
global $dom;
|
||||||
global $dbprefix;
|
global $dbprefix;
|
||||||
$Query = "SELECT * FROM {$dbprefix}answers WHERE qid = $qid ORDER BY sortorder ASC";
|
global $connect ;
|
||||||
$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||||
|
|
||||||
while ($Row = mysql_fetch_assoc($QueryResult))
|
$Query = "SELECT * FROM {$dbprefix}answers WHERE qid = $qid ORDER BY sortorder 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");
|
$response = $dom->create_element("response");
|
||||||
$fixed = $dom->create_element("fixed");
|
$fixed = $dom->create_element("fixed");
|
||||||
@@ -187,10 +198,13 @@ function create_subQuestions(&$question,$qid,$varname)
|
|||||||
{
|
{
|
||||||
global $dom;
|
global $dom;
|
||||||
global $dbprefix;
|
global $dbprefix;
|
||||||
|
global $connect ;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||||
$Query = "SELECT * FROM {$dbprefix}answers WHERE qid = $qid ORDER BY sortorder ASC";
|
$Query = "SELECT * FROM {$dbprefix}answers WHERE qid = $qid ORDER BY sortorder ASC";
|
||||||
$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
//$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
||||||
|
$QueryResult = db_execute_assoc($Query);
|
||||||
|
|
||||||
while ($Row = mysql_fetch_assoc($QueryResult))
|
while ($Row = $QueryResult->FetchRow())
|
||||||
{
|
{
|
||||||
$subQuestion = $dom->create_element("subQuestion");
|
$subQuestion = $dom->create_element("subQuestion");
|
||||||
$text = $dom->create_element("text");
|
$text = $dom->create_element("text");
|
||||||
@@ -203,6 +217,9 @@ function create_subQuestions(&$question,$qid,$varname)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $dbprefix;
|
||||||
|
global $connect ;
|
||||||
|
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||||
|
|
||||||
$dom = domxml_new_doc("1.0");
|
$dom = domxml_new_doc("1.0");
|
||||||
|
|
||||||
@@ -213,8 +230,8 @@ $title = $dom->create_element("title");
|
|||||||
|
|
||||||
$baselang=GetBaseLanguageFromSurveyID($surveyid);
|
$baselang=GetBaseLanguageFromSurveyID($surveyid);
|
||||||
$Query = "SELECT * FROM {$dbprefix}surveys,{$dbprefix}surveys_languagesettings WHERE sid=$surveyid and surveyls_survey_id=sid and surveyls_language='".$baselang."'";
|
$Query = "SELECT * FROM {$dbprefix}surveys,{$dbprefix}surveys_languagesettings WHERE sid=$surveyid and surveyls_survey_id=sid and surveyls_language='".$baselang."'";
|
||||||
$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
$QueryResult = db_execute_assoc($Query);
|
||||||
$Row = mysql_fetch_assoc($QueryResult);
|
$Row = $QueryResult->FetchRow();
|
||||||
$questionnaire->set_attribute("id", $Row['sid']);
|
$questionnaire->set_attribute("id", $Row['sid']);
|
||||||
$title->set_content(cleanup($Row['surveyls_title']));
|
$title->set_content(cleanup($Row['surveyls_title']));
|
||||||
$questionnaire->append_child($title);
|
$questionnaire->append_child($title);
|
||||||
@@ -249,9 +266,10 @@ if (!empty($Row['surveyls_welcometext']))
|
|||||||
|
|
||||||
|
|
||||||
$Query = "SELECT * FROM {$dbprefix}groups WHERE sid=$surveyid order by group_order ASC";
|
$Query = "SELECT * FROM {$dbprefix}groups WHERE sid=$surveyid order by group_order ASC";
|
||||||
$QueryResult = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
$QueryResult = db_execute_assoc($Query);
|
||||||
|
|
||||||
//for each section
|
//for each section
|
||||||
while ($Row = mysql_fetch_assoc($QueryResult))
|
while ($Row = $QueryResult->FetchRow())
|
||||||
{
|
{
|
||||||
$gid = $Row['gid'];
|
$gid = $Row['gid'];
|
||||||
|
|
||||||
@@ -276,8 +294,8 @@ while ($Row = mysql_fetch_assoc($QueryResult))
|
|||||||
|
|
||||||
//boilerplate questions convert to sectionInfo elements
|
//boilerplate questions convert to sectionInfo elements
|
||||||
$Query = "SELECT * FROM {$dbprefix}questions WHERE sid=$surveyid AND gid = $gid AND type LIKE 'X' ORDER BY question_order ASC";
|
$Query = "SELECT * FROM {$dbprefix}questions WHERE sid=$surveyid AND gid = $gid AND type LIKE 'X' ORDER BY question_order ASC";
|
||||||
$QR = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
$QR = db_execute_assoc($Query);
|
||||||
while ($RowQ = mysql_fetch_assoc($QR))
|
while ($RowQ = $QR->FetchRow())
|
||||||
{
|
{
|
||||||
$sectionInfo = $dom->create_element("sectionInfo");
|
$sectionInfo = $dom->create_element("sectionInfo");
|
||||||
$position = $dom->create_element("position");
|
$position = $dom->create_element("position");
|
||||||
@@ -298,8 +316,8 @@ while ($Row = mysql_fetch_assoc($QueryResult))
|
|||||||
|
|
||||||
//foreach question
|
//foreach question
|
||||||
$Query = "SELECT * FROM {$dbprefix}questions WHERE sid=$surveyid AND gid = $gid AND type NOT LIKE 'X' ORDER BY question_order ASC";
|
$Query = "SELECT * FROM {$dbprefix}questions WHERE sid=$surveyid AND gid = $gid AND type NOT LIKE 'X' ORDER BY question_order ASC";
|
||||||
$QR = mysql_query($Query) or die ("ERROR: $QueryResult<br />".mysql_error());
|
$QR = db_execute_assoc($Query);
|
||||||
while ($RowQ = mysql_fetch_assoc($QR))
|
while ($RowQ = $QR->FetchRow())
|
||||||
{
|
{
|
||||||
$question = $dom->create_element("question");
|
$question = $dom->create_element("question");
|
||||||
$type = $RowQ['type'];
|
$type = $RowQ['type'];
|
||||||
@@ -368,8 +386,10 @@ while ($Row = mysql_fetch_assoc($QueryResult))
|
|||||||
case "R": //RANKING STYLE
|
case "R": //RANKING STYLE
|
||||||
create_subQuestions(&$question,$qid,$RowQ['title']);
|
create_subQuestions(&$question,$qid,$RowQ['title']);
|
||||||
$Query = "SELECT LENGTH(COUNT(*)) as sc FROM {$dbprefix}labels WHERE lid = $lid";
|
$Query = "SELECT LENGTH(COUNT(*)) as sc FROM {$dbprefix}labels WHERE lid = $lid";
|
||||||
$QRE = mysql_query($Query) or die ("ERROR: $QRE<br />".mysql_error());
|
$QRE = db_execute_assoc($Query);
|
||||||
$QROW = mysql_fetch_assoc($QRE);
|
//$QRE = mysql_query($Query) or die ("ERROR: $QRE<br />".mysql_error());
|
||||||
|
//$QROW = mysql_fetch_assoc($QRE);
|
||||||
|
$QROW = $QRE->FetchRow();
|
||||||
$response->append_child(create_free("integer",$QROW['sc'],""));
|
$response->append_child(create_free("integer",$QROW['sc'],""));
|
||||||
$question->append_child($response);
|
$question->append_child($response);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user