MDL-10639 - Removed "Export" column - export all available outcomes (merge from 1.9)

This commit is contained in:
scyrma 2008-02-26 07:30:34 +00:00
parent f191a887c6
commit 050be63e0f
2 changed files with 20 additions and 28 deletions

View 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();

View 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) {
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>';
}
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();