Skip to content

Commit

Permalink
Dev: Fix undefined variable svexist
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jan 20, 2017
1 parent 459821d commit ed3c5d5
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions application/helpers/common_helper.php
Expand Up @@ -5861,7 +5861,7 @@ function doesImportArraySupportLanguage($csvarray,$idkeysarray,$langfieldnum,$l
*
* @param boolean $bIncludeOwner If the survey owner should be included
* @param boolean $bIncludeSuperAdmins If Super admins should be included
* @param int surveyid
* @param int $surveyid
* @return string
*/
function getSurveyUserList($bIncludeOwner=true, $bIncludeSuperAdmins=true,$surveyid)
Expand All @@ -5885,25 +5885,37 @@ function getSurveyUserList($bIncludeOwner=true, $bIncludeSuperAdmins=true,$surve

if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == true)
{

$authorizedUsersList = getUserList('onlyuidarray');
}

foreach($aSurveyIDResult as $sv)
{
if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == false ||
$svexist = false;
foreach($aSurveyIDResult as $sv)
{
if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == false ||
in_array($sv['uid'],$authorizedUsersList))
{
$surveyselecter .= "<option";
$surveyselecter .=" value='{$sv['uid']}'>{$sv['users_name']} {$sv['full_name']}</option>\n";
}
{
$surveyselecter .= "<option";
$surveyselecter .=" value='{$sv['uid']}'>{$sv['users_name']} {$sv['full_name']}</option>\n";
$svexist = true;
}
if (!isset($svexist)) {$surveyselecter = "<option value='-1' selected='selected'>".gT("Please choose...")."</option>\n".$surveyselecter;}
else {$surveyselecter = "<option value='-1'>".gT("None")."</option>\n".$surveyselecter;}
}

if ($svexist) {
$surveyselecter = "<option value='-1' selected='selected'>".gT("Please choose...")."</option>\n".$surveyselecter;
}
else {
$surveyselecter = "<option value='-1'>".gT("None")."</option>\n".$surveyselecter;
}

return $surveyselecter;
}

/**
* Return HTML <option> list of user groups
* @param string $outputformat
* @param int $surveyid
* @return string
*/
function getSurveyUserGroupList($outputformat='htmloptions',$surveyid)
{

Expand All @@ -5927,6 +5939,7 @@ function getSurveyUserGroupList($outputformat='htmloptions',$surveyid)
$authorizedGroupsList=getUserGroupList(NULL, 'simplegidarray');
}

$svexist = false;
foreach($aResult as $sv)
{
if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == false ||
Expand All @@ -5935,11 +5948,16 @@ function getSurveyUserGroupList($outputformat='htmloptions',$surveyid)
$surveyselecter .= "<option";
$surveyselecter .=" value='{$sv['ugid']}'>{$sv['name']}</option>\n";
$simpleugidarray[] = $sv['ugid'];
$svexist = true;
}
}

if (!isset($svexist)) {$surveyselecter = "<option value='-1' selected='selected'>".gT("Please choose...")."</option>\n".$surveyselecter;}
else {$surveyselecter = "<option value='-1'>".gT("None")."</option>\n".$surveyselecter;}
if ($svexist) {
$surveyselecter = "<option value='-1' selected='selected'>".gT("Please choose...")."</option>\n".$surveyselecter;
}
else {
$surveyselecter = "<option value='-1'>".gT("None")."</option>\n".$surveyselecter;
}

if ($outputformat == 'simpleugidarray')
{
Expand Down

0 comments on commit ed3c5d5

Please sign in to comment.