diff --git a/application/controllers/admin/conditionsaction.php b/application/controllers/admin/conditionsaction.php index e126ce281b5..b5237d75cb1 100644 --- a/application/controllers/admin/conditionsaction.php +++ b/application/controllers/admin/conditionsaction.php @@ -1589,12 +1589,12 @@ protected function getCAnswersAndCQuestions(array $theserows) } } elseif ($rows['type'] != Question::QT_M_MULTIPLE_CHOICE && $rows['type'] != Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS && - $rows['type'] != Question::QT_I_LANGUAGE ) { + $rows['type'] != Question::QT_I_LANGUAGE) { // For dropdown questions // optinnaly add the 'Other' answer - if ( ($rows['type'] == Question::QT_L_LIST_DROPDOWN || + if (($rows['type'] == Question::QT_L_LIST_DROPDOWN || $rows['type'] == Question::QT_EXCLAMATION_LIST_DROPDOWN) && - $rows['other'] == "Y" ) { + $rows['other'] == "Y") { $canswers[] = array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'], "-oth-", gT("Other")); } diff --git a/application/controllers/admin/questions.php b/application/controllers/admin/questions.php index 920e9762924..c4746274d62 100644 --- a/application/controllers/admin/questions.php +++ b/application/controllers/admin/questions.php @@ -1489,8 +1489,7 @@ public function setMultipleMandatory() $oQuestion = Question::model()->findByPk(array("qid"=>$iQid, 'language'=>$sAdditionalLanguage)); // These are the questions types that have no mandatory property - so zap it accordingly - if ($oQuestion->type != Question::QT_X_BOILERPLATE_QUESTION && $oQuestion->type != Question::QT_VERTICAL_FILE_UPLOAD) - { + if ($oQuestion->type != Question::QT_X_BOILERPLATE_QUESTION && $oQuestion->type != Question::QT_VERTICAL_FILE_UPLOAD) { $oQuestion->mandatory = $bMandatory; $oQuestion->save(); } diff --git a/application/controllers/admin/statistics.php b/application/controllers/admin/statistics.php index a5ea48af1de..407eb922d15 100644 --- a/application/controllers/admin/statistics.php +++ b/application/controllers/admin/statistics.php @@ -671,8 +671,7 @@ public function simpleStatistics($surveyid) // The questions to display (all question) foreach ($rows as $row) { $type = $row['type']; - if ($type == Question::QT_T_LONG_FREE_TEXT || $type == Question::QT_N_NUMERICAL) - { + if ($type == Question::QT_T_LONG_FREE_TEXT || $type == Question::QT_N_NUMERICAL) { $summary[] = $type.$iSurveyId.'X'.$row['gid'].'X'.$row['qid']; } switch ($type) { diff --git a/application/controllers/admin/usergroups.php b/application/controllers/admin/usergroups.php index ed2edf6f1a0..49fabf00037 100644 --- a/application/controllers/admin/usergroups.php +++ b/application/controllers/admin/usergroups.php @@ -318,7 +318,8 @@ public function index($ugid = false, $header = false) $aData["useradddialog"] = true; $aUsers = User::model()->findAll(['join'=>"LEFT JOIN (SELECT uid AS id FROM {{user_in_groups}} WHERE ugid = {$ugid}) AS b ON t.uid = b.id", 'condition'=>"id IS NULL"]); - $aNewUserListData = CHtml::listData($aUsers, 'uid', function($user) { + $aNewUserListData = CHtml::listData($aUsers, 'uid', function($user) + { return \CHtml::encode($user->users_name)." (".\CHtml::encode($user->full_name).')'; }); // Remove group owner because an owner is automatically member of a group unset($aNewUserListData[$aUserInGroupsResult->owner_id]); @@ -393,7 +394,7 @@ function user($ugid, $action = 'add') } break; } - if (!empty($sFlashType) && !empty($sFlashMessage)) { + if (!empty($sFlashType) && !empty($sFlashMessage)) { Yii::app()->user->setFlash($sFlashType, $sFlashMessage); } $this->getController()->redirect(array('admin/usergroups/sa/view/ugid/'.$ugid)); diff --git a/application/core/plugins/ExportSTATAxml/STATAxmlWriter.php b/application/core/plugins/ExportSTATAxml/STATAxmlWriter.php index 65baa53dc78..44f0fd2853a 100644 --- a/application/core/plugins/ExportSTATAxml/STATAxmlWriter.php +++ b/application/core/plugins/ExportSTATAxml/STATAxmlWriter.php @@ -245,9 +245,7 @@ function createStataFieldmap($survey, $sLanguage, $oOptions) 'code' => 3, 'answer' => gT('Uncertain') ); - } - elseif ($aQuestion['type'] == Question::QT_E_ARRAY_OF_INC_SAME_DEC_QUESTIONS) - { + } elseif ($aQuestion['type'] == Question::QT_E_ARRAY_OF_INC_SAME_DEC_QUESTIONS) { $aFieldmap['answers'][$aQuestion['qid']]['0']['1'] = array( 'code' => 1, 'answer' => gT('Increase') diff --git a/application/helpers/admin/activate_helper.php b/application/helpers/admin/activate_helper.php index ffa4e32f08c..d544781df1d 100644 --- a/application/helpers/admin/activate_helper.php +++ b/application/helpers/admin/activate_helper.php @@ -316,7 +316,7 @@ function activateSurvey($iSurveyID, $simulate = false) case Question::QT_M_MULTIPLE_CHOICE: //Multiple choice case Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS: //Multiple choice with comment case Question::QT_O_LIST_WITH_COMMENT: //DROPDOWN LIST WITH COMMENT - if ($aRow['aid'] != 'other' && strpos($aRow['aid'],'comment')===false && strpos($aRow['aid'],'othercomment')===false) { + if ($aRow['aid'] != 'other' && strpos($aRow['aid'], 'comment') === false && strpos($aRow['aid'], 'othercomment') === false) { $aTableDefinition[$aRow['fieldname']] = "string(5)"; } else { $aTableDefinition[$aRow['fieldname']] = "text"; diff --git a/application/helpers/admin/import_helper.php b/application/helpers/admin/import_helper.php index 4b1b82dc941..ff98ad6b276 100644 --- a/application/helpers/admin/import_helper.php +++ b/application/helpers/admin/import_helper.php @@ -1009,12 +1009,12 @@ function XMLImportLabelsets($sFullFilePath, $options) //CHECK FOR DUPLICATE LABELSETS - if ($options['checkforduplicates']=='on') { + if ($options['checkforduplicates'] == 'on') { $aLabelSetCheckSums = buildLabelSetCheckSumArray(); - $aCounts=array_count_values($aLabelSetCheckSums); + $aCounts = array_count_values($aLabelSetCheckSums); foreach ($aImportedLabelSetIDs as $iLabelSetID) { - if ($aCounts[$aLabelSetCheckSums[$iLabelSetID]]>1) { + if ($aCounts[$aLabelSetCheckSums[$iLabelSetID]] > 1) { LabelSet::model()->deleteLabelSet($iLabelSetID); } } diff --git a/application/helpers/admin/statistics_helper.php b/application/helpers/admin/statistics_helper.php index 20bc9e6384d..027e7f6ddca 100644 --- a/application/helpers/admin/statistics_helper.php +++ b/application/helpers/admin/statistics_helper.php @@ -1416,13 +1416,11 @@ 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_DROPDOWN || $qtype == Question::QT_EXCLAMATION_LIST_DROPDOWN) && $qother == Question::QT_Y_YES_NO_RADIO)) { //add "other" $alist[] = array(gT("Other"), gT("Other"), $fielddata['fieldname'].'other'); } - if ($qtype == Question::QT_O_LIST_WITH_COMMENT) - { + if ($qtype == Question::QT_O_LIST_WITH_COMMENT) { //add "comment" $alist[] = array(gT("Comments"), gT("Comments"), $fielddata['fieldname'].'comment', 'is_comment'); } @@ -1705,8 +1703,7 @@ protected function displaySimpleResults($outputs, $results, $rt, $outputType, $s } // For multi question type, we have to check non completed with ALL sub question set to NULL - if (($outputs['qtype'] == Question::QT_M_MULTIPLE_CHOICE) or ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)) - { + if (($outputs['qtype'] == Question::QT_M_MULTIPLE_CHOICE) or ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)) { $criteria = new CDbCriteria; foreach ($outputs['alist'] as $al) { $criteria->addCondition(Yii::app()->db->quoteColumnName($al[2])." IS NULL"); @@ -1801,8 +1798,7 @@ protected function displaySimpleResults($outputs, $results, $rt, $outputType, $s //data available if (($gdata[$i] !== "N/A")) { //check if data should be aggregated - if (Yii::app()->getConfig('showaggregateddata') == 1 && ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS)) - { + if (Yii::app()->getConfig('showaggregateddata') == 1 && ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS)) { //mark that we have done soemthing special here $aggregated = true; @@ -1905,8 +1901,7 @@ protected function displaySimpleResults($outputs, $results, $rt, $outputType, $s //it's only useful to calculate standard deviation and arithmetic means for question types //5 = 5 Point Scale //A = Array (5 Point Choice) - if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) - { + if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) { $stddev = 0; $stddevarray = array_slice($grawdata, 0, 5, true); $am = 0; @@ -2199,10 +2194,8 @@ 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 ($al[0] == gT("Other")) { + if ($outputs['qtype'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $outputs['qtype'] == Question::QT_L_LIST_DROPDOWN) { // 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 */ @@ -2406,8 +2399,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi //check if aggregated results should be shown elseif (Yii::app()->getConfig('showaggregateddata') == 1) { if (!isset($showheadline) || $showheadline != false) { - if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) - { + if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) { switch ($outputType) { case 'xls': $this->xlsRow++; @@ -2678,8 +2670,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi } // For multi question type, we have to check non completed with ALL sub question set to NULL - if (($outputs['qtype'] == Question::QT_M_MULTIPLE_CHOICE) or ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)) - { + if (($outputs['qtype'] == Question::QT_M_MULTIPLE_CHOICE) or ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)) { $criteria = new CDbCriteria; foreach ($outputs['alist'] as $al) { $criteria->addCondition(Yii::app()->db->quoteColumnName($al[2])." IS NULL"); @@ -2830,8 +2821,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi //data available else { //check if data should be aggregated - if (Yii::app()->getConfig('showaggregateddata') == 1 && ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS)) - { + if (Yii::app()->getConfig('showaggregateddata') == 1 && ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS)) { //mark that we have done soemthing special here $aggregated = true; @@ -3077,8 +3067,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi //it's only useful to calculate standard deviation and arithmetic means for question types //5 = 5 Point Scale //A = Array (5 Point Choice) - if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) - { + if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) { $stddev = 0; $stddevarray = array_slice($grawdata, 0, 5, true); $am = 0; diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php index 648b30c1ff7..6b9c8a544f0 100644 --- a/application/helpers/common_helper.php +++ b/application/helpers/common_helper.php @@ -1137,9 +1137,9 @@ function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $sLanguage) //Find out the question type $this_type = $fields['type']; - switch($this_type) { + switch ($this_type) { case Question::QT_D_DATE: - if (trim($sValue)!='') { + if (trim($sValue) != '') { $qidattributes = QuestionAttribute::model()->getQuestionAttributes($fields['qid']); $dateformatdetails = getDateFormatDataForQID($qidattributes, $iSurveyID); $sValue = convertDateTimeFormat($sValue, "Y-m-d H:i:s", $dateformatdetails['phpdate']); diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index 42fae489585..8645d6c0e63 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -1512,15 +1512,15 @@ function doAssessment($surveyid) { if ($_SESSION['survey_'.$surveyid][$field['fieldname']] == "Y") { - $aAttributes=getQuestionAttributeValues($field['qid']); + $aAttributes = getQuestionAttributeValues($field['qid']); } - $assessmentValue = (int)$aAttributes['assessment_value']; + $assessmentValue = (int) $aAttributes['assessment_value']; } } else { // Single choice question - $usrow = Answer::findByAttributes(['qid'=>$field['qid'],'code'=>$_SESSION['survey_'.$surveyid][$field['fieldname']]]); + $usrow = Answer::findByAttributes(['qid'=>$field['qid'], 'code'=>$_SESSION['survey_'.$surveyid][$field['fieldname']]]); if (!empty($usrow)) { - $assessmentValue = $usrow->assessment_value; + $assessmentValue = $usrow->assessment_value; // $total = $total+$usrow['assessment_value']; } } diff --git a/application/helpers/questionHelper.php b/application/helpers/questionHelper.php index 088fe62b46e..78e88462c0e 100644 --- a/application/helpers/questionHelper.php +++ b/application/helpers/questionHelper.php @@ -80,7 +80,7 @@ public static function getAttributesDefinitions() ); self::$attributes["repeat_headings"] = array( - "types"=>Question::QT_F_ARRAY_FLEXIBLE_ROW . Question::QT_COLON_ARRAY_MULTI_FLEX_NUMBERS . Question::QT_1_ARRAY_MULTISCALE . Question::QT_SEMICOLON_ARRAY_MULTI_FLEX_TEXT, + "types"=>Question::QT_F_ARRAY_FLEXIBLE_ROW.Question::QT_COLON_ARRAY_MULTI_FLEX_NUMBERS.Question::QT_1_ARRAY_MULTISCALE.Question::QT_SEMICOLON_ARRAY_MULTI_FLEX_TEXT, 'category'=>gT('Display'), 'sortorder'=>100, 'inputtype'=>'integer', diff --git a/application/helpers/userstatistics_helper.php b/application/helpers/userstatistics_helper.php index 4b3e90c2df7..8e81759ca59 100644 --- a/application/helpers/userstatistics_helper.php +++ b/application/helpers/userstatistics_helper.php @@ -1428,20 +1428,17 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql, $qresult = Yii::app()->db->createCommand($qquery)->query(); //put answer code and title into array - foreach ($qresult->readAll() as $qrow) - { + foreach ($qresult->readAll() as $qrow) { $qrow = array_values($qrow); $alist[] = array("$qrow[0]", flattenText($qrow[1])); } //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_DROPDOWN || $qtype == Question::QT_EXCLAMATION_LIST_DROPDOWN) && $qother == Question::QT_Y_YES_NO_RADIO)) { //add "other" $alist[] = array(gT("Other"), gT("Other"), $fielddata['fieldname'].'other'); } - if ($qtype == Question::QT_O_LIST_WITH_COMMENT) - { + if ($qtype == Question::QT_O_LIST_WITH_COMMENT) { //add "comment" $alist[] = array(gT("Comments"), gT("Comments"), $fielddata['fieldname'].'comment'); } @@ -1544,10 +1541,8 @@ 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 ($al[0] == gT("Other")) { + if ($outputs['qtype'] == Question::QT_EXCLAMATION_LIST_DROPDOWN || $outputs['qtype'] == Question::QT_L_LIST_DROPDOWN) { // 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 */ @@ -1743,8 +1738,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi //check if aggregated results should be shown elseif (Yii::app()->getConfig('showaggregateddata') == 1) { if (!isset($showheadline) || $showheadline != false) { - if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) - { + if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) { switch ($outputType) { case 'xls': $this->xlsRow++; @@ -1969,8 +1963,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi } // For multiple choice question type, we have to check non completed with ALL sub question set to NULL - if (($outputs['qtype'] == Question::QT_M_MULTIPLE_CHOICE) or ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)) - { + if (($outputs['qtype'] == Question::QT_M_MULTIPLE_CHOICE) or ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS)) { $criteria = new CDbCriteria; foreach ($outputs['alist'] as $al) { $criteria->addCondition(Yii::app()->db->quoteColumnName($al[2])." IS NULL"); @@ -2046,8 +2039,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi * */ if (strpos($label[$i], "class='statisticsbrowsebutton'")) { $extraline = ""; - if ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS) - { + if ($outputs['qtype'] == Question::QT_P_MULTIPLE_CHOICE_WITH_COMMENTS) { $extraline .= "
\n"; } else { $extraline .= "
\n"; @@ -2102,8 +2094,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi //data available else { //check if data should be aggregated - if (Yii::app()->getConfig('showaggregateddata') == 1 && ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS)) - { + if (Yii::app()->getConfig('showaggregateddata') == 1 && ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS)) { //mark that we have done soemthing special here $aggregated = true; @@ -2309,8 +2300,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi //it's only useful to calculate standard deviation and arithmetic means for question types //5 = 5 Point Scale //A = Array (5 Point Choice) - if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) - { + if ($outputs['qtype'] == Question::QT_5_POINT_CHOICE || $outputs['qtype'] == Question::QT_A_ARRAY_5_CHOICE_QUESTIONS) { $stddev = 0; $stddevarray = array_slice($grawdata, 0, 5, true); $am = 0; diff --git a/application/models/SurveyDynamic.php b/application/models/SurveyDynamic.php index ad50ede6dda..182b6a829f2 100644 --- a/application/models/SurveyDynamic.php +++ b/application/models/SurveyDynamic.php @@ -352,8 +352,7 @@ public function getExtendedData($colName, $sLanguage, $base64jsonFieldMap) } // Upload question - if ($oFieldMap->type == Question::QT_VERTICAL_FILE_UPLOAD && strpos($oFieldMap->fieldname, 'filecount') === false) - { + if ($oFieldMap->type == Question::QT_VERTICAL_FILE_UPLOAD && strpos($oFieldMap->fieldname, 'filecount') === false) { $sSurveyEntry = ""; $aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($oFieldMap->qid);