MDL-27550 workshop: rendering links to the submission and the assessment page
authorDavid Mudrak <david@moodle.com>
Thu, 28 Jul 2011 22:05:26 +0000 (00:05 +0200)
committerDavid Mudrak <david@moodle.com>
Tue, 2 Aug 2011 21:33:33 +0000 (23:33 +0200)
This usability improvement helps to provide feedback quickly during the
grading evaluation phase.

mod/workshop/renderer.php
mod/workshop/submission.php

index 2dd91bc..d0053bb 100644 (file)
@@ -91,7 +91,14 @@ class mod_workshop_renderer extends plugin_renderer_base {
         }
         $o .= $this->output->container_start($classes);
         $o .= $this->output->container_start('header');
         }
         $o .= $this->output->container_start($classes);
         $o .= $this->output->container_start('header');
-        $o .= $this->output->heading(format_string($submission->title), 3, 'title');
+
+        $title = $this->output->heading(format_string($submission->title), 3, 'title');
+
+        if ($this->page->url != $submission->url) {
+            $o .= html_writer::link($submission->url, $title);
+        } else {
+            $o .= $title;
+        }
 
         if (!$anonymous) {
             $author             = new stdclass();
 
         if (!$anonymous) {
             $author             = new stdclass();
@@ -554,9 +561,14 @@ class mod_workshop_renderer extends plugin_renderer_base {
         $o .= $this->output->container_start('header');
 
         if (!empty($assessment->title)) {
         $o .= $this->output->container_start('header');
 
         if (!empty($assessment->title)) {
-            $o .= $this->output->container(s($assessment->title), 'title');
+            $title = s($assessment->title);
+        } else {
+            $title = get_string('assessment', 'workshop');
+        }
+        if ($this->page->url != $assessment->url) {
+            $o .= $this->output->container(html_writer::link($assessment->url, $title), 'title');
         } else {
         } else {
-            $o .= $this->output->container(get_string('assessment', 'workshop'), 'title');
+            $o .= $this->output->container($title, 'title');
         }
 
         if (!$anonymous) {
         }
 
         if (!$anonymous) {
index 080cbf6..daf76d1 100644 (file)
@@ -43,7 +43,11 @@ if (isguestuser()) {
 $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
 $workshop = new workshop($workshop, $cm, $course);
 
 $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
 $workshop = new workshop($workshop, $cm, $course);
 
-$PAGE->set_url($workshop->submission_url(), array('cmid' => $cmid, 'id' => $id, 'edit' => $edit));
+$PAGE->set_url($workshop->submission_url(), array('cmid' => $cmid, 'id' => $id));
+
+if ($edit) {
+    $PAGE->url->param('edit', $edit);
+}
 
 if ($id) { // submission is specified
     $submission = $workshop->get_submission_by_id($id);
 
 if ($id) { // submission is specified
     $submission = $workshop->get_submission_by_id($id);