]> git.mjollnir.org Git - moodle.git/commitdiff
some clean ups for gradebook import/export
authortoyomoyo <toyomoyo>
Tue, 22 May 2007 02:05:00 +0000 (02:05 +0000)
committertoyomoyo <toyomoyo>
Tue, 22 May 2007 02:05:00 +0000 (02:05 +0000)
grade/export/lib.php
grade/export/ods/index.php
grade/export/txt/index.php
grade/export/xls/index.php
grade/export/xml/index.php
grade/import/csv/index.php
grade/lib.php

index bf7b2f66b7dde73daa1ba704e1b6facaa65345f4..bdf916d82609fd28e92d3829b2e936a885a64312 100755 (executable)
@@ -201,41 +201,50 @@ class grade_export {
      * Displays all the grades on screen as a feedback mechanism
      */
     function display_grades($feedback=false) {
-        echo get_string("firstname").",".
-             get_string("lastname").",".
-             get_string("idnumber").",".
-             get_string("institution").",".
-             get_string("department").",".
-             get_string("email");
+        echo '<table>';
+        echo '<tr>';
+        echo '<th>'.get_string("firstname")."</th>".
+             '<th>'.get_string("lastname")."</th>".
+             '<th>'.get_string("idnumber")."</th>".
+             '<th>'.get_string("institution")."</th>".
+             '<th>'.get_string("department")."</th>".
+             '<th>'.get_string("email")."</th>";
         foreach ($this->columns as $column) {
             $column = strip_tags($column);
-            echo ",$column";
+            echo "<th>$column</th>";
         
             /// add a column_feedback column            
             if ($feedback) {
-                echo ",{$column}_feedback";
+                echo "<th>{$column}_feedback</th>";
             }        
         }
-        echo ",".get_string("total")."<br/>";
-    
+        echo '<th>'.get_string("total")."</th>";
+        echo '</tr>';
         /// Print all the lines of data.
-        foreach ($this->grades as $studentid => $studentgrades) {
+        
+        
+        foreach ($this->grades as $studentid => $studentgrades) {        
+        
+            echo '<tr>';
             $student = $this->students[$studentid];
             if (empty($this->totals[$student->id])) {
                 $this->totals[$student->id] = '';
             }
-            echo "$student->firstname,$student->lastname,$student->idnumber,$student->institution,$student->department,$student->email";
+            
+            
+            echo "<td>$student->firstname</td><td>$student->lastname</td><td>$student->idnumber</td><td>$student->institution</td><td>$student->department</td><td>$student->email</td>";
             foreach ($studentgrades as $grade) {
                 $grade = strip_tags($grade);
-                echo ",$grade";            
+                echo "<td>$grade</td>";            
                 
                 if ($feedback) {
-                    echo ",".array_shift($this->comments[$student->id]);
+                    echo '<td>'.array_shift($this->comments[$student->id]).'</td>';
                 }       
             }
-            echo ",".$this->totals[$student->id];
-            echo "<br/>";
-        }  
+            echo '<td>'.$this->totals[$student->id].'</td>';
+            echo "</tr>";
+        }
+        echo '</table>';
     }
 }
 
index 7cf75796116397f7f413f1d4b0aa57eb86fa30f8..706dd007252bead36b7efe0ba4e4b40b72c8150a 100755 (executable)
@@ -38,7 +38,10 @@ if (($data = data_submitted()) && confirm_sesskey()) {
     }
         
     // print the grades on screen for feedbacks
-    print_header(get_string('grade'),get_string('grade'),get_string('grade'));
+    $course = get_record('course', 'id', $id);
+    $action = 'exporttxt';
+    print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+    
     $export = new grade_export($id, $data->itemids);
     $export->display_grades($feedback);
 
@@ -46,6 +49,9 @@ if (($data = data_submitted()) && confirm_sesskey()) {
     redirect('export.php?id='.$id.'&amp;itemids='.$itemidsurl);
     exit; 
 }
-
+$course = get_record('course', 'id', $id);
+$action = 'exportods';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
 print_gradeitem_selections($id);
+print_footer();
 ?>
\ No newline at end of file
index 01bfd338d4ead75b16ba474b37a4b66e85e830b3..78be9663e39c05d414e3c260846aa7678aaf8ee8 100755 (executable)
@@ -37,8 +37,10 @@ if (($data = data_submitted()) && confirm_sesskey()) {
         $itemidsurl = implode(",",$data->itemids);
     }
         
-    // print the grades on screen for feedbacks
-    print_header(get_string('grade'),get_string('grade'),get_string('grade'));
+    $course = get_record('course', 'id', $id);
+    $action = 'exporttxt';
+    print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+    
     $export = new grade_export($id, $data->itemids);
     $export->display_grades($feedback);
     
@@ -71,7 +73,7 @@ if ($grade_items = grade_get_items($id)) {
     }
     echo '<br/>';
     echo 'tab<input type="radio" name="separator" value="tab"/>';
-    echo 'comma<input type="radio" name="separator" value="comma"/>';
+    echo 'comma<input type="radio" name="separator" value="comma" checked="checked"/>';
     echo '<input type="hidden" name="id" value="'.$id.'"/>';
     echo '<input type="hidden" name="sesskey" value="'.sesskey().'"/>';
     echo '<br/>';
index 0d57faae10dfc601cc88cbf872e7d3914cb23b41..30552c6c4d129ab7782978dd8aa3934b1ef3aa89 100755 (executable)
@@ -38,7 +38,10 @@ if (($data = data_submitted()) && confirm_sesskey()) {
     }
         
     // print the grades on screen for feedbacks
-    print_header(get_string('grade'),get_string('grade'),get_string('grade'));
+    $course = get_record('course', 'id', $id);
+    $action = 'exporttxt';
+    print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+    
     $export = new grade_export($id, $data->itemids);
     $export->display_grades($feedback);
     
@@ -46,6 +49,9 @@ if (($data = data_submitted()) && confirm_sesskey()) {
     redirect('export.php?id='.$id.'&amp;itemids='.$itemidsurl);
     exit; 
 }
-
+$course = get_record('course', 'id', $id);
+$action = 'exportxls';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
 print_gradeitem_selections($id);
+print_footer();
 ?>
\ No newline at end of file
index 28870ceb958d437edeee614170061e3e25f22fde..6c05ef18411c89a346598643641515fbef1cc098 100755 (executable)
@@ -38,7 +38,10 @@ if (($data = data_submitted()) && confirm_sesskey()) {
     }
         
     // print the grades on screen for feedbacks
-    print_header(get_string('grade'),get_string('grade'),get_string('grade'));
+    $course = get_record('course', 'id', $id);
+    $action = 'exporttxt';
+    print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
+    
     $export = new grade_export($id, $data->itemids);
     $export->display_grades($feedback);
     
@@ -46,6 +49,9 @@ if (($data = data_submitted()) && confirm_sesskey()) {
     redirect('export.php?id='.$id.'&amp;itemids='.$itemidsurl);
     exit; 
 }
-
+$course = get_record('course', 'id', $id);
+$action = 'exportxml';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
 print_gradeitem_selections($id);
+print_footer();
 ?>
\ No newline at end of file
index bd2debac043cc024e512040170223187eb6b2ddf..8850a4319449391a1fb6539060d6bf62ded8c59c 100755 (executable)
@@ -29,7 +29,11 @@ if (isset($CFG->CSV_DELIMITER)) {
 
 require_once('../grade_import_form.php');
 
-print_header("test","test","test");
+
+require_once($CFG->dirroot.'/grade/lib.php');
+$course = get_record('course', 'id', $id);
+$action = 'importcsv';
+print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
 
 
 $mform = new grade_import_form();
index be143a8e0e1b1c75bae9bd5599648b55e3763eec..12c184576022fe72728b204bf22b1e87f85ad1a8 100644 (file)
@@ -1157,6 +1157,14 @@ function grade_nav($course, $action='grades') {
             case 'excepts':
                 $strcurpage = get_string('gradeexceptions', 'grades');
                 break;
+            case 'exporttxt':
+            case 'exportxml':
+            case 'exportods':
+            case 'exportxls':
+            case 'importcsv':
+            case 'importxml':
+                $strcurpage = get_string($action);
+                break;
             default:
                 unset($strcurpage);
                 break;