Commit 2ae2f0ce authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1825282: Show only html in smartevidence add feedback modal

for the owner of the collection when the framework is not a
self-assess one
and for institution staff when the framework is a self-assess one

behatnotneeded

Change-Id: Iac63c94b7e07a526e2e8790de1d7f4fc7e409160
parent 8af3a599
Loading
Loading
Loading
Loading
+51 −54
Original line number Diff line number Diff line
@@ -859,32 +859,30 @@ class Framework {
        $collection = $view->get('collection');
        $evidence = get_record('framework_evidence', 'annotation', $annotation->get('id'));
        $defaultval = $evidence->state;
        $selfassess = get_field('framework', 'selfassess', 'id', $evidence->framework);

        if (!is_object($collection) || !$collection->get('framework')) {
            return false;
        }

        $annotationhtml = clean_html($text);
        $annotationdivhtml = '<div class="modal-header modal-section">' . get_string("assessment", "module.framework") . '</div>';
        $assessmenthtml = '<div class="top-line select form-group">
                            <span class="pseudolabel">' . get_string("assessment", "module.framework") . '</span>
                            ' . self::get_evidence_statuses($collection->get('framework'))[$defaultval] . '
                          </div>';

        $options = self::get_my_assessment_options_for_user($view, $evidence->framework);
        if (!$options) {
        if (!$options || !array_key_exists($defaultval, $options)
            || ($view->get('owner') == $USER->get('id') && !$selfassess)
            || ($view->get('owner') != $USER->get('id') && $selfassess)
            ) {
            // not allowed to set the assessment so we just show the current state as html
            $choices = self::get_evidence_statuses($collection->get('framework'));
            $assessment = array(
                'type' => 'html',
                'title' => get_string('assessment', 'module.framework'),
                'value' => $choices[$defaultval],
                'class' => 'top-line',
            );
        }
        else {
            if (!array_key_exists($defaultval, $options)) {
                // not allowed to set the assessment to current state so show current state as html
                $choices = self::get_evidence_statuses($collection->get('framework'));
                $assessment = array(
                    'type' => 'html',
                    'title' => get_string('assessment', 'module.framework'),
                    'value' => $choices[$defaultval],
                    'class' => 'top-line',
                );
            $smarty = smarty_core();
            $smarty->assign('annotationhtml', $annotationhtml);
            $smarty->assign('annotationdivhtml', $annotationdivhtml);
            $smarty->assign('assessmenthtml', $assessmenthtml);
            $content = $smarty->fetch('module:framework:evidencestatus.tpl');
        }
        else {
            // Show the select box with current state selected
@@ -896,8 +894,6 @@ class Framework {
                'width' => '280px',
                'class' => 'top-line',
            );
            }
        }

            $form = array(
                'name' => 'annotationfeedback',
@@ -909,14 +905,14 @@ class Framework {
                'elements'   => array(
                    'annotation' => array(
                        'type' => 'html',
                    'value' => clean_html($text),
                        'value' => $annotationhtml,
                    ),
                ),
            );
        if ($options || (!$options && $view->get('owner') == $USER->get('id'))) {
            if ($options) {
                $form['elements']['annotationdiv'] = array(
                    'type' => 'html',
                'value' => '<div class="modal-header modal-section">' . get_string("assessment", "module.framework") . '</div>',
                    'value' => $annotationdivhtml,
                );
                $form['elements']['assessment'] = $assessment;
            }
@@ -930,6 +926,7 @@ class Framework {
                );
            }
            $content = pieform($form);
        }
        list($feedbackcount, $annotationfeedback) = ArtefactTypeAnnotationfeedback::get_annotation_feedback_for_matrix($artefact, $view, $annotation->get('id'));
        $content .= $annotationfeedback;

+11 −0
Original line number Diff line number Diff line
<div>
    <div class="html form-group">
        <p>{$annotationhtml|safe}</p>
    </div>

    <div class="html form-group">
        {$annotationdivhtml|safe}
    </div>

    {$assessmenthtml|safe}
</div>