]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10639 - Removed "Export" column - export all available outcomes (merge from 1.9)
authorscyrma <scyrma>
Tue, 26 Feb 2008 07:30:34 +0000 (07:30 +0000)
committerscyrma <scyrma>
Tue, 26 Feb 2008 07:30:34 +0000 (07:30 +0000)
grade/edit/outcome/export.php
grade/edit/outcome/index.php

index 5c7aff8d674070ce8d6db2cca34b1b8bf5a685b4..c2ebf89e9dcb54d0fee902748f83f621308a9595 100644 (file)
@@ -7,7 +7,6 @@ require_once $CFG->libdir.'/gradelib.php';
 
 $courseid = optional_param('id', 0, PARAM_INT);
 $action   = optional_param('action', '', PARAM_ALPHA);
-$export   = required_param('export', PARAM_INT);
 
 /// Make sure they can even access this course
 if ($courseid) {
@@ -42,9 +41,14 @@ header('Content-Disposition: attachment; filename=outcomes.csv');
 $header = array('outcome_name', 'outcome_shortname', 'outcome_description', 'scale_name', 'scale_items', 'scale_description');
 echo format_csv($header, ';', '"');
 
-foreach($export as $outcome_id) {
+$outcomes = array();
+if ( $courseid ) {
+    $outcomes = array_merge(grade_outcome::fetch_all_global(), grade_outcome::fetch_all_local($courseid));
+} else { 
+    $outcomes = grade_outcome::fetch_all_global();
+}
 
-    $outcome = grade_outcome::fetch(array('id' => $outcome_id));
+foreach($outcomes as $outcome) {
 
     $line = array();
 
index efdcc0f4af5eb3482b7bd7c36b688403bb3562e7..99cc31555303228a4a15116f3626dd6a696e6e63 100644 (file)
@@ -74,11 +74,10 @@ $strstandardoutcome  = get_string('outcomesstandard', 'grades');
 $strcustomoutcomes   = get_string('outcomescustom', 'grades');
 $strdelete           = get_string('delete');
 $stredit             = get_string('edit');
-$srtcreatenewoutcome = get_string('outcomecreate', 'grades');
+$strcreatenewoutcome = get_string('outcomecreate', 'grades');
 $stritems            = get_string('items', 'grades');
 $strcourses          = get_string('courses');
 $stredit             = get_string('edit');
-$strexport           = get_string('export', 'grades');
 
 switch ($action) {
     case 'delete':
@@ -182,15 +181,12 @@ if ($courseid and $outcomes = grade_outcome::fetch_all_local($courseid)) {
         }
         $line[] = $buttons;
         
-        $buttons = '<input type="checkbox" name="export[]" value="'. $outcome->id .'">';
-        $line[] = $buttons;
-
         $data[] = $line;
     }
     $table = new object();
-    $table->head  = array($strfullname, $strshortname, $strscale, $stritems, $stredit, $strexport);
-    $table->size  = array('30%', '18%', '18%', '18%', '8%', '8%' );
-    $table->align = array('left', 'left', 'left', 'center', 'center', 'center');
+    $table->head  = array($strfullname, $strshortname, $strscale, $stritems, $stredit);
+    $table->size  = array('30%', '20%', '20%', '20%', '10%' );
+    $table->align = array('left', 'left', 'left', 'center', 'center');
     $table->width = '90%';
     $table->data  = $data;
     $return .= print_table($table, true);
@@ -242,35 +238,27 @@ if ($outcomes = grade_outcome::fetch_all_global()) {
         }
         $line[] = $buttons;
 
-        $buttons = '<input type="checkbox" name="export[]" value="'. $outcome->id .'">';
-        $line[] = $buttons;
-
         $data[] = $line;
     }
     $table = new object();
-    $table->head  = array($strfullname, $strshortname, $strscale, $strcourses, $stritems, $stredit, $strexport);
-    $table->size  = array('30%', '19%', '19%', '8%', '8%', '8%', '8%');
-    $table->align = array('left', 'left', 'left', 'center', 'center', 'center', 'center');
+    $table->head  = array($strfullname, $strshortname, $strscale, $strcourses, $stritems, $stredit);
+    $table->size  = array('30%', '20%', '20%', '10%', '10%', '10%');
+    $table->align = array('left', 'left', 'left', 'center', 'center', 'center');
     $table->width = '90%';
     $table->data  = $data;
     $return .= print_table($table, true);
     $outcomes_tables[] = $return;
 }
 
-if ( !empty($outcomes_tables) ) {
-    print('<form action="export.php" method="post">' ."\n");
-    foreach($outcomes_tables as $table) {
-        print($table);
-    }
-    echo '<div class="buttons">';
-    echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
-    print('<input type="submit" value="'. get_string('exportselectedoutcomes', 'grades') .'" name="export_outcomes">');
-    echo '</form>';
-    echo '</div>';
+foreach($outcomes_tables as $table) {
+    print($table);
 }
 
 echo '<div class="buttons">';
-print_single_button('edit.php', array('courseid'=>$courseid), $srtcreatenewoutcome);
+print_single_button('edit.php', array('courseid'=>$courseid), $strcreatenewoutcome);
+if ( !empty($outcomes_tables) ) {
+    print_single_button('export.php', array('id'=>$courseid, 'sesskey'=>sesskey()),  get_string('exportalloutcomes', 'grades'));
+}
 echo '</div>';
 
 $upload_form->display();