Skip to content

Commit

Permalink
Fixed issue #6381 - Central participant database, admin language shou…
Browse files Browse the repository at this point in the history
…ld not determine the list of available surveys
  • Loading branch information
jcleeland committed Jul 25, 2012
1 parent 618c326 commit 99ef7a1
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions application/controllers/admin/participantsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,26 @@ function displayParticipants()
$urlSearch=Yii::app()->request->getQuery('searchurl');
$urlSearch=!empty($urlSearch) ? "getParticipantsResults_json/search/$urlSearch" : "getParticipants_json";

if (Yii::app()->session['USER_RIGHT_SUPERADMIN'])
{
$aSurveyNames = Surveys_languagesettings::model()->with('survey', 'owner')->findAll('surveyls_language=:lang', array(':lang'=>$lang));
}
// otherwise owned by him
else
{
$aSurveyNames = Surveys_languagesettings::model()->with('survey', 'owner')->findAll('survey.owner_id=:uid AND surveyls_language=:lang',array('survey.uid'=>Yii::app()->session['loginID'], ':lang'=>$lang));
}
//Get list of surveys.
//Should be all surveys owned by user (or all surveys for super admin)
$surveys = Survey::model();
//!!! Is this even possible to execute?
if (empty(Yii::app()->session['USER_RIGHT_SUPERADMIN']))
$surveys->permission(Yii::app()->user->getId());

$aSurveyNames = $surveys->model()->with(array('languagesettings'=>array('condition'=>'surveyls_language=language'), 'owner'))->findAll();

/* Build a list of surveys that have tokens tables */
$tSurveyNames=array();
foreach($aSurveyNames as $row)
{
$bTokenExists = tableExists('{{tokens_' . $row['surveyls_survey_id'] . '}}');
$row = array_merge($row->attributes, $row->languagesettings[0]->attributes);
$bTokenExists = tableExists('{{tokens_' . $row['sid'] . '}}');
if ($bTokenExists) //If tokens table exists
{
$tSurveyNames[]=$row;
}
}

// data to be passed to view
$aData = array(
'names' => User::model()->findAll(),
Expand Down

0 comments on commit 99ef7a1

Please sign in to comment.