diff options
| -rw-r--r-- | app/views/course/evaluation/index.php | 17 | ||||
| -rw-r--r-- | lib/models/Questionnaire.php | 11 |
2 files changed, 14 insertions, 14 deletions
diff --git a/app/views/course/evaluation/index.php b/app/views/course/evaluation/index.php index ddbbb3a..3adbb94 100644 --- a/app/views/course/evaluation/index.php +++ b/app/views/course/evaluation/index.php @@ -4,7 +4,6 @@ */ ?> -<!-- TODO min responses --> <?php foreach ($controller->evaluations as $key => $evaluation) : ?> <article class="studip toggle <?= $key == 0 ? 'open' : '' ?>"> <header> @@ -15,11 +14,13 @@ </h1> </header> - <?php if (EvaluationHelper::isPermittedEvaluationAccess()) : ?> + <?php if ($evaluation->resultsVisible()) : ?> <?= $this->render_partial('questionnaire/evaluate.php', ['questionnaire' => $evaluation, 'range_type' => 'course', 'range_id' => Context::getId()]) ?> - <?php elseif (User::findCurrent()->hasPermissionLevel('tutor', Context::get())) : ?> - <!-- TODO other views --> + <?php elseif ($evaluation->isAnswerable()) : ?> + <?= $this->render_partial('questionnaire/answer.php', + ['questionnaire' => $evaluation, 'range_type' => 'course', 'range_id' => Context::getId()]) ?> + <?php else : ?> <table class="row-headers"> <tbody> <tr> @@ -58,14 +59,6 @@ </tr> </tbody> </table> - <?php else : ?> - <?php if ($evaluation->isStopped()) : ?> - <?= $this->render_partial('questionnaire/evaluate.php', ['questionnaire' => $evaluation, 'range_type' => 'course', 'range_id' => Context::getId()]) ?> - <?php elseif ($evaluation->isAnswerable()) : ?> - <?= $this->render_partial('questionnaire/answer.php', ['questionnaire' => $evaluation, 'range_type' => 'course', 'range_id' => Context::getId()]) ?> - <?php else : ?> - <p><?= _('Die Evaluation ist noch nicht abgeschlossen.') ?></p> - <?php endif ?> <?php endif ?> </article> <?php endforeach ?> diff --git a/lib/models/Questionnaire.php b/lib/models/Questionnaire.php index 52fc7f2..17a399e 100644 --- a/lib/models/Questionnaire.php +++ b/lib/models/Questionnaire.php @@ -155,6 +155,11 @@ class Questionnaire extends SimpleORMap implements PrivacyObject public function isAnswerable() { + if ($this->template_id && Context::isCourse() + && User::findCurrent()->hasPermissionLevel('tutor', Context::get())) { + return false; + } + if (!$this->isViewable() || !$this->isRunning()) { return false; } @@ -273,8 +278,10 @@ class Questionnaire extends SimpleORMap implements PrivacyObject && $this->countAnswers() >= $this->minimum_responses; return $eval_visible - && ($this->resultvisibility === 'afterending' && $this->isStopped() - || $this->resultvisibility === 'afterparticipation' && $this->isAnswered()); + && (($this->resultvisibility === 'afterending' && $this->isStopped()) + || ($this->resultvisibility === 'afterparticipation' && $this->isAnswered()) + || ($this->resultvisibility === 'afterparticipation' + && $user->hasPermissionLevel('tutor', Context::get()))); } return $this['resultvisibility'] === 'always' |
