Skip to content

Commit

Permalink
Dev: some cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed May 3, 2017
1 parent 58e73d1 commit eb92b8c
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -318,14 +318,14 @@ public function displayParticipants()
if($participantParam)
{
$model->attributes=$participantParam;
}
}
$searchcondition = $request->getPost('searchcondition');
$searchparams = array();
if($searchcondition)
{
$searchparams = explode('||', $searchcondition);
$model->addSurveyFilter($searchparams);
}
}
// data to be passed to view
$aData = array(
'names' => User::model()->findAll(),
Expand Down Expand Up @@ -420,9 +420,9 @@ public function openEditParticipant()
if($participant_id)
{
$model = Participant::model()->findByPk($participant_id);
$operationType = "edit";
$operationType = "edit";
}
else
else
{
$model = new Participant;
$operationType = "add";
Expand Down Expand Up @@ -601,7 +601,7 @@ public function updateParticipant($aData, array $extraAttributes = array())
foreach($extraAttributes as $htmlName => $attributeValue ) {
list(,$attribute_id) = explode('_',$htmlName);
$data = array(
'attribute_id'=>$attribute_id,
'attribute_id'=>$attribute_id,
'participant_id'=>$aData['participant_id'],
'value' => $attributeValue
);
Expand Down Expand Up @@ -1071,8 +1071,8 @@ public function exporttocsv()
{
$condition = explode("%7C%7C", Yii::app()->request->getPost('searchcondition',''));
$search = Participant::model()->getParticipantsSearchMultipleCondition($condition);
}
else
}
else
{
$search = null;
}
Expand Down Expand Up @@ -1125,7 +1125,7 @@ public function exporttocsvcount()
$searchSelected = new CDbCriteria;
if(!empty($chosenParticipants))
$searchSelected->addInCondition("{{participant_id}}",$chosenParticipantsArray);
else
else
$searchSelected = null;

if($search)
Expand All @@ -1148,7 +1148,7 @@ public function exporttocsvcountAll()
$search = new CDbCriteria;
$search->addInCondition("p.participant_id",$chosenParticipants);
}
else
else
{
$search = null;
}
Expand All @@ -1166,7 +1166,7 @@ public function exporttocsvAll()
$search = new CDbCriteria;
$search->addInCondition("p.participant_id",$chosenParticipants);
}
else
else
{
$search = null;
}
Expand Down Expand Up @@ -1255,7 +1255,7 @@ public function attributeControl()
if(Yii::app()->request->getParam('ParticipantAttributeName'))
{
$model->attributes=Yii::app()->request->getParam('ParticipantAttributeName');
}
}
// data to be passed to view
$aData = array(
'names' => User::model()->findAll(),
Expand Down Expand Up @@ -1320,33 +1320,33 @@ public function openEditAttributeNames()
if($attribute_id)
{
$model = ParticipantAttributeName::model()->findByPk($attribute_id);
$editType = "edit";
$editType = "edit";
}
else
{
$model = new ParticipantAttributeName();
$model->attribute_type = 'TB';
$editType = "new";
$editType = "new";
}

// Generate HTML for alternative languages
$languagesOfAttribute = array();
foreach($model->participant_attribute_names_lang as $single_language)
{
$languagesOfAttribute[$single_language['lang']] = $single_language['attribute_name'];
$languagesOfAttribute[$single_language['lang']] = $single_language['attribute_name'];
}

$aData = array(
'model' => $model,
'editType' => $editType,
'languagesOfAttribute' => $languagesOfAttribute
);

$allLangDetailArray = getLanguageData(false, Yii::app()->language);
$aData['languagesForDropdown'][''] = gT("Select language to add");
foreach($allLangDetailArray as $key=>$languageDetail)
{
$aData['languagesForDropdown'][$key] = $languageDetail['description']." (".($languageDetail['nativedescription']).")";
$aData['languagesForDropdown'][$key] = $languageDetail['description']." (".($languageDetail['nativedescription']).")";
}

// Default visibility to false
Expand Down Expand Up @@ -1400,12 +1400,12 @@ public function editAttributeName()
$AttributeNameLanguages = Yii::app()->request->getPost('ParticipantAttributeNameLanguages');
$ParticipantAttributeNamesDropdown = Yii::app()->request->getPost('ParticipantAttributeNamesDropdown');
$operation = Yii::app()->request->getPost('oper');
if($operation === 'edit')
if($operation === 'edit')
{
$ParticipantAttributNamesModel = ParticipantAttributeName::model()->findByPk( $AttributeNameAttributes['attribute_id']);
$success[] = $ParticipantAttributNamesModel->saveAttribute($AttributeNameAttributes);
}
else
else
{
$ParticipantAttributNamesModel = new ParticipantAttributeName;
$ParticipantAttributNamesModel->setAttributes($AttributeNameAttributes);
Expand Down Expand Up @@ -1437,13 +1437,13 @@ public function editAttributeName()
);
$success[] = $ParticipantAttributNamesModel->saveAttributeLanguages($savaLanguageArray);
}
}
}
ls\ajax\AjaxHelper::outputSuccess(gT("Attribute successfully updated"));
}
}

/**
* Deletes a translation from an Attribute, if it has at least one translation
* Requires POST 'attribute_id' (int), 'lang' (string) [language-code]
* Requires POST 'attribute_id' (int), 'lang' (string) [language-code]
* Echoes 'success' (boolean), 'successMessage' (string|null), 'errorMessage' (string|null)
* @return void
*/
Expand All @@ -1463,11 +1463,11 @@ public function deleteLanguageFromAttribute()
}
}
/**
* Deletes a single Attribute via AJAX-call
* Deletes a single Attribute via AJAX-call
* Requires POST 'attribute_id' (int)
* Echoes json-encoded array 'success' (boolean), successMessage (string)
* @return void
*/
*/
public function deleteSingleAttribute()
{
$attribute_id = Yii::app()->request->getPost('attribute_id');
Expand Down Expand Up @@ -1795,7 +1795,7 @@ public function sharePanel()
if(Yii::app()->request->getParam('ParticipantShare'))
{
$model->attributes = Yii::app()->request->getParam('ParticipantShare');
}
}
// data to be passed to view
$aData = array(
'names' => User::model()->findAll(),
Expand Down Expand Up @@ -1911,7 +1911,7 @@ public function editShareInfo()
ParticipantShare::model()->updateShare($aData);
}
}

/**
* Receives an ajax call containing the participant id in the fourth segment of the url
* Supplies list of survey links - surveys of which this participant is on the tokens table
Expand Down

0 comments on commit eb92b8c

Please sign in to comment.