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

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
...@@ -859,77 +859,74 @@ class Framework { ...@@ -859,77 +859,74 @@ class Framework {
$collection = $view->get('collection'); $collection = $view->get('collection');
$evidence = get_record('framework_evidence', 'annotation', $annotation->get('id')); $evidence = get_record('framework_evidence', 'annotation', $annotation->get('id'));
$defaultval = $evidence->state; $defaultval = $evidence->state;
$selfassess = get_field('framework', 'selfassess', 'id', $evidence->framework);
if (!is_object($collection) || !$collection->get('framework')) { if (!is_object($collection) || !$collection->get('framework')) {
return false; 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); $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 // not allowed to set the assessment so we just show the current state as html
$choices = self::get_evidence_statuses($collection->get('framework')); $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
$assessment = array( $assessment = array(
'type' => 'html', 'type' => 'select',
'title' => get_string('assessment', 'module.framework'), 'title' => get_string('assessment', 'module.framework'),
'value' => $choices[$defaultval], 'options' => $options,
'defaultvalue' => $defaultval,
'width' => '280px',
'class' => 'top-line', 'class' => 'top-line',
); );
}
else { $form = array(
if (!array_key_exists($defaultval, $options)) { 'name' => 'annotationfeedback',
// not allowed to set the assessment to current state so show current state as html 'jsform' => true,
$choices = self::get_evidence_statuses($collection->get('framework')); 'renderer' => 'div',
$assessment = array( 'plugintype' => 'module',
'pluginname' => 'framework',
'jssuccesscallback' => 'updateAnnotation',
'elements' => array(
'annotation' => array(
'type' => 'html',
'value' => $annotationhtml,
),
),
);
if ($options) {
$form['elements']['annotationdiv'] = array(
'type' => 'html', 'type' => 'html',
'title' => get_string('assessment', 'module.framework'), 'value' => $annotationdivhtml,
'value' => $choices[$defaultval],
'class' => 'top-line',
); );
$form['elements']['assessment'] = $assessment;
} }
else { $frameworkurl = $collection->collection_nav_framework_option();
// Show the select box with current state selected if ($options) {
$assessment = array( $form['elements']['submitcancel'] = array(
'type' => 'select', 'type' => 'submitcancel',
'title' => get_string('assessment', 'module.framework'), 'class' => 'btn-secondary',
'options' => $options, 'value' => array(get_string('save'), get_string('cancel')),
'defaultvalue' => $defaultval, 'goto' => $frameworkurl->fullurl,
'width' => '280px',
'class' => 'top-line',
); );
} }
$content = pieform($form);
} }
$form = array(
'name' => 'annotationfeedback',
'jsform' => true,
'renderer' => 'div',
'plugintype' => 'module',
'pluginname' => 'framework',
'jssuccesscallback' => 'updateAnnotation',
'elements' => array(
'annotation' => array(
'type' => 'html',
'value' => clean_html($text),
),
),
);
if ($options || (!$options && $view->get('owner') == $USER->get('id'))) {
$form['elements']['annotationdiv'] = array(
'type' => 'html',
'value' => '<div class="modal-header modal-section">' . get_string("assessment", "module.framework") . '</div>',
);
$form['elements']['assessment'] = $assessment;
}
$frameworkurl = $collection->collection_nav_framework_option();
if ($options) {
$form['elements']['submitcancel'] = array(
'type' => 'submitcancel',
'class' => 'btn-secondary',
'value' => array(get_string('save'), get_string('cancel')),
'goto' => $frameworkurl->fullurl,
);
}
$content = pieform($form);
list($feedbackcount, $annotationfeedback) = ArtefactTypeAnnotationfeedback::get_annotation_feedback_for_matrix($artefact, $view, $annotation->get('id')); list($feedbackcount, $annotationfeedback) = ArtefactTypeAnnotationfeedback::get_annotation_feedback_for_matrix($artefact, $view, $annotation->get('id'));
$content .= $annotationfeedback; $content .= $annotationfeedback;
......
<div>
<div class="html form-group">
<p>{$annotationhtml|safe}</p>
</div>
<div class="html form-group">
{$annotationdivhtml|safe}
</div>
{$assessmenthtml|safe}
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment