Skip to content

Commit

Permalink
Dev: some smaller issues while testing ipanonymization
Browse files Browse the repository at this point in the history
  • Loading branch information
Trischi80 committed Mar 25, 2020
1 parent 2682e1a commit 6b71d70
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
9 changes: 9 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -5588,6 +5588,15 @@ private function _UpdateValuesInDatabase($finished=false)
}
if ($this->surveyOptions['ipaddr']) {
$aResponseAttributes['ipaddr'] = getIPAddress();

//anonymize ip adress
if($this->surveyOptions['ipAnonymize']){
$ipAddressAnonymizer = new LimeSurvey\Models\Services\IpAddressAnonymizer($aResponseAttributes['ipaddr']);
$result = $ipAddressAnonymizer->anonymizeIpAddress();
if($result){
$aResponseAttributes['ipaddr'] = $result;
}
}
}

foreach ($updatedValues as $key=>$value)
Expand Down
32 changes: 16 additions & 16 deletions application/views/admin/survey/activateSurvey_view.php
Expand Up @@ -203,22 +203,6 @@ function alertPrivacy()
</div>
</div>
</div>

<div class="col-sm-4">
<div class='form-group'>
<label class='control-label col-sm-7' for='refurl'><?php eT("Save referrer URL?"); ?></label>
<div class='col-sm-5'>
<select class='form-control' name='refurl' id='refurl'>
<option value='Y' <?php if ($aSurveysettings['refurl'] == "Y"){echo "selected='selected'";} ?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if ($aSurveysettings['refurl'] != "Y") {echo "selected='selected'";} ?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>
</div>

<div class="col-sm-4 col-sm-offset-2">
Expand All @@ -238,6 +222,22 @@ function alertPrivacy()
</div>
</div>

<div class="col-sm-4">
<div class='form-group'>
<label class='control-label col-sm-7' for='refurl'><?php eT("Save referrer URL?"); ?></label>
<div class='col-sm-5'>
<select class='form-control' name='refurl' id='refurl'>
<option value='Y' <?php if ($aSurveysettings['refurl'] == "Y"){echo "selected='selected'";} ?>>
<?php eT("Yes"); ?>
</option>
<option value='N' <?php if ($aSurveysettings['refurl'] != "Y") {echo "selected='selected'";} ?>>
<?php eT("No"); ?>
</option>
</select>
</div>
</div>
</div>

<p class='col-sm-7 col-sm-offset-2'>
<?php eT("Please note that once responses have collected with this survey and you want to add or remove groups/questions or change one of the settings above, you will need to deactivate this survey, which will move all data that has already been entered into a separate archived table."); ?><br /><br />
</p>
Expand Down
Expand Up @@ -104,7 +104,7 @@
</div>
</div>
<div class="form-group">
<label class=" control-label" for='ipaddr'><?php eT("Anonymize IP address:"); ?></label>
<label class=" control-label" for='ipanonymize'><?php eT("Anonymize IP address:"); ?></label>
<div class="">
<?php
if ($oSurvey->isActive) {
Expand All @@ -114,20 +114,15 @@
eT("Responses will have the IP address anonymized");
} ?>
<span class='annotation'> <?php eT("Cannot be changed"); ?></span>
<?php echo CHtml::hiddenField('ipaddr',$oSurvey->ipanonymize);
<?php echo CHtml::hiddenField('ipanonymize',$oSurvey->ipanonymize);
}else {
// <!-- only visible if ipaddr is set to yes in db or switch to yes -->
$this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'ipanonymize',
'value' => $oSurvey->ipanonymize,
'selectOptions' => ($bShowInherited) ? array_merge($optionsOnOff, array(
'I' => gT('Inherit', 'unescaped') . ' [' . $oSurveyOptions->ipaddr . ']'
'I' => gT('Inherit', 'unescaped') . ' [' . $oSurveyOptions->ipanonymize . ']'
)) : $optionsOnOff,
/*'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){
if ($('#anonymized').is(':checked') == true) {
$('#datestampModal_2').modal();
}
}")*/
));
}
?>
Expand Down

0 comments on commit 6b71d70

Please sign in to comment.