예제 #1
0
 $conditionsoutput_main_content .= "\t<div id='PREVQUESTIONS'>\n" . "\t\t<select name='prevQuestionSGQA' id='prevQuestionSGQA' size='7'>\n";
 foreach ($cquestions as $cqn) {
     // building the @SGQA@ placeholders options
     if ($cqn[2] != 'M' && $cqn[2] != 'P') {
         // Type M or P aren't real fieldnames and thus can't be used in @SGQA@ placehodlers
         $conditionsoutput_main_content .= "\t\t<option value='@{$cqn['3']}@' title=\"" . htmlspecialchars($cqn[0]) . "\"";
         if (isset($p_prevquestionsgqa) && $p_prevquestionsgqa == "@" . $cqn[3] . "@") {
             $conditionsoutput_main_content .= " selected='selected'";
         }
         $conditionsoutput_main_content .= ">{$cqn['0']}</option>\n";
     }
 }
 $conditionsoutput_main_content .= "\t\t</select>\n" . "\t\t<br /><span id='prevQuestionSGQALabel'>" . $clang->gT("Answers from previous questions") . "</span>\n" . "\t</div>\n";
 // Token tab
 $conditionsoutput_main_content .= "\t<div id='TOKENATTRS'>\n" . "\t\t<select name='tokenAttr' id='tokenAttr' size='7'>\n";
 foreach (GetTokenFieldsAndNames($surveyid) as $tokenattr => $tokenattrName) {
     $conditionsoutput_main_content .= "\t\t<option value='{TOKEN:" . strtoupper($tokenattr) . "}'>" . html_escape($tokenattrName) . "</option>\n";
 }
 $conditionsoutput_main_content .= "\t\t</select>\n" . "\t\t<br /><span id='tokenAttrLabel'>" . $clang->gT("Attributes values from the participant's token") . "</span>\n" . "\t</div>\n";
 // Regexp Tab
 $conditionsoutput_main_content .= "\t<div id='REGEXP' style='display:'>\n" . "\t\t<textarea name='ConditionRegexp' id='ConditionRegexp' rows='5' cols='113'>{$EDITConditionRegexp}</textarea>\n" . "\t\t<br /><div id='ConditionRegexpLabel'><a href=\"http://docs.limesurvey.org/tiki-index.php?page=Using+Regular+Expressions\" target=\"_blank\">" . $clang->gT("Regular expression") . "</a></div>\n" . "\t</div>\n";
 $conditionsoutput_main_content .= "</div>\n";
 // end conditiontarget div
 $js_admin_includes[] = $homeurl . '/scripts/conditions.js';
 $js_admin_includes[] = $rooturl . '/scripts/jquery/lime-conditions-tabs.js';
 if ($subaction == "editthiscondition" && isset($p_cid)) {
     $submitLabel = $clang->gT("Update condition");
     $submitSubaction = "updatecondition";
     $submitcid = sanitize_int($p_cid);
 } else {
     $submitLabel = $clang->gT("Add condition");
     } elseif ($distinctrow['method'] == '<=') {
         $explanation .= $clang->gT("Answer was less than or equal to") . " ";
     } elseif ($distinctrow['method'] == '>=') {
         $explanation .= $clang->gT("Answer was greater than or equal to") . " ";
     } elseif ($distinctrow['method'] == '>') {
         $explanation .= $clang->gT("Answer was greater than") . " ";
     } elseif ($distinctrow['method'] == 'RX') {
         $explanation .= $clang->gT("Answer matched (regexp)") . " ";
     } else {
         $explanation .= $clang->gT("Answer was") . " ";
     }
     $explanation .= " " . $distinctrow['value'];
 }
 if (!$distinctrow['cqid']) {
     // cqid == 0  ==> token attribute match
     $tokenData = GetTokenFieldsAndNames($surveyid);
     preg_match('/^{TOKEN:([^}]*)}$/', $distinctrow['cfieldname'], $extractedTokenAttr);
     $explanation .= "Your " . $tokenData[strtolower($extractedTokenAttr[1])] . " ";
     if ($distinctrow['method'] == '==') {
         $explanation .= $clang->gT("is") . " ";
     } elseif ($distinctrow['method'] == '!=') {
         $explanation .= $clang->gT("is NOT") . " ";
     } elseif ($distinctrow['method'] == '<') {
         $explanation .= $clang->gT("is less than") . " ";
     } elseif ($distinctrow['method'] == '<=') {
         $explanation .= $clang->gT("is less than or equal to") . " ";
     } elseif ($distinctrow['method'] == '>=') {
         $explanation .= $clang->gT("is greater than or equal to") . " ";
     } elseif ($distinctrow['method'] == '>') {
         $explanation .= $clang->gT("is greater than") . " ";
     } elseif ($distinctrow['method'] == 'RX') {
예제 #3
0
    ."\t<input type='text' class='popupdatetime' size='20' id='validfrom' name='validfrom' value=\"";
    if (isset($validfrom)){
        $datetimeobj = new Date_Time_Converter($validfrom , "Y-m-d H:i:s");
        $tokenoutput .=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
    }
    $tokenoutput .= "\" />\n <label for='validuntil'>".$clang->gT('until')
    ."\t</label><input type='text' size='20' id='validuntil' name='validuntil' class='popupdatetime' value=\"";
    if (isset($validuntil)){
        $datetimeobj = new Date_Time_Converter($validuntil , "Y-m-d H:i:s");
        $tokenoutput .=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
    }
    $tokenoutput .= "\" /> <span class='annotation'>".sprintf($clang->gT('Format: %s'),$dateformatdetails['dateformat'].' '.$clang->gT('hh:mm')).'</span>'
    ."</li>\n";

    // now the attribute fieds
    $attrfieldnames=GetTokenFieldsAndNames($surveyid,true);
    foreach ($attrfieldnames as $attr_name=>$attr_description)
    {
        $tokenoutput .= "<li>"
        ."<label for='$attr_name'>".$attr_description.":</label>\n"
        ."\t<input type='text' size='55' id='$attr_name' name='$attr_name' value='";
        if (isset($$attr_name)) { $tokenoutput .=htmlspecialchars($$attr_name,ENT_QUOTES,'UTF-8');}
        $tokenoutput.="' /></li>";
    }

    $tokenoutput .="\t</ul><p>";
    $tokenoutput .= "<input type='submit' value='".$clang->gT("Add dummy tokens")."' />\n"
    ."<input type='hidden' name='subaction' value='insertdummys' />\n";
    $tokenoutput .= "<input type='hidden' name='sid' value='$surveyid' /></p>\n"
    ."</form>\n";
}
    case 'editgroup':
        // for translation
    // for translation
    case 'editgroup_desc':
        // for translation
    // for translation
    case 'editquestion':
        // for translation
    // for translation
    case 'editquestion_help':
        // for translation
        $replFields[] = array('TOKEN:FIRSTNAME', $clang->gT("First name from token"));
        $replFields[] = array('TOKEN:LASTNAME', $clang->gT("Last name from token"));
        $replFields[] = array('TOKEN:EMAIL', $clang->gT("Email from the token"));
        $replFields[] = array('TOKEN:USESLEFT', $clang->gT("Uses left"));
        $attributes = GetTokenFieldsAndNames($surveyid, true);
        foreach ($attributes as $attributefield => $attributedescription) {
            $replFields[] = array('TOKEN:' . strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"), $attributedescription));
        }
        $replFields[] = array('EXPIRY', $clang->gT("Survey expiration date"));
    case 'editanswer':
        $isInstertansEnabled = true;
        break;
    case 'assessment-text':
        $replFields[] = array('TOTAL', $clang->gT("Overall assessment score"));
        $replFields[] = array('PERC', $clang->gT("Assessment group score"));
        break;
}
if ($isInstertansEnabled === true) {
    if (empty($surveyid)) {
        safe_die("No SID provided.");
예제 #5
0
/**
 * Creates a query string with all fields for the export
 *
 * @return string
 */
function spss_getquery()
{
    global $surveyprivate, $dbprefix, $surveyid, $tokensexist;
    #See if tokens are being used
    if (isset($tokensexist) && $tokensexist == true && $surveyprivate == 'N') {
        $query = "SELECT ";
        $tokenattributes = GetTokenFieldsAndNames($surveyid, false);
        foreach ($tokenattributes as $attributefield => $attributedescription) {
            //Drop the token field, since it is in the survey too
            if ($attributefield != 'token') {
                $query .= "{$dbprefix}tokens_{$surveyid}.{$attributefield}, ";
            }
        }
        $query .= "{$dbprefix}survey_{$surveyid}.*\r\n\t    FROM {$dbprefix}survey_{$surveyid}\r\n\t    LEFT JOIN {$dbprefix}tokens_{$surveyid} ON {$dbprefix}survey_{$surveyid}.token = {$dbprefix}tokens_{$surveyid}.token";
    } else {
        $query = "SELECT *\r\n\t    FROM {$dbprefix}survey_{$surveyid}";
    }
    switch (incompleteAnsFilterstate()) {
        case 'inc':
            //Inclomplete answers only
            $query .= ' WHERE submitdate is null ';
            break;
        case 'filter':
            //Inclomplete answers only
            $query .= ' WHERE submitdate is not null ';
            break;
    }
    return $query;
}
예제 #6
0
/**
 * Creates a query string with all fields for the export
 *
 * @return string
 */
function spss_getquery()
{
    global $surveyprivate, $dbprefix, $surveyid, $tokensexist;
    #See if tokens are being used
    if (isset($tokensexist) && $tokensexist == true && $surveyprivate == 'N') {
        $query = "SELECT case1.case_id as caseid, ";
        $tokenattributes = GetTokenFieldsAndNames($surveyid, false, false);
        foreach ($tokenattributes as $attributefield => $attributedescription) {
            //Drop the token field, since it is in the survey too
            if ($attributefield != 'token' && $attributefield != 'callattempts' && $attributefield != 'onappointment') {
                $query .= "{$dbprefix}tokens_{$surveyid}.{$attributefield}, ";
            }
        }
        $query .= "{$dbprefix}survey_{$surveyid}.*\n\t    FROM {$dbprefix}survey_{$surveyid}\n\t    JOIN `case` as case1 ON ({$dbprefix}survey_{$surveyid}.token = case1.token)\n\t    LEFT JOIN {$dbprefix}tokens_{$surveyid} ON {$dbprefix}survey_{$surveyid}.token = {$dbprefix}tokens_{$surveyid}.token";
    } else {
        $query = "SELECT *\n\t    FROM {$dbprefix}survey_{$surveyid}";
    }
    $qfs = questionnaireSampleFilterstate();
    if ($qfs != false) {
        //Limit responses by questionnaire and/or sample
        $query .= "\tJOIN `case` AS c ON ({$dbprefix}survey_{$surveyid}.token = c.token AND c.questionnaire_id = '{$qfs[0]}') ";
        if ($qfs[1] != 0) {
            //if a sample is selected
            $query .= "\tJOIN `sample` AS s ON (s.sample_id = c.sample_id AND s.import_id = '{$qfs[1]}') ";
        }
    }
    switch (incompleteAnsFilterstate()) {
        case 'inc':
            //Inclomplete answers only
            $query .= ' WHERE submitdate is null ';
            break;
        case 'filter':
            //Inclomplete answers only
            $query .= ' WHERE submitdate is not null ';
            break;
    }
    return $query;
}