|
@@ -1,12 +1,22 @@
|
|
<?php
|
|
<?php
|
|
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
|
|
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
|
|
require_once(dirname(__FILE__).'/lib.php');
|
|
require_once(dirname(__FILE__).'/lib.php');
|
|
|
|
+ require_once($CFG->libdir.'/filelib.php');
|
|
|
|
+ require_once('locallib.php');
|
|
|
|
+
|
|
|
|
|
|
global $DB;
|
|
global $DB;
|
|
|
|
|
|
|
|
|
|
$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
|
|
$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
|
|
$g = optional_param('g', 0, PARAM_INT); // gradeimporter instance ID, should be named as the first character of the module
|
|
$g = optional_param('g', 0, PARAM_INT); // gradeimporter instance ID, should be named as the first character of the module
|
|
|
|
+ $action = optional_param('action', 0, PARAM_INT);
|
|
|
|
+ $cmid = optional_param('cmid', 0, PARAM_INT);
|
|
|
|
+ $id = optional_param('id', 0, PARAM_INT);
|
|
|
|
+ $fileid = optional_param('fileid', 0, PARAM_INT);
|
|
|
|
+ $filename = optional_param('filename', 'a', PARAM_TEXT);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
if ($id) {
|
|
if ($id) {
|
|
if (! $cm = get_coursemodule_from_id('gradeimporter', $id)) {
|
|
if (! $cm = get_coursemodule_from_id('gradeimporter', $id)) {
|
|
@@ -42,6 +52,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ if ($action==1 && has_capability('mod/gradeimporter:edit', $context)){
|
|
|
|
+ //download feedback file
|
|
|
|
+ $fs = get_file_storage();
|
|
|
|
+ echo 'file storage';
|
|
|
|
+ $file = $fs->get_file($context->id, 'mod_gradeimporter', 'gradeimporter_feedback', $fileid, '/', $filename);
|
|
|
|
+ if ($file){
|
|
|
|
+ echo 'found file';
|
|
|
|
+ send_stored_file($file, 86400, 0, true);
|
|
|
|
+ }
|
|
|
|
+ } else if ($action == 2 && has_capability('mod/gradeimporter:edit', $context)){
|
|
|
|
+ exportCSV($context);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/// Print the page header
|
|
/// Print the page header
|
|
$PAGE->set_cm($cm);
|
|
$PAGE->set_cm($cm);
|
|
$PAGE->set_url('/mod/gradeimporter/view.php', array('id' => $cm->id));
|
|
$PAGE->set_url('/mod/gradeimporter/view.php', array('id' => $cm->id));
|
|
@@ -69,17 +93,25 @@ echo $output->heading($heading);
|
|
//button to add new submission
|
|
//button to add new submission
|
|
if (has_capability('mod/gradeimporter:edit', $context)) {
|
|
if (has_capability('mod/gradeimporter:edit', $context)) {
|
|
$url = new moodle_url('/mod/gradeimporter/submission.php');
|
|
$url = new moodle_url('/mod/gradeimporter/submission.php');
|
|
- $newSubmission = '<form action="'. $url . '">'.
|
|
|
|
|
|
+ $newbutton = '<form action="'. $url . '">'.
|
|
'<input type="hidden" name="id" value="'. $gradeimporter->id .'" />'.
|
|
'<input type="hidden" name="id" value="'. $gradeimporter->id .'" />'.
|
|
'<input type="hidden" name="cmid" value="'.$cm->id.'" />'.
|
|
'<input type="hidden" name="cmid" value="'.$cm->id.'" />'.
|
|
'<input type="hidden" name="page" value="0" />'.
|
|
'<input type="hidden" name="page" value="0" />'.
|
|
'<input type="submit" Value="'.get_string('newsubmission', 'gradeimporter').'" />'.
|
|
'<input type="submit" Value="'.get_string('newsubmission', 'gradeimporter').'" />'.
|
|
'</form>';
|
|
'</form>';
|
|
- echo $newSubmission;
|
|
|
|
|
|
+ echo $newbutton;
|
|
|
|
+
|
|
|
|
+ $url = new moodle_url("/mod/gradeimporter/view.php", array('id'=>$id, 'cmid'=>$cm->id, 'action'=>2));
|
|
|
|
+ $newbutton = '<form action="'. $url . '">'.
|
|
|
|
+ '<input type="hidden" name="id" value="'. $id .'" />'.
|
|
|
|
+ '<input type="hidden" name="cmid" value="'.$cm->id.'" />'.
|
|
|
|
+ '<input type="hidden" name="action" value="2" />'.
|
|
|
|
+ '<input type="submit" Value="'.get_string('downloadconfigcsv', 'gradeimporter').'" />'.
|
|
|
|
+ '</form>';
|
|
|
|
+ echo $newbutton;
|
|
}
|
|
}
|
|
|
|
|
|
//tabela com as notas vem aqui
|
|
//tabela com as notas vem aqui
|
|
-echo 'parte principal do importador de notas Z';
|
|
|
|
|
|
|
|
require_once($CFG->libdir . '/tablelib.php');
|
|
require_once($CFG->libdir . '/tablelib.php');
|
|
require_once(dirname(__FILE__).'/locallib.php');
|
|
require_once(dirname(__FILE__).'/locallib.php');
|
|
@@ -95,7 +127,7 @@ use \gradeimporter\feedback;
|
|
// $data["teste"][] = array("E1", "-", "fulanoE1.pdf.pdf");
|
|
// $data["teste"][] = array("E1", "-", "fulanoE1.pdf.pdf");
|
|
// $data["teste"][] = array("E2", "-", "fulanoE2.pdf.pdf");
|
|
// $data["teste"][] = array("E2", "-", "fulanoE2.pdf.pdf");
|
|
|
|
|
|
-$data = feedback::get_comments();
|
|
|
|
|
|
+$data = feedback::get_comments($cm->id, $id);
|
|
|
|
|
|
$table = new html_table();
|
|
$table = new html_table();
|
|
$table->attributes['class'] = 'generaltable mod_index';
|
|
$table->attributes['class'] = 'generaltable mod_index';
|
|
@@ -131,9 +163,5 @@ if (count($data)) {
|
|
}
|
|
}
|
|
|
|
|
|
echo html_writer::table($table);
|
|
echo html_writer::table($table);
|
|
-
|
|
|
|
/// Finish the page
|
|
/// Finish the page
|
|
-echo $output->footer();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+echo $output->footer();
|