diff --git a/htdocs/module/framework/lib.php b/htdocs/module/framework/lib.php
index 4c49b7b20f4d20226e25291bf1ae058d21ee42be..720ee09c4a8d8cbee72578079a0f2531b2686e6c 100644
--- a/htdocs/module/framework/lib.php
+++ b/htdocs/module/framework/lib.php
@@ -823,77 +823,74 @@ 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 = '
';
+ $assessmenthtml = '
+ ' . get_string("assessment", "module.framework") . '
+ ' . self::get_evidence_statuses($collection->get('framework'))[$defaultval] . '
+
';
+
$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'));
+ $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(
- 'type' => 'html',
+ 'type' => 'select',
'title' => get_string('assessment', 'module.framework'),
- 'value' => $choices[$defaultval],
+ 'options' => $options,
+ 'defaultvalue' => $defaultval,
+ 'width' => '280px',
'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(
+
+ $form = array(
+ 'name' => 'annotationfeedback',
+ 'jsform' => true,
+ 'renderer' => 'div',
+ 'plugintype' => 'module',
+ 'pluginname' => 'framework',
+ 'jssuccesscallback' => 'updateAnnotation',
+ 'elements' => array(
+ 'annotation' => array(
+ 'type' => 'html',
+ 'value' => $annotationhtml,
+ ),
+ ),
+ );
+ if ($options) {
+ $form['elements']['annotationdiv'] = array(
'type' => 'html',
- 'title' => get_string('assessment', 'module.framework'),
- 'value' => $choices[$defaultval],
- 'class' => 'top-line',
+ 'value' => $annotationdivhtml,
);
+ $form['elements']['assessment'] = $assessment;
}
- else {
- // Show the select box with current state selected
- $assessment = array(
- 'type' => 'select',
- 'title' => get_string('assessment', 'module.framework'),
- 'options' => $options,
- 'defaultvalue' => $defaultval,
- 'width' => '280px',
- 'class' => 'top-line',
+ $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);
}
-
- $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' => '',
- );
- $form['elements']['assessment'] = $assessment;
- }
- $frameworkurl = $collection->collection_nav_framework_option();
- if ($options) {
- $form['elements']['submitcancel'] = array(
- 'type' => 'submitcancel',
- 'class' => 'btn-default',
- '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'));
$content .= $annotationfeedback;
diff --git a/htdocs/theme/raw/plugintype/module/framework/templates/evidencestatus.tpl b/htdocs/theme/raw/plugintype/module/framework/templates/evidencestatus.tpl
new file mode 100644
index 0000000000000000000000000000000000000000..44f6f357bb3e0832cd91332953666091727bf61d
--- /dev/null
+++ b/htdocs/theme/raw/plugintype/module/framework/templates/evidencestatus.tpl
@@ -0,0 +1,11 @@
+
+
+
+
+ {$annotationdivhtml|safe}
+
+
+ {$assessmenthtml|safe}
+