Skip to content

Commit

Permalink
Fixed issue #6504: If admin language is not the same as survey langua…
Browse files Browse the repository at this point in the history
…ge then survey names won't be shown for assigned surveys in central participants database
  • Loading branch information
c-schmitz committed Feb 24, 2013
1 parent 84961a1 commit 074f8c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
9 changes: 6 additions & 3 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -605,10 +605,13 @@ function getSurveyInfo_json()
$aData->records = count($records);
$aData->total = ceil($aData->records / 10);
$i = 0;

foreach ($records as $row)
{
$surveyname = Surveys_languagesettings::model()->getSurveyNames($row['survey_id']);
$oSurvey=Survey::model()->with(array('languagesettings'=>array('condition'=>'surveyls_language=language')))->findByAttributes(array('sid' => $row['survey_id']));
foreach($oSurvey->languagesettings as $oLanguageSetting)
{
$surveyname= $oLanguageSetting->surveyls_title;
}
$surveylink = "";
/* Check permissions of each survey before creating a link*/
if (!hasSurveyPermission($row['survey_id'], 'tokens', 'read'))
Expand All @@ -618,7 +621,7 @@ function getSurveyInfo_json()
{
$surveylink = '<a href=' . Yii::app()->getController()->createUrl("/admin/tokens/sa/browse/surveyid/{$row['survey_id']}") . '>' . $row['survey_id'].'</a>';
}
$aData->rows[$i]['cell'] = array($surveyname[0]['surveyls_title'], $surveylink, $row['token_id'], $row['date_created'], $row['date_invited'], $row['date_completed']);
$aData->rows[$i]['cell'] = array($surveyname, $surveylink, $row['token_id'], $row['date_created'], $row['date_invited'], $row['date_completed']);
$i++;
}

Expand Down
1 change: 0 additions & 1 deletion application/models/Participants.php
Expand Up @@ -888,7 +888,6 @@ function getParticipantSharedAll()
* */
function copytosurveyatt($surveyid, $mapped, $newcreate, $participantid, $overwriteauto=false, $overwriteman=false, $overwritest=false, $createautomap=true)
{
debugbreak();
Yii::app()->loadHelper('common');
$duplicate = 0;
$sucessfull = 0;
Expand Down
7 changes: 0 additions & 7 deletions application/models/Surveys_languagesettings.php
Expand Up @@ -202,13 +202,6 @@ function insertNewSurvey($data)
return $this->insertSomeRecords($data);
}


function getSurveyNames($surveyid)
{
$lang = Yii::app()->session['adminlang'];
return Yii::app()->db->createCommand()->select('surveyls_title')->from('{{surveys_languagesettings}}')->where('surveyls_language = :adminlang AND surveyls_survey_id = :surveyid')->bindParam(":adminlang", $lang, PDO::PARAM_STR)->bindParam(":surveyid", $surveyid, PDO::PARAM_INT)->queryAll();
}

/**
* Updates a single record identified by $condition with the
* key/value pairs in the $data array.
Expand Down
32 changes: 15 additions & 17 deletions application/views/admin/participants/displayParticipants_view.php
Expand Up @@ -287,16 +287,16 @@
<?php echo CHtml::form(array("admin/participants/sa/attributeMap"), 'post', array('id'=>'addsurvey','name'=>'addsurvey')); ?>
<input type="hidden" name="participant_id" id="participant_id" value=""></input>
<input type="hidden" name="count" id="count" value=""></input>
<div class='popupgroup'>
<h4><?php $clang->eT("Participants") ?></h4>
<fieldset class='popupgroup'>
<legend><?php $clang->eT("Participants") ?></legend>
<div id='allinview' style='display: none'><?php $clang->eT("Add all participants in your current list to a survey.") ?></div>
<div id='selecteditems' style='display: none'><?php $clang->eT("Add the selected participants to a survey.") ?></div>
<br />
</div>
<div class='popupgroup'>
<h4>
</fieldset>
<fieldset class='popupgroup'>
<legend>
<?php $clang->eT("Survey"); ?>
</h4>
</legend>
<p>
<?php
if (!empty($tokensurveynames))
Expand All @@ -306,16 +306,15 @@
{
$option[$row['surveyls_survey_id']] = $row['surveyls_title'];
}
echo CHtml::listBox('survey_id', 'id="survey_id"', $option, array('style'=>'width: 350px; border: 0px; font-size: 1.2em; cursor: pointer', 'size'=>7));
echo CHtml::listBox('survey_id', 'id="survey_id"', $option, array('style'=>'width: 400px; border: 0px; cursor: pointer', 'size'=>10));
}
?>
</p><br />
</div>
<div class='popupgroup'>
<h4>
</fieldset>
<fieldset class='popupgroup'>
<legend>
<?php $clang->eT("Options") ?>
</h4>
<p>
</legend>
<?php
$data = array(
'id' => 'redirect',
Expand All @@ -326,17 +325,16 @@
echo CHtml::checkBox('redirect', TRUE, $data);
?>
<label for='redirect'><?php $clang->eT("Display survey tokens after adding?"); ?></label>
</p>
</div>
</fieldset>
</form>
</div>
<div id="notauthorised" title="notauthorised" style="display:none">
<p>
<?php $clang->eT("This is a shared participant and you are not authorised to edit it"); ?></p>

</div>
<div id="exportcsv" title="exportcsv" style="display:none">
<h4><?php $clang->eT("Attributes to export:"); ?></h4>
<fieldset id="exportcsv" title="exportcsv" style="display:none">
<legend><?php $clang->eT("Attributes to export:"); ?></legend>
<p>
<select id="attributes" name="attributes" multiple="multiple" style='width: 350px' size=7>
<?php
Expand All @@ -347,6 +345,6 @@
?>
</select>
</p>
</div>
</fieldset>


0 comments on commit 074f8c7

Please sign in to comment.