MDL-53638 mod_feedback: analysis page enhancements
authorMarina Glancy <marina@moodle.com>
Sat, 9 Apr 2016 11:22:40 +0000 (19:22 +0800)
committerMarina Glancy <marina@moodle.com>
Wed, 27 Apr 2016 05:28:45 +0000 (13:28 +0800)
mod/feedback/analysis.php
mod/feedback/item/info/lib.php
mod/feedback/item/multichoice/lib.php
mod/feedback/item/multichoicerated/lib.php
mod/feedback/item/numeric/lib.php
mod/feedback/item/textarea/lib.php
mod/feedback/item/textfield/lib.php
mod/feedback/styles.css

index 3cf894f..2b8e76b 100644 (file)
@@ -95,7 +95,7 @@ echo '<div>';
 if ($check_anonymously) {
     // Print the items in an analysed form.
     foreach ($items as $item) {
-        echo '<table class="analysis">';
+        echo "<table class=\"analysis itemtype_{$item->typ}\">";
         $itemobj = feedback_get_item_class($item->typ);
         $printnr = ($feedback->autonumbering && $item->itemnr) ? ($item->itemnr . '.') : '';
         $itemobj->print_analysed($item, $printnr, $mygroupid);
index dda6a2f..10824f2 100644 (file)
@@ -150,7 +150,7 @@ class feedback_item_info extends feedback_item_base {
             echo '</th></tr>';
             $sizeofdata = count($data);
             for ($i = 0; $i < $sizeofdata; $i++) {
-                echo '<tr><td colspan="2" valign="top" align="left">-&nbsp;&nbsp;';
+                echo '<tr><td colspan="2" class="singlevalue">';
                 echo str_replace("\n", '<br />', $data[$i]->show);
                 echo '</td></tr>';
             }
index 3436db8..b58b30a 100644 (file)
@@ -230,10 +230,10 @@ class feedback_item_multichoice extends feedback_item_base {
                     $str_quotient = ' ('. $quotient . ' %)';
                 }
                 echo '<tr>';
-                echo '<td align="left" valign="top">
-                            - '.format_text(trim($val->answertext), FORMAT_HTML, array('noclean' => true, 'para' => false)).':
+                echo '<td class="optionname">' .
+                            format_text(trim($val->answertext), FORMAT_HTML, array('noclean' => true, 'para' => false)).':
                       </td>
-                      <td align="left" style="width:'.FEEDBACK_MAX_PIX_LENGTH.';">
+                      <td class="optioncount" style="width:'.FEEDBACK_MAX_PIX_LENGTH.';">
                         <img class="feedback_bar_image" alt="'.$intvalue.'" src="'.$pix.'" width="'.$pixwidth.'" />'.
                         '<img class="feedback_bar_image" alt="" src="'.$pixspacer.'" width="'.$pixwidthspacer.'" />
                         '.$val->answercount.$str_quotient.'
index f728fdf..6e59f1e 100644 (file)
@@ -199,10 +199,10 @@ class feedback_item_multichoicerated extends feedback_item_base {
                 $avg += $val->avg;
                 $quotient = format_float($val->quotient * 100, 2);
                 echo '<tr>';
-                echo '<td align="left" valign="top">';
-                echo '- ('.$val->value.') '.
+                echo '<td class="optionname">';
+                echo '<span class="weight">('.$val->value.') </span>'.
                         format_text(trim($val->answertext), FORMAT_HTML, array('noclean' => true, 'para' => false)).':</td>';
-                echo '<td align="left" style="width: '.FEEDBACK_MAX_PIX_LENGTH.'">';
+                echo '<td class="optionvalue" style="width: '.FEEDBACK_MAX_PIX_LENGTH.'">';
                 echo '<img class="feedback_bar_image" alt="'.$intvalue.'" src="'.$pix.'" width="'.$pixwidth.'" />';
                 echo '<img class="feedback_bar_image" alt="" src="'.$pixspacer.'" width="'.$pixwidthspacer.'" /> ';
                 echo $val->answercount;
index 04968ec..fb5f6fc 100644 (file)
@@ -151,8 +151,8 @@ class feedback_item_numeric extends feedback_item_base {
             echo '</th></tr>';
 
             foreach ($values->data as $value) {
-                echo '<tr><td colspan="2" valign="top" align="left">';
-                echo '-&nbsp;&nbsp;'.$this->format_float($value);
+                echo '<tr><td colspan="2" class="singlevalue">';
+                echo $this->format_float($value);
                 echo '</td></tr>';
             }
 
@@ -161,7 +161,7 @@ class feedback_item_numeric extends feedback_item_base {
             } else {
                 $avg = '-';
             }
-            echo '<tr><td align="left" colspan="2"><b>';
+            echo '<tr><td colspan="2"><b>';
             echo get_string('average', 'feedback').': '.$avg;
             echo '</b></td></tr>';
         }
index 8d4fe9e..c9198b1 100644 (file)
@@ -141,9 +141,9 @@ class feedback_item_textarea extends feedback_item_base {
             echo format_text($item->name, FORMAT_HTML, array('noclean' => true, 'para' => false));
             echo '</th></tr>';
             foreach ($values as $value) {
-                echo '<tr>';
-                echo '<td colspan="2" valign="top" align="left">';
-                echo '-&nbsp;&nbsp;';
+                $class = strlen(trim($value->value)) ? '' : ' class="isempty"';
+                echo '<tr'.$class.'>';
+                echo '<td colspan="2" class="singlevalue">';
                 echo str_replace("\n", '<br />', $value->value);
                 echo '</td>';
                 echo '</tr>';
index befd5ff..dbff6a6 100644 (file)
@@ -137,8 +137,9 @@ class feedback_item_textfield extends feedback_item_base {
             echo $this->get_display_name($item);
             echo '</th></tr>';
             foreach ($values as $value) {
-                echo '<tr><td colspan="2" valign="top" align="left">';
-                echo '-&nbsp;&nbsp;'.str_replace("\n", '<br />', $value->value);
+                $class = strlen(trim($value->value)) ? '' : ' class="isempty"';
+                echo '<tr'.$class.'><td colspan="2" class="singlevalue">';
+                echo str_replace("\n", '<br />', $value->value);
                 echo '</td></tr>';
             }
         }
index a13708f..741b327 100644 (file)
@@ -140,15 +140,40 @@ body.dir-rtl.path-mod-feedback #region-main .mform.feedback_form .femptylabel .f
     float: right;
 }
 
+.path-mod-feedback .templateslist td.cell.action,
+.path-mod-feedback .templateslist th.header.action {
+    width: 10%;
+}
+
+/* Analysis page */
 .path-mod-feedback table.analysis {
     width: 100%;
+    border-top: 1px solid #aaaaaa;
+    margin-top: 10px;
 }
 
-.path-mod-feedback .templateslist td.cell.action,
-.path-mod-feedback .templateslist th.header.action {
-    width: 10%;
+.path-mod-feedback table.analysis tr:first-child th {
+    padding-top:10px;
+}
+
+.path-mod-feedback table.analysis tr:hover {
+    background: #f5f5f5;
+}
+
+.path-mod-feedback table.analysis td.singlevalue:before,
+.path-mod-feedback table.analysis td.optionname:before {
+    content:'- ';
+}
+
+.path-mod-feedback table.analysis.itemtype_textarea td {
+    padding: 4px 0;
+}
+
+.path-mod-feedback table.analysis tr.isempty {
+    display:none;
 }
 
+/* Responses list */
 .path-mod-feedback #showentrytable td.cell.completed_timemodified,
 .path-mod-feedback #showentryanontable td.cell.random_response {
     font-weight: bold;