Skip to content

Commit

Permalink
Dev Renamed question type constant
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Sep 23, 2021
1 parent 13fbfd4 commit 47c2f7e
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 92 deletions.
Expand Up @@ -1993,7 +1993,7 @@ public static function setMultipleQuestionOtherState($aQids, $sOther, $iSid)
$oQuestion = Question::model()->findByPk(["qid" => $iQid], 'sid=:sid', [':sid' => $iSid]);
// Only set the other state for question types that have this attribute
if (
($oQuestion->type == Question::QT_L_LIST_DROPDOWN)
($oQuestion->type == Question::QT_L_LIST)
|| ($oQuestion->type == Question::QT_EXCLAMATION_LIST_DROPDOWN)
|| ($oQuestion->type == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)
|| ($oQuestion->type == Question::QT_M_MULTIPLE_CHOICE)
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/conditionsaction.php
Expand Up @@ -1678,7 +1678,7 @@ protected function getCAnswersAndCQuestions(array $theserows)
// For dropdown questions
// optinnaly add the 'Other' answer
if (
($rows['type'] == Question::QT_L_LIST_DROPDOWN ||
($rows['type'] == Question::QT_L_LIST ||
$rows['type'] == Question::QT_EXCLAMATION_LIST_DROPDOWN) &&
$rows['other'] == "Y"
) {
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/dataentry.php
Expand Up @@ -699,7 +699,7 @@ public function editdata($subaction, $id, $surveyid)
);
$aDataentryoutput .= CHtml::listBox($fname['fieldname'], $idrow[$fname['fieldname']], $select_options);
break;
case Question::QT_L_LIST_DROPDOWN: //LIST drop-down
case Question::QT_L_LIST: //LIST drop-down
case Question::QT_EXCLAMATION_LIST_DROPDOWN: //List (Radio)
$qidattributes = QuestionAttribute::model()->getQuestionAttributes($fname['qid']);
if (isset($qidattributes['category_separator']) && trim($qidattributes['category_separator']) != '') {
Expand Down Expand Up @@ -2034,7 +2034,7 @@ public function view($surveyid)

break;

case Question::QT_L_LIST_DROPDOWN: //LIST drop-down/radio-button list
case Question::QT_L_LIST: //LIST drop-down/radio-button list
case Question::QT_EXCLAMATION_LIST_DROPDOWN:
if ($arQuestion['type'] == '!' && trim($qidattributes['category_separator']) != '') {
$optCategorySeparator = $qidattributes['category_separator'];
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/printablesurvey.php
Expand Up @@ -336,7 +336,7 @@ function index($surveyid, $lang = null, $bReturn = false)
$conditions[] = $frow->answerl10ns[$sLanguageCode]->answer;
}
break;
case Question::QT_L_LIST_DROPDOWN:
case Question::QT_L_LIST:
case Question::QT_EXCLAMATION_LIST_DROPDOWN:
case Question::QT_O_LIST_WITH_COMMENT:
case Question::QT_R_RANKING_STYLE:
Expand Down Expand Up @@ -589,7 +589,7 @@ function index($surveyid, $lang = null, $bReturn = false)
break;

// ==================================================================
case Question::QT_L_LIST_DROPDOWN:
case Question::QT_L_LIST:
// ==================================================================
case Question::QT_EXCLAMATION_LIST_DROPDOWN: //List - dropdown
if (isset($qidattributes['category_separator']) && trim($qidattributes['category_separator']) != '') {
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/quotas.php
Expand Up @@ -539,7 +539,7 @@ public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
$aAnswerList = array(
'M' => array('Title' => $aQuestion['title'], 'Display' => gT("Male"), 'code' => 'M'),
'F' => array('Title' => $aQuestion['title'], 'Display' => gT("Female"), 'code' => 'F'));
} elseif ($aQuestionType == Question::QT_L_LIST_DROPDOWN || $aQuestionType == Question::QT_O_LIST_WITH_COMMENT || $aQuestionType == Question::QT_EXCLAMATION_LIST_DROPDOWN) {
} elseif ($aQuestionType == Question::QT_L_LIST || $aQuestionType == Question::QT_O_LIST_WITH_COMMENT || $aQuestionType == Question::QT_EXCLAMATION_LIST_DROPDOWN) {
$aAnsResults = Answer::model()
->with('answerl10ns', array('language' => $sBaseLang))
->findAllByAttributes(array('qid' => $iQuestionId));
Expand Down
2 changes: 1 addition & 1 deletion application/core/QuestionTypes/LoadQuestionTypes.php
Expand Up @@ -55,7 +55,7 @@ public static function load($type)
case Question::QT_1_ARRAY_MULTISCALE:
Yii::import('questiontypes.ArrayMultiscale.*');
break;
case Question::QT_L_LIST_DROPDOWN:
case Question::QT_L_LIST:
Yii::import('questiontypes.ListRadio.*');
break;
case Question::QT_EXCLAMATION_LIST_DROPDOWN:
Expand Down
2 changes: 1 addition & 1 deletion application/core/plugins/ExportSTATAxml/STATAxmlWriter.php
Expand Up @@ -397,7 +397,7 @@ protected function updateCustomresponsemap()
case Question::QT_D_DATE: //replace in customResponsemap: date/time as string with STATA-timestamp
$response = strtotime($response . ' GMT') * 1000 + 315619200000; // convert seconds since 1970 (UNIX) to milliseconds since 1960 (STATA)
break;
case Question::QT_L_LIST_DROPDOWN:
case Question::QT_L_LIST:
// For radio lists, user wants code, not label
// TODO: We could skip this loop if we had answer code
foreach ($this->customFieldmap['answers'][$iQID][$iScaleID] as $answer) {
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/export/SurveyObj.php
Expand Up @@ -133,7 +133,7 @@ public function getFullAnswer($fieldName, $answerCode, Translator $translator, $
}
break;

case Question::QT_L_LIST_DROPDOWN: //DROPDOWN LIST
case Question::QT_L_LIST: //DROPDOWN LIST
case Question::QT_EXCLAMATION_LIST_DROPDOWN:
if (mb_substr($fieldName, -5, 5) == 'other') {
$fullAnswer = $answerCode;
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/import_helper.php
Expand Up @@ -2945,7 +2945,7 @@ function TSVImportSurvey($sFullFilePath)
; // these are fake rows to show naming of comment and filecount fields
} elseif ($sqname == 'other' && $lastother == "Y") {
// If last question have other to Y : it's not a real SQ row
if ($qtype == Question::QT_EXCLAMATION_LIST_DROPDOWN || $qtype == Question::QT_L_LIST_DROPDOWN) {
if ($qtype == Question::QT_EXCLAMATION_LIST_DROPDOWN || $qtype == Question::QT_L_LIST) {
// only used to set default value for 'other' in these cases
if (isset($row['default']) && $row['default'] != "") {
$defaultvalue = array();
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -1410,7 +1410,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
}

//handling for "other" field for list radio or list drowpdown
if ((($qtype == Question::QT_L_LIST_DROPDOWN || $qtype == Question::QT_EXCLAMATION_LIST_DROPDOWN) && $qother == Question::QT_Y_YES_NO_RADIO)) {
if ((($qtype == Question::QT_L_LIST || $qtype == Question::QT_EXCLAMATION_LIST_DROPDOWN) && $qother == Question::QT_Y_YES_NO_RADIO)) {
//add "other"
$alist[] = array(gT("Other"), gT("Other"), $fielddata['fieldname'] . 'other');
}
Expand Down Expand Up @@ -1462,7 +1462,7 @@ protected function displaySimpleResults($outputs, $results, $rt, $outputType, $s
if (isset($al[2]) && $al[2]) {
//handling for "other" option
if ($al[0] == gT("Other")) {
if ($outputs['qtype'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $outputs['qtype'] == Question::QT_L_LIST_DROPDOWN) {
if ($outputs['qtype'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $outputs['qtype'] == Question::QT_L_LIST) {
// It is better for single choice question types to filter on the number of '-oth-' entries, than to
// just count the number of 'other' values - that way with failing Javascript the statistics don't get messed up
/* This query selects a count of responses where "other" has been selected */
Expand Down Expand Up @@ -2233,7 +2233,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
if (isset($al[2]) && $al[2]) {
//handling for "other" option
if ($al[0] == gT("Other")) {
if ($outputs['qtype'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $outputs['qtype'] == Question::QT_L_LIST_DROPDOWN) {
if ($outputs['qtype'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $outputs['qtype'] == Question::QT_L_LIST) {
// It is better for single choice question types to filter on the number of '-oth-' entries, than to
// just count the number of 'other' values - that way with failing Javascript the statistics don't get messed up
/* This query selects a count of responses where "other" has been selected */
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/common_helper.php
Expand Up @@ -1004,7 +1004,7 @@ function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $sLanguage)
}
}
break;
case Question::QT_L_LIST_DROPDOWN:
case Question::QT_L_LIST:
case Question::QT_EXCLAMATION_LIST_DROPDOWN:
case Question::QT_O_LIST_WITH_COMMENT:
case Question::QT_I_LANGUAGE:
Expand Down Expand Up @@ -1506,7 +1506,7 @@ function createFieldMap($survey, $style = 'short', $force_refresh = false, $ques
}
}
switch ($arow['type']) {
case Question::QT_L_LIST_DROPDOWN: //RADIO LIST
case Question::QT_L_LIST: //RADIO LIST
case Question::QT_EXCLAMATION_LIST_DROPDOWN: //DROPDOWN LIST
if ($arow['other'] == "Y") {
$fieldname = "{$arow['sid']}X{$arow['gid']}X{$arow['qid']}other";
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/export_helper.php
Expand Up @@ -455,7 +455,7 @@ function SPSSFieldMap($iSurveyID, $prefix = 'V', $sLanguage = '')
Question::QT_I_LANGUAGE => array('name' => 'Language Switch', 'size' => 2, 'SPSStype' => 'A'),
Question::QT_EXCLAMATION_LIST_DROPDOWN => array('name' => 'List (Dropdown)', 'size' => 1, 'SPSStype' => 'F'),
Question::QT_Z_LIST_RADIO_FLEXIBLE => array('name' => 'List (Flexible Labels) (Radio)', 'size' => 1, 'SPSStype' => 'F'),
Question::QT_L_LIST_DROPDOWN => array('name' => 'List (Radio)', 'size' => 1, 'SPSStype' => 'F'),
Question::QT_L_LIST => array('name' => 'List (Radio)', 'size' => 1, 'SPSStype' => 'F'),
Question::QT_O_LIST_WITH_COMMENT => array('name' => 'List With Comment', 'size' => 1, 'SPSStype' => 'F'),
Question::QT_T_LONG_FREE_TEXT => array('name' => 'Long free text', 'size' => 1, 'SPSStype' => 'A'),
Question::QT_K_MULTIPLE_NUMERICAL_QUESTION => array('name' => 'Multiple Numerical Input', 'size' => 1, 'SPSStype' => 'F'),
Expand Down

0 comments on commit 47c2f7e

Please sign in to comment.