Skip to content

Commit

Permalink
Revert "Fixed issue: settings for questions that should not be possib…
Browse files Browse the repository at this point in the history
…le to manipulate during survey runtime are changeable"

This reverts commit cd0340b.
  • Loading branch information
olleharstedt committed May 10, 2021
1 parent 5de2e6b commit 8a25683
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
9 changes: 0 additions & 9 deletions application/controllers/QuestionAdministrationController.php
Expand Up @@ -392,15 +392,6 @@ public function actionSaveQuestionData()
// Rollback at failure.
$transaction = Yii::app()->db->beginTransaction();
try {
$survey = Survey::model()->findByPk($iSurveyId);
$isSurveyActive = $survey->getIsActive();
// settings that should not be changed during a running survey
if ($isSurveyActive) {
unset($questionData['question']['encrypted']);
unset($questionData['question']['gid']);
unset($questionData['question']['other']);
unset($questionData['question']['save_as_default']);
}
if ($questionData['question']['qid'] == 0) {
$questionData['question']['qid'] = null;
$question = $this->storeNewQuestionData($questionData['question']);
Expand Down
@@ -1,15 +1,14 @@
<select
<select
class="form-control"
name="question[<?= $this->generalOption->name ?>]"
id="<?= $this->generalOption->name ?>"
<?= $this->generalOption->disableInActive ? 'disabled' : '' ?>
name="question[<?= $this->generalOption->name; ?>]"
id="<?= $this->generalOption->name; ?>"
>
<!-- TODO: Fix weird object reference. -->
<?php foreach ($this->generalOption->formElement->options['options'] as $option) : ?>
<?php if ($this->generalOption->formElement->value == $option->value) : ?>
<option value="<?= $option->value ?>" selected="selected"><?= $option->text ?></option>
<option value="<?= $option->value; ?>" selected="selected"><?= $option->text; ?></option>
<?php else : ?>
<option value="<?= $option->value ?>"><?= $option->text ?></option>
<option value="<?= $option->value; ?>"><?= $option->text; ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
30 changes: 13 additions & 17 deletions application/extensions/GeneralOptionWidget/views/switch.php
@@ -1,43 +1,39 @@
<div class="btn-group col-12" role="group" data-toggle="buttons">
<?php if ($this->generalOption->formElement->value === 'Y') : ?>
<label class="btn btn-default active <?= $this->generalOption->disableInActive ? 'disabled' : '' ?>">
<?php if ($this->generalOption->formElement->value == 'Y') : ?>
<label class="btn btn-default active">
<input
type="radio"
name="question[<?= $this->generalOption->name ?>]"
name="question[<?= $this->generalOption->name; ?>]"
value="Y"
<?= $this->generalOption->disableInActive ? 'disabled' : '' ?>
checked
/>
<?= gT('On') ?>
<?= gT('On'); ?>
</label>
<label class="btn btn-default <?= $this->generalOption->disableInActive ? 'disabled' : '' ?>">
<label class="btn btn-default">
<input
type="radio"
name="question[<?= $this->generalOption->name ?>]"
name="question[<?= $this->generalOption->name; ?>]"
value="N"
<?= $this->generalOption->disableInActive ? 'disabled' : '' ?>
/>
<?= gT('Off') ?>
<?= gT('Off'); ?>
</label>
<?php else : ?>
<label class="btn btn-default <?= $this->generalOption->disableInActive ? 'disabled' : '' ?>">
<label class="btn btn-default">
<input
type="radio"
name="question[<?= $this->generalOption->name ?>]"
name="question[<?= $this->generalOption->name; ?>]"
value="Y"
<?= $this->generalOption->disableInActive ? 'disabled' : '' ?>
/>
<?= gT('On') ?>
<?= gT('On'); ?>
</label>
<label class="btn btn-default active <?= $this->generalOption->disableInActive ? 'disabled' : '' ?>">
<label class="btn btn-default active">
<input
type="radio"
name="question[<?= $this->generalOption->name ?>]"
name="question[<?= $this->generalOption->name; ?>]"
value="N"
<?= $this->generalOption->disableInActive ? 'disabled' : '' ?>
checked
/>
<?= gT('Off') ?>
<?= gT('Off'); ?>
</label>
<?php endif; ?>
</div>

0 comments on commit 8a25683

Please sign in to comment.