Exemplo n.º 1
0
//CHECK IF ALL MANDATORY QUESTIONS HAVE BEEN ANSWERED ############################################
//First, see if we are moving backwards or doing a Save so far, and its OK not to check:
if ($allowmandbackwards == 1 && (isset($move) && $move == 'moveprev' || isset($_POST['saveall']) && $_POST['saveall'] == $clang->gT("Save your responses so far"))) {
    $backok = "Y";
} else {
    $backok = "N";
}
//Now, we check mandatory questions if necessary
//CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED
$notanswered = addtoarray_single(checkmandatorys($move, $backok), checkconditionalmandatorys($move, $backok));
//CHECK PREGS
$notvalidated = checkpregs($move, $backok);
//SEE IF THIS GROUP SHOULD DISPLAY
$show_empty_group = false;
if (isset($move) && $_SESSION['step'] != 0 && $move != "movesubmit") {
    while (isset($_SESSION['grouplist'][$_SESSION['step'] - 1]) && checkgroupfordisplay($_SESSION['grouplist'][$_SESSION['step'] - 1][0]) === false) {
        if (isset($move) && $move == "moveprev") {
            $_SESSION['step'] = $_SESSION['step'] - 1;
        }
        if (isset($move) && $move == "movenext") {
            $_SESSION['step'] = $_SESSION['step'] + 1;
        }
        if ($_SESSION['step'] > $_SESSION['totalsteps']) {
            // We are skipping groups, but we moved 'off' the last group.
            // Now choose to implement an implicit submit (old behaviour),
            // or create an empty page giving the user the explicit option to submit.
            if (isset($show_empty_group_if_the_last_group_is_hidden) && $show_empty_group_if_the_last_group_is_hidden == true) {
                $show_empty_group = true;
                break;
            } else {
                $move = "movesubmit";
Exemplo n.º 2
0
/**
* Creates an array with details on a particular response for display purposes
* Used in Print answers (done), Detailed response view (Todo:)and Detailed admin notification email (done)
*
* @param mixed $iSurveyID
* @param mixed $iResponseID
* @param mixed $sLanguageCode
* @param boolean $bHonorConditions Apply conditions
*/
function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorConditions = false)
{
    global $connect;
    $aFieldMap = createFieldMap($iSurveyID, 'full', false, false, $sLanguageCode);
    //Get response data
    $idquery = "SELECT * FROM " . db_table_name('survey_' . $iSurveyID) . " WHERE id=" . $iResponseID;
    $idrow = $connect->GetRow($idquery) or safe_die("Couldn't get entry<br />\n{$idquery}<br />\n" . $connect->ErrorMsg());
    //Checked
    $aResultTable = array();
    $oldgid = 0;
    $oldqid = 0;
    foreach ($aFieldMap as $sKey => $fname) {
        if (!empty($fname['qid'])) {
            $attributes = getQuestionAttributes($fname['qid']);
            if (getQuestionAttributeValue($attributes, 'hidden') == 1) {
                continue;
            }
        }
        $question = $fname['question'];
        $subquestion = '';
        if (isset($fname['gid']) && !empty($fname['gid'])) {
            //Check to see if gid is the same as before. if not show group name
            if ($oldgid !== $fname['gid']) {
                $oldgid = $fname['gid'];
                if (!$bHonorConditions || checkgroupfordisplay($fname['gid'])) {
                    $aResultTable['gid_' . $fname['gid']] = array($fname['group_name']);
                }
            }
        }
        if (isset($fname['qid']) && !empty($fname['qid'])) {
            if ($bHonorConditions) {
                $isQuestionVisible = checkquestionfordisplay($fname['qid'], null);
            } else {
                $isQuestionVisible = true;
            }
            if ($oldqid !== $fname['qid']) {
                $oldqid = $fname['qid'];
                if ($isQuestionVisible) {
                    if (isset($fname['subquestion']) || isset($fname['subquestion1']) || isset($fname['subquestion2'])) {
                        $aResultTable['qid_' . $fname['sid'] . 'X' . $fname['gid'] . 'X' . $fname['qid']] = array($fname['question'], '', '');
                    } else {
                        $answer = getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]);
                        $aResultTable[$fname['fieldname']] = array($question, '', $answer);
                        continue;
                    }
                } else {
                    continue;
                }
            }
        } else {
            $answer = getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]);
            $aResultTable[$fname['fieldname']] = array($question, '', $answer);
            continue;
        }
        if (isset($fname['subquestion'])) {
            $subquestion = "{$fname['subquestion']}";
        }
        if (isset($fname['subquestion1'])) {
            $subquestion = "{$fname['subquestion1']}";
        }
        if (isset($fname['subquestion2'])) {
            $subquestion .= "[{$fname['subquestion2']}]";
        }
        if ($isQuestionVisible) {
            $answer = getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]);
            $aResultTable[$fname['fieldname']] = array('', $subquestion, $answer);
        }
    }
    return $aResultTable;
}
Exemplo n.º 3
0
    if ($thissurvey['active'] != "Y")
    {
        echo "<p style='text-align:center' class='error'>".$clang->gT("This survey is currently not active. You will not be able to save your responses.")."</p>\n";
    }


    if($thissurvey['allowjumps']=='Y')
    {
        echo "\n\n<!-- PRESENT THE INDEX -->\n";

        echo '<div id="index"><div class="container"><h2>' . $clang->gT("Question index") . '</h2>';
        for($v = 0, $n = 0; $n != $_SESSION['maxstep']; ++$n)
        {
            $g = $_SESSION['grouplist'][$n];
            if(!checkgroupfordisplay($g[0]))
                continue;

            $sText = FlattenText($g[1]);

            $bGAnsw = true;
            foreach($_SESSION['fieldarray'] as $ia)
            {
                if($ia[5] != $g[0])
                    continue;

                $qidattributes=getQuestionAttributes($ia[0], $ia[4]);
                if($qidattributes['hidden']==1 || !checkquestionfordisplay($ia[0]))
                    continue;

                if (!bCheckQuestionForAnswer($ia[1], $aFieldnamesInfoInv))