Navigation Menu

Skip to content

Commit

Permalink
Dev Fixed some concatenation
Browse files Browse the repository at this point in the history
Dev Update Scrutinizer rules
  • Loading branch information
c-schmitz committed Nov 24, 2017
1 parent e9a40b4 commit 64f9a68
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 34 deletions.
7 changes: 6 additions & 1 deletion .scrutinizer.yml
Expand Up @@ -2,10 +2,14 @@ build:
tests:
override:
- true

nodes:
tests: true
filter:
paths: [application/*]
excluded_paths: [tests/*, framework/*, locale/*, docs/*, fonts/*, third_party/*, application/helpers/adodb/*, application/libraries/admin/http/*, application/libraries/admin/pclzip/*, application/extensions/*, application/views/*, application/third_party/*, images/*, styles/*, styles-public/*, templates/*, themes/*, tmp/*, upload/*]
excluded_paths: [application/helpers/adodb/*, application/libraries/admin/http/*, application/libraries/admin/pclzip/*, application/extensions/*, application/views/*, application/third_party/*]
checks:
javascript: { true }
php:
code_rating: true
duplication: true
Expand All @@ -15,6 +19,7 @@ tools:
enabled: true
config:
level: psr2
lowercase_keywords: false
filter:
excluded_paths:
- 'framework/*'
Expand Down
2 changes: 1 addition & 1 deletion application/commands/ResetPasswordCommand.php
Expand Up @@ -29,7 +29,7 @@ public function run($sArgument)
return 0;
}
} else {
echo "User {$sArgument[0]} not found.\n";
echo "User ".$sArgument[0]." not found.\n";
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/Statistics_userController.php
Expand Up @@ -313,7 +313,7 @@ public function createSGQA(array $filters)

foreach ($filters as $flt) {
//SGQ identifier
$myfield = "{$this->iSurveyID}X{$flt[1]}X{$flt[0]}";
$myfield = $this->iSurveyID.'X'.$flt[1].'X'.$flt[0];

//let's switch through the question type for each question
switch ($flt[2]) {
Expand Down Expand Up @@ -349,7 +349,7 @@ public function createSGQA(array $filters)
case "T": // Long free text
case "U": // Huge free text
case "S": // Short free text
$myfield = "T$myfield";
$myfield = "T".$myfield;
$allfields[] = $myfield;
break;
case ";": //ARRAY (Multi Flex) (Text)
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/PluginHelper.php
Expand Up @@ -97,7 +97,7 @@ protected function getPluginInstanceAndMethod($pluginName, $methodName)
try {
$refMethod = $refClass->getMethod($methodName);
} catch (ReflectionException $ex) {
throw new \CException("Plugin $pluginName has no method $methodName");
throw new \CException('Plugin '.$pluginName.' has no method '.$methodName);
}

return array($pluginInstance, $refMethod);
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/admin/import_helper.php
Expand Up @@ -2233,7 +2233,7 @@ function TSVImportSurvey($sFullFilePath)
$insertdata['parent_qid'] = 0;

// For multi numeric survey : same name, add the gid to have same name on different gid. Bad for EM.
$fullqname = "G{$gid}_".$qname;
$fullqname = 'G'.$gid.'_'.$qname;
if (isset($qinfo[$fullqname])) {
$qseq = $qinfo[$fullqname]['question_order'];
$qid = $qinfo[$fullqname]['qid'];
Expand Down Expand Up @@ -2350,7 +2350,7 @@ function TSVImportSurvey($sFullFilePath)
$insertdata['mandatory'] = (isset($row['mandatory']) ? $row['mandatory'] : '');
$insertdata['scale_id'] = $scale_id;
// For multi nueric language, qid is needed, why not gid. name is not unique.
$fullsqname = "G{$gid}Q{$qid}_{$scale_id}_{$sqname}";
$fullsqname = 'G'.$gid.'Q'.$qid.'_'.$scale_id.'_'.$sqname;
if (isset($sqinfo[$fullsqname])) {
$qseq = $sqinfo[$fullsqname]['question_order'];
$sqid = $sqinfo[$fullsqname]['sqid'];
Expand Down
20 changes: 10 additions & 10 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -116,8 +116,8 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
$counter = 0;
$maxyvalue = 0;
foreach ($grawdata as $datapoint) {
$DataSet->AddPoint(array($datapoint), "Serie$counter");
$DataSet->AddSerie("Serie$counter");
$DataSet->AddPoint(array($datapoint), 'Serie'.$counter);
$DataSet->AddSerie("Serie".$counter);

$counter++;
if ($datapoint > $maxyvalue) {
Expand Down Expand Up @@ -153,7 +153,7 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw

$counter = 0;
foreach ($lblout as $sLabelName) {
$DataSet->SetSerieName(html_entity_decode($sLabelName, null, 'UTF-8'), "Serie$counter");
$DataSet->SetSerieName(html_entity_decode($sLabelName, null, 'UTF-8'), "Serie".$counter);
$counter++;
}

Expand Down Expand Up @@ -3564,16 +3564,16 @@ public function generate_html_chartjs_statistics($surveyid, $allfields, $q2show
$myField = $surveyid."X".$field['gid']."X".$field['qid'];

// Multiple choice get special treatment
if ($field['type'] == "M") {$myField = "M$myField"; }
if ($field['type'] == "P") {$myField = "P$myField"; }
if ($field['type'] == "M") {$myField = "M".$myField; }
if ($field['type'] == "P") {$myField = "P".$myField; }
//numerical input will get special treatment (arihtmetic mean, standard derivation, ...)
if ($field['type'] == "N") {$myField = "N$myField"; }
if ($field['type'] == "|") {$myField = "|$myField"; }
if ($field['type'] == "Q") {$myField = "Q$myField"; }
if ($field['type'] == "N") {$myField = "N".$myField; }
if ($field['type'] == "|") {$myField = "|".$myField; }
if ($field['type'] == "Q") {$myField = "Q".$myField; }
// textfields get special treatment
if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U") {$myField = "T$myField"; }
if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U") {$myField = "T".$myField; }
//statistics for Date questions are not implemented yet.
if ($field['type'] == "D") {$myField = "D$myField"; }
if ($field['type'] == "D") {$myField = "D".$myField; }
if ($field['type'] == "F" || $field['type'] == "H") {
//Get answers. We always use the answer code because the label might be too long elsewise
$query = "SELECT code, answer FROM {{answers}} WHERE qid='".$field['qid']."' AND scale_id=0 AND language='{$language}' ORDER BY sortorder, answer";
Expand Down
8 changes: 4 additions & 4 deletions application/helpers/qanda_helper.php
Expand Up @@ -1050,7 +1050,7 @@ function do_date($ia)
'dateformat' => $dateformatdetails['jsdate'],
), true);

App()->getClientScript()->registerScript("doDropDownDate{$ia[0]}", "doDropDownDate({$ia[0]});", CClientScript::POS_BEGIN);
App()->getClientScript()->registerScript('doDropDownDate'.$ia[0], "doDropDownDate({$ia[0]});", CClientScript::POS_BEGIN);
} else {
$coreClass .= " text-item";
// Format the date for output
Expand Down Expand Up @@ -1128,7 +1128,7 @@ function do_date($ia)
);
App()->getClientScript()->registerScript("setDatePickerGlobalOption", "$.extend( $.fn.datetimepicker.defaults, ".json_encode($aDefaultDatePicker)." )", CClientScript::POS_BEGIN);
}
App()->getClientScript()->registerScript("doPopupDate{$ia[0]}", "doPopupDate({$ia[0]});", LSYii_ClientScript::POS_POSTSCRIPT);
App()->getClientScript()->registerScript(doPopupDate.'$ia[0]}', "doPopupDate({$ia[0]});", LSYii_ClientScript::POS_POSTSCRIPT);
}
$inputnames[] = $ia[1];

Expand Down Expand Up @@ -2319,7 +2319,7 @@ function do_multiplechoice_withcomments($ia)

if ($aQuestionAttributes['commented_checkbox'] != "allways" && $aQuestionAttributes['commented_checkbox_auto']) {
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."multiplechoice_withcomments.js", LSYii_ClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScript("doMultipleChoiceWithComments{$ia[0]}",
Yii::app()->getClientScript()->registerScript('doMultipleChoiceWithComments'.$ia[0],
"doMultipleChoiceWithComments({$ia[0]},'{$aQuestionAttributes["commented_checkbox"]}');",
LSYii_ClientScript::POS_POSTSCRIPT);
}
Expand Down Expand Up @@ -5633,7 +5633,7 @@ function do_array_dual($ia)
$inputnames = "";
}
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."dualscale.js", CClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScript("doDualScaleFunction{$ia[0]}", "{$doDualScaleFunction}({$ia[0]});", LSYii_ClientScript::POS_POSTSCRIPT);
Yii::app()->getClientScript()->registerScript('doDualScaleFunction'.$ia[0], "{$doDualScaleFunction}({$ia[0]});", LSYii_ClientScript::POS_POSTSCRIPT);

return array($answer, $inputnames);
}
Expand Down
20 changes: 10 additions & 10 deletions application/helpers/userstatistics_helper.php
Expand Up @@ -117,8 +117,8 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
$counter = 0;
$maxyvalue = 0;
foreach ($grawdata as $datapoint) {
$DataSet->AddPoint(array($datapoint), "Serie$counter");
$DataSet->AddSerie("Serie$counter");
$DataSet->AddPoint(array($datapoint), "Serie".$counter);
$DataSet->AddSerie("Serie".$counter);

$counter++;
if ($datapoint > $maxyvalue) {
Expand Down Expand Up @@ -155,7 +155,7 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw

$counter = 0;
foreach ($lblout as $sLabelName) {
$DataSet->SetSerieName(html_entity_decode($sLabelName, null, 'UTF-8'), "Serie$counter");
$DataSet->SetSerieName(html_entity_decode($sLabelName, null, 'UTF-8'), "Serie".$counter);
$counter++;
}

Expand Down Expand Up @@ -2591,18 +2591,18 @@ public function generate_statistics($surveyid, $allfields, $q2show = 'all', $use
$myField = $surveyid."X".$field['gid']."X".$field['qid'];

// Multiple choice get special treatment
if ($field['type'] == "M") {$myField = "M$myField"; }
if ($field['type'] == "P") {$myField = "P$myField"; }
if ($field['type'] == "M") {$myField = "M".$myField; }
if ($field['type'] == "P") {$myField = "P".$myField; }
//numerical input will get special treatment (arihtmetic mean, standard derivation, ...)
if ($field['type'] == "N") {$myField = "N$myField"; }
if ($field['type'] == "N") {$myField = "N".$myField; }

if ($field['type'] == "|") {$myField = "|$myField"; }
if ($field['type'] == "|") {$myField = "|".$myField; }

if ($field['type'] == "Q") {$myField = "Q$myField"; }
if ($field['type'] == "Q") {$myField = "Q".$myField; }
// textfields get special treatment
if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U") {$myField = "T$myField"; }
if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U") {$myField = "T".$myField; }
//statistics for Date questions are not implemented yet.
if ($field['type'] == "D") {$myField = "D$myField"; }
if ($field['type'] == "D") {$myField = "D".$myField; }
if ($field['type'] == "F" || $field['type'] == "H") {
//Get answers. We always use the answer code because the label might be too long elsewise
$query = "SELECT code, answer FROM {{answers}} WHERE qid='".$field['qid']."' AND scale_id=0 AND language='{$language}' ORDER BY sortorder, answer";
Expand Down
6 changes: 3 additions & 3 deletions application/models/Response.php
Expand Up @@ -48,7 +48,7 @@ public function getFiles($sQID = 0)
$questions = Question::model()->findAllByAttributes(array('sid' => $this->dynamicId, 'type' => '|', 'language'=>$survey->language));
$files = array();
foreach ($questions as $question) {
$field = "{$question->sid}X{$question->gid}X{$question->qid}";
$field = $question->sid.'X'.$question->gid.'X'.$question->qid;
$data = json_decode(stripslashes($this->getAttribute($field)), true);
if (is_array($data)) {
$files = array_merge($files, $data);
Expand All @@ -71,8 +71,8 @@ public function getFilesAndSqga($sQID = 0)
$aQuestions = Question::model()->findAllByAttributes($aConditions);
$files = array();
foreach ($aQuestions as $question) {
$field = "{$question->sid}X{$question->gid}X{$question->qid}";
$data = json_decode(stripslashes($this->getAttribute($field)), true);
$field = $question->sid.'X'.$question->gid.'X'.$question->qid;
$data = json_decode(stripslashes($this->getAttribute($field)), true);
if (is_array($data)) {
$files[$field] = $data;
}
Expand Down

0 comments on commit 64f9a68

Please sign in to comment.