Skip to content

Commit

Permalink
sortorder fixes
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@1964 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Aug 18, 2006
1 parent afd5f9d commit d329b24
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,16 +957,17 @@ function fixsortorder($qid) //Function rewrites the sortorder for a group of ans
}
}

function fixsortorderQuestions($qid,$gid=0) //Function rewrites the sortorder for a group of answers
function fixsortorderQuestions($qid,$gid=0) //Function rewrites the sortorder for questions
{
global $dbprefix, $connect;
if ($qid != 0)
{
$result = db_execute_assoc("SELECT gid FROM ".db_table_name('questions')." WHERE qid='{$qid}'");
$row=$result->FetchRow();
$cdresult = db_execute_assoc("SELECT qid FROM ".db_table_name('questions')." WHERE gid='{$row['gid']}' ORDER BY question_order, title");
}
} else {
$cdresult = db_execute_assoc("SELECT qid FROM ".db_table_name('questions')." WHERE gid='{$gid}' ORDER BY question_order, title");
}
$position=1;
while ($cdrow=$cdresult->FetchRow())
{
Expand All @@ -976,6 +977,19 @@ function fixsortorderQuestions($qid,$gid=0) //Function rewrites the sortorder fo
}
}

function fixsortorderGroups() //Function rewrites the sortorder for questions
{
global $dbprefix, $connect;
$cdresult = db_execute_assoc("SELECT gid FROM ".db_table_name('groups')." WHERE gid='{$gid}' ORDER BY group_order, group_name");
$position=1;
while ($cdrow=$cdresult->FetchRow())
{
$cd2query="UPDATE ".db_table_name('groups')." SET group_order='{$position}' WHERE gid='{$cdrow['gid']}'";
$cd2result = $connect->Execute($cd2query) or die ("Couldn't update group_order<br />$cd2query<br />".htmlspecialchars($connect->ErrorMsg()));
$position++;
}
}

function browsemenubar()
{
global $surveyid, $scriptname, $imagefiles, $homeurl;
Expand Down

0 comments on commit d329b24

Please sign in to comment.