Skip to content

Commit

Permalink
Dev Scrutinizer Auto-Fixes (#933)
Browse files Browse the repository at this point in the history
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
  • Loading branch information
scrutinizer-auto-fixer authored and c-schmitz committed Jan 11, 2018
1 parent 1dbf195 commit 38b1463
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions application/controllers/RegisterController.php
Expand Up @@ -191,7 +191,7 @@ public function getRegisterErrors($iSurveyId)
*
* @return Array The rendereable array
*/
public function getRegisterSuccess($iSurveyId, $iTokenId){
public function getRegisterSuccess($iSurveyId, $iTokenId) {
$oSurvey = Survey::model()->findByPk($iSurveyId);

$oToken = Token::model($iSurveyId)->findByPk($iTokenId);
Expand Down Expand Up @@ -489,7 +489,7 @@ public function getStartDate($iSurveyId)
* Display needed public page
* @param $iSurveyId
*/
private function display($iSurveyId, $iTokenId=null, $registerContent)
private function display($iSurveyId, $iTokenId = null, $registerContent)
{
$sLanguage = Yii::app()->language;
$this->aGlobalData['surveyid'] = $surveyid = $iSurveyId;
Expand All @@ -501,7 +501,7 @@ private function display($iSurveyId, $iTokenId=null, $registerContent)

$oTemplate = Template::model()->getInstance('', $iSurveyId);

if($iTokenId!==null){
if ($iTokenId !== null) {
$aData['aSurveyInfo'] = self::getRegisterSuccess($iSurveyId, $iTokenId);
$aData['registerSuccess'] = true;
} else {
Expand Down
16 changes: 8 additions & 8 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -1818,15 +1818,15 @@ private function _createSampleGroup($iSurveyID)
{
// Now create a new dummy group
$sLanguage = Survey::model()->findByPk($iSurveyID)->language;
$oGroup=new QuestionGroup();
$oGroup->sid=$iSurveyID;
$oGroup->group_order=1;
$oGroup->grelevance='1';
$oGroup = new QuestionGroup();
$oGroup->sid = $iSurveyID;
$oGroup->group_order = 1;
$oGroup->grelevance = '1';
$oGroup->save();
$oGroupL10ns=new QuestionGroupL10ns();
$oGroupL10ns->gid=$oGroup->gid;
$oGroupL10ns->group_name=gt('My first question group', 'html', $sLanguage);
$oGroupL10ns->language=$sLanguage;
$oGroupL10ns = new QuestionGroupL10ns();
$oGroupL10ns->gid = $oGroup->gid;
$oGroupL10ns->group_name = gt('My first question group', 'html', $sLanguage);
$oGroupL10ns->language = $sLanguage;
$oGroupL10ns->save();
return $oGroup->gid;
}
Expand Down
32 changes: 16 additions & 16 deletions application/helpers/admin/import_helper.php
Expand Up @@ -141,7 +141,7 @@ function XMLImportGroup($sFullFilePath, $iNewSID)
$iOldSID = $insertdata['sid'];
$insertdata['sid'] = $iNewSID;
$insertdata['gid'] = $aGIDReplacements[$insertdata['gid']];
$oldqid = $insertdata['qid']; // save the old qid
$oldqid = $insertdata['qid']; // save the old qid
unset($insertdata['qid']);

if ($insertdata) {
Expand Down Expand Up @@ -580,7 +580,7 @@ function XMLImportQuestion($sFullFilePath, $iNewSID, $newgid, $options = array('
$insertdata['sid'] = $iNewSID;
$insertdata['gid'] = $newgid;
$insertdata['question_order'] = $newquestionorder;
$iOldQID = $insertdata['qid']; // save the old qid
$iOldQID = $insertdata['qid']; // save the old qid
unset($insertdata['qid']);

// now translate any links
Expand Down Expand Up @@ -929,7 +929,7 @@ function XMLImportLabelsets($sFullFilePath, $options)
$results['labelsets'] = 0;
$results['labels'] = 0;
$results['warnings'] = array();
$aImportedLabelSetIDs= array();
$aImportedLabelSetIDs = array();

// Import label sets table ===================================================================================
foreach ($xml->labelsets->rows->row as $row) {
Expand All @@ -941,12 +941,12 @@ function XMLImportLabelsets($sFullFilePath, $options)
unset($insertdata['lid']); // save the old qid

// Insert the new question
$arLabelset= new LabelSet();
$arLabelset = new LabelSet();
$arLabelset->setAttributes($insertdata);
$arLabelset->save();
$aLSIDReplacements[$iOldLabelSetID] = $arLabelset->lid; // add old and new lsid to the mapping array
$results['labelsets']++;
$aImportedLabelSetIDs[]=$arLabelset->lid;
$aImportedLabelSetIDs[] = $arLabelset->lid;
}

// Import labels table ===================================================================================
Expand All @@ -959,33 +959,33 @@ function XMLImportLabelsets($sFullFilePath, $options)
}
$insertdata['lid'] = $aLSIDReplacements[$insertdata['lid']];
if ($iDBVersion < 350) {
$insertdataLS['title'] =$insertdata['title'];
$insertdataLS['language'] =$insertdata['language'];
$insertdataLS['title'] = $insertdata['title'];
$insertdataLS['language'] = $insertdata['language'];
unset ($insertdata['title']);
unset ($insertdata['language']);
} else {
$iOldLabelID=$insertdata['id'];
$iOldLabelID = $insertdata['id'];
}
unset ($insertdata['id']);

if ($iDBVersion < 350) {
$findLabel = Label::model()->findByAttributes($insertdata);
if (empty($findLabel)) {
$arLabel= new Label();
$arLabel = new Label();
$arLabel->setAttributes($insertdata);
$arLabel->save();
$insertdataLS['label_id']=$arLabel->id;
$insertdataLS['label_id'] = $arLabel->id;
} else {
$insertdataLS['label_id'] = $findLabel->id;
}
$arLabelL10n = new LabelL10n();
$arLabelL10n->setAttributes($insertdataLS);
$arLabelL10n->save();
} else {
$arLabel= new Label();
$arLabel = new Label();
$arLabel->setAttributes($insertdata);
$arLabel->save();
$aLIDReplacements[$iOldLabelID]=$arLabel->id;
$aLIDReplacements[$iOldLabelID] = $arLabel->id;
}

$results['labels']++;
Expand Down Expand Up @@ -1015,10 +1015,10 @@ function XMLImportLabelsets($sFullFilePath, $options)
$aCounts=array_count_values($aLabelSetCheckSums);
foreach ($aImportedLabelSetIDs as $iLabelSetID)
{
if ($aCounts[$aLabelSetCheckSums[$iLabelSetID]]>1)
{
LabelSet::model()->deleteLabelSet($iLabelSetID);
}
if ($aCounts[$aLabelSetCheckSums[$iLabelSetID]]>1)
{
LabelSet::model()->deleteLabelSet($iLabelSetID);
}
}

//END CHECK FOR DUPLICATES
Expand Down
12 changes: 6 additions & 6 deletions application/helpers/admin/label_helper.php
Expand Up @@ -70,9 +70,9 @@ function updateset($lid)
}
$criteria->mergeWith($langcriteria);
debugbreak();
$aLabels=Label::model()->with('labelL10ns')->together()->findAll($criteria);
$aLabels = Label::model()->with('labelL10ns')->together()->findAll($criteria);
foreach ($aLabels as $aLabel) {
foreach ($aLabel->labelL10ns as $aLabelL10ns){
foreach ($aLabel->labelL10ns as $aLabelL10ns) {
$aLabelL10ns->delete();
}
}
Expand Down Expand Up @@ -123,9 +123,9 @@ function modlabelsetanswers($lid)
$sPostData = Yii::app()->getRequest()->getPost('dataToSend');
$sPostData = str_replace("\t", '', $sPostData);
if (get_magic_quotes_gpc()) {
$data = json_decode(stripslashes($sPostData),true);
$data = json_decode(stripslashes($sPostData), true);
} else {
$data = json_decode($sPostData,true);
$data = json_decode($sPostData, true);
}

if ($ajax) {
Expand All @@ -135,8 +135,8 @@ function modlabelsetanswers($lid)
if (count(array_unique($data['codelist'])) == count($data['codelist'])) {

// First delete all labels without corresponding code
$aLabels=Label::model()->findAllByAttributes(['lid'=>$lid]);
foreach($aLabels as $aLabel)
$aLabels = Label::model()->findAllByAttributes(['lid'=>$lid]);
foreach ($aLabels as $aLabel)
{
// if {}
}
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -1025,11 +1025,11 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
$oDB->createCommand()->dropColumn('{{labels}}', 'language');


// Extend language field on labelsets
alterColumn('{{labelsets}}', 'languages', "string(255)", false);
// Extend language field on labelsets
alterColumn('{{labelsets}}', 'languages', "string(255)", false);

// Extend question type field length
alterColumn('{{questions}}','type','string(30)',false,'T');
alterColumn('{{questions}}', 'type', 'string(30)', false, 'T');

// Drop autoincrement on timings table primary key
upgradeSurveyTimings350();
Expand Down
14 changes: 7 additions & 7 deletions application/models/LabelSet.php
Expand Up @@ -94,19 +94,19 @@ public function getLID()
}

/**
* Recursively deletes a label set including labels and localizations
*
* @param integer $id The label set ID
*/
* Recursively deletes a label set including labels and localizations
*
* @param integer $id The label set ID
*/
public function deleteLabelSet($id)
{
$arLabelSet=$this->findByPk($id);
$arLabelSet = $this->findByPk($id);
if (empty($arLabelSet)) {
return false;
}
foreach($arLabelSet->labels as $arLabel)
foreach ($arLabelSet->labels as $arLabel)
{
foreach($arLabel->labelL10ns as $arLabelL10n)
foreach ($arLabel->labelL10ns as $arLabelL10n)
{
$arLabelL10n->delete();
}
Expand Down

0 comments on commit 38b1463

Please sign in to comment.