Skip to content

Commit

Permalink
Dev: Fixed some bugs in quick navigation between questions groups and…
Browse files Browse the repository at this point in the history
… questions

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@9512 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Andrie de Vries committed Nov 21, 2010
1 parent 379f626 commit dcb0e82
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions common_functions.php
Expand Up @@ -649,14 +649,14 @@ function getGidPrevious($surveyid, $gid)
$qresult = db_execute_assoc($gquery); //checked
$qrows = $qresult->GetRows();

$i = 1;
$iPrev = 0;
$i = 0;
$iPrev = -1;
foreach ($qrows as $qrow)
{
if ($gid == $qrow['gid']) {$iPrev = $i - 1;}
$i += 1;
}
if ($iPrev > 0) {$GidPrev = $qrows[$iPrev-1]['gid'];}
if ($iPrev >= 0) {$GidPrev = $qrows[$iPrev]['gid'];}
else {$GidPrev = "";}
return $GidPrev;
}
Expand All @@ -678,14 +678,14 @@ function getQidPrevious($surveyid, $gid, $qid)
$qresult = db_execute_assoc($qquery); //checked
$qrows = $qresult->GetRows();

$i = 1;
$iPrev = 0;
$i = 0;
$iPrev = -1;
foreach ($qrows as $qrow)
{
if ($qid == $qrow['qid']) {$iPrev = $i - 1;}
$i += 1;
}
if ($iPrev > 0) {$QidPrev = $qrows[$iPrev-1]['qid'];}
if ($iPrev >= 0) {$QidPrev = $qrows[$iPrev]['qid'];}
else {$QidPrev = "";}
return $QidPrev;
}
Expand All @@ -708,8 +708,9 @@ function getGidNext($surveyid, $gid)
$qresult = db_execute_assoc($gquery); //checked
$qrows = $qresult->GetRows();

$GidNext="";
$i = 0;
$iNext = count($qrows);
$iNext = 1;
foreach ($qrows as $qrow)
{
if ($gid == $qrow['gid']) {$iNext = $i + 1;}
Expand Down Expand Up @@ -738,7 +739,7 @@ function getQidNext($surveyid, $gid, $qid)
$qrows = $qresult->GetRows();

$i = 0;
$iNext = count($qrows);
$iNext = 1;
foreach ($qrows as $qrow)
{
if ($qid == $qrow['qid']) {$iNext = $i + 1;}
Expand Down

0 comments on commit dcb0e82

Please sign in to comment.