Переглянути джерело

working instance form
view.php loading

bernardo 5 роки тому
батько
коміт
a2d3fd4d32
5 змінених файлів з 215 додано та 76 видалено
  1. 65 40
      db/install.xml
  2. 4 0
      lang/en/gradeimporter.php
  3. 63 18
      lib.php
  4. 22 13
      mod_form.php
  5. 61 5
      view.php

+ 65 - 40
db/install.xml

@@ -1,73 +1,98 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/gradeimporter/db" VERSION="20190920" COMMENT="XMLDB file for Moodle mod/gradeimporter"
+<XMLDB PATH="mod/gradeimporter/db" VERSION="20191002" COMMENT="XMLDB file for Moodle mod/gradeimporter"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
 >
   <TABLES>
-    <TABLE NAME="gradeimporter" COMMENT="gradeimporter instance table, this table links the submissions to the course.">
+    <TABLE NAME="gradeimporter" COMMENT="gradeimporter instance table, this table links the submissions to the course." NEXT="grade_importer_submission">
       <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
-        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of the course this instance is placed on"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="Instance name"/>
-        <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of the grades that are going to be available on the module"/>
-        <FIELD NAME="descriptionformat" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="plaintext" SEQUENCE="false" COMMENT="description format (html, plaintext, etc)"/>
-        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time stamp from when the instance was first created"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Last time the instance was modified"/>
-        <FIELD NAME="visibility" TYPE="binary" NOTNULL="true" SEQUENCE="false" COMMENT="Can the students view the gradeimporter instance?"/>
-        <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" COMMENT="primary key" NEXT="course"/>
+        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of the course this instance is placed on" 
+                  PREVIOUS="id" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Instance name" PREVIOUS="course" NEXT="intro"/>
+        <FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of the grades that are going to be available on the module" 
+              PREVIOUS="NAME" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time stamp from when the instance was first created" 
+              PREVIOUS="intro" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Last time the instance was modified" 
+                PREVIOUS="timecreated" NEXT="usermodified"/>
+        <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timemodified"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="gradeimporter_submission" COMMENT="submission table, relates the submission to the gradeimporter, feedback files and student.">
+    <TABLE NAME="gradeimporter_submission" COMMENT="submission table, relates the submission to the gradeimporter, feedback files and student." PREVIOUS="gradeimporter" NEXT="gradeimporter_submissiontype" >
       <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
-        <FIELD NAME="gradeimporter" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which gradeimporter instance this submission is related to"/>
-        <FIELD NAME="type" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Type of the submission (exam, exercise list,"/>
-        <FIELD NAME="gradebook" TYPE="binary" NOTNULL="true" SEQUENCE="false" COMMENT="Register if the submission is going to the gradebook"/>
-        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
-        <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="submission name"/>
-        <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of the submission type ex: exam 1 given on day YYYY/MM/DD"/>
-        <FIELD NAME="descriptionformat" TYPE="char" LENGTH="10" NOTNULL="false" DEFAULT="plaintext" SEQUENCE="false" COMMENT="Description text format (html, plaintext, etc)"/>
-        <FIELD NAME="position" TYPE="int" LENGTH="3" NOTNULL="true" SEQUENCE="false" COMMENT="Position relative to other submissions"/>
-        <FIELD NAME="visibility" TYPE="binary" NOTNULL="true" SEQUENCE="false" COMMENT="Registers if students can see this submission."/>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="gradeimporter"/>
+        <FIELD NAME="gradeimporter" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" 
+              COMMENT="Which gradeimporter instance this submission is related to" PREVIOUS="id" NEXT="type"/>
+        <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Type of the submission (exam, exercise list,"
+                PREVIOUS="gradeimporter" NEXT="gradebook"/>
+        <FIELD NAME="gradebook" TYPE="binary" NOTNULL="true" SEQUENCE="false" COMMENT="Register if the submission is going to the gradebook"
+                PREVIOUS="type" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"
+                PREVIOUS="gradebook" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"
+                PREVIOUS="timecreated" NEXT="usermodified"/>
+        <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"
+                PREVIOUS="timemodified" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="submission name"
+                PREVIOUS="usermodified" NEXT="info"/>
+        <FIELD NAME="info" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of the submission type ex: exam 1 given on day YYYY/MM/DD"
+              PREVIOUS="name" NEXT="position"/>
+        <!--<FIELD NAME="descriptionformat" TYPE="char" LENGTH="10" NOTNULL="false" DEFAULT="plaintext" SEQUENCE="false" COMMENT="Description text format (html, plaintext, etc)"/>-->
+        <FIELD NAME="position" TYPE="int" LENGTH="3" NOTNULL="true" SEQUENCE="false" COMMENT="Position relative to other submissions"
+                PREVIOUS="info" NEXT="visibility"/>
+        <FIELD NAME="visibility" TYPE="binary" NOTNULL="true" SEQUENCE="false" COMMENT="Registers if students can see this submission."
+                PREVIOUS="position"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
+        <KEY NAME="type" TYPE="foreign" FIELDS="type" REFTABLE="gradeimporter_submissiontype" REFFIELDS="id"/>
+        <KEY NAME="gradeimporter" TYPE="foreign" FIELDS="gradeimporter" REFTABLE="gradeimporter" REFFIELDS="id"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="gradeimporter_submissiontype" COMMENT="Submission types are recorded by this table, eg: exam, exercises list, etc.">
+    <TABLE NAME="gradeimporter_submissiontype" COMMENT="Submission types are recorded by this table, eg: exam, exercises list, etc." PREVIOUS="gradeimporter_submission" NEXT="gradeimporter_feedback">
       <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="Type name (exam, exercises list, etc)."/>
-        <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Submission type description. eg for exam type: exams given in class."/>
-        <FIELD NAME="descriptionformat" TYPE="char" LENGTH="10" NOTNULL="false" DEFAULT="plaintext" SEQUENCE="false" COMMENT="Type description format (html, plaintext, etc.)"/>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="Type name (exam, exercises list, etc)." 
+                    PREVIOUS="id" NEXT="info"/>
+        <FIELD NAME="info" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Submission type description. eg for exam type: exams given in class." 
+                    PREVIOUS="name"/>
+        <!--<FIELD NAME="descriptionformat" TYPE="char" LENGTH="10" NOTNULL="false" DEFAULT="plaintext" SEQUENCE="false" COMMENT="Type description format (html, plaintext, etc.)"/>-->
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="gradeimporter_feedback" COMMENT="This table is responsible to link the feedback files from a certain submission to the student">
+    <TABLE NAME="gradeimporter_feedback" COMMENT="This table is responsible to link the feedback files from a certain submission to the student" PREVIOUS="gradeimporter_submissiontype">
       <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
-        <FIELD NAME="submission" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which submission this feedback is related to"/>
-        <FIELD NAME="student" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Student moodle user id. Related the feedback files to the student"/>
-        <FIELD NAME="grade" TYPE="number" LENGTH="4" NOTNULL="false" SEQUENCE="false" DECIMALS="2" COMMENT="Student grade on the submission"/>
-        <FIELD NAME="comment" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Teacher comment about the feedback"/>
-        <FIELD NAME="fileid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="id from filesplugin, where the feedback files are recorded"/>
-        <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
-        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="submissionid"/>
+        <FIELD NAME="submissionid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which submission this feedback is related to"
+                    PREVIOUS="id" NEXT="student"/>
+        <FIELD NAME="studentid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Student moodle user id. Related the feedback files to the student"
+                    PREVIOUS="submissionid" NEXT="grade"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="4" NOTNULL="false" SEQUENCE="false" DECIMALS="2" COMMENT="Student grade on the submission"
+                    PREVIOUS="studentid" NEXT="comment"/>
+        <FIELD NAME="comment" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Teacher comment about the feedback"
+                    PREVIOUS="grade" NEXT="fileid"/>
+        <FIELD NAME="fileid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="id from filesplugin, where the feedback files are recorded"
+                    PREVIOUS="comment" NEXT="usermodified"/>
+        <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"
+                    PREVIOUS="fileid" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"
+                    PREVIOUS="usermodified" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"
+                    PREVIOUS="timecreated"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
+        <KEY NAME="submissionid" TYPE="foreign" FIELDS="submissionid" REFTABLE="gradeimporter_submission" REFFIELDS="id"/>
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>

+ 4 - 0
lang/en/gradeimporter.php

@@ -6,16 +6,20 @@ $string['modulenameplural'] = 'Grade Importers';
 
 $string['gradeimporterintro'] = 'This module facilitates...';
 $string['gradeimportername'] = 'Grade Importer Name';
+$string['pluginadministration'] ='plugin administration string';
+$string['displayingview'] = 'Posted Grades';
 
 //formStrings
 
     //Generic 
     $string['description'] = 'Description';
     $string['visibility'] = 'Can students see this?';
+    
 
     //Generic error Messages
 
     //gradeImporter form
+    $string['general'] = 'General informations';
     $string['instanceName'] = 'Name';
     $string['visibilityOn'] = 'Students can see this';
     $string['visibilityOff'] = 'Students can\'t see this';

+ 63 - 18
lib.php

@@ -1,28 +1,73 @@
 <?php
 
 //adds gradeimporter to add new activity page
-    function tool_devcourse_extend_navigation_course($navigation, $course, $coursecontext) {
+function tool_devcourse_extend_navigation_course($navigation, $course, $coursecontext) {
     $url = new moodle_url('/admin/tool/devcourse/index.php');
     $devcoursenode = navigation_node::create('Development course', $url, navigation_node::TYPE_CUSTOM, 'Dev course', 'devcourse');
     $navigation->add_node($devcoursenode);
 }
 
+function gradeimporter_supports($feature) {
+    switch($feature) {
+       case FEATURE_MOD_INTRO:         return true;
+       case FEATURE_SHOW_DESCRIPTION:  return true;
+  
+       default:                        return null;
+      }
+    }
+
 function gradeimporter_add_instance ($data, $mform) {
+    /*
+        *Given an object containing all the necessary data,
+        *(defined by the form in mod_form.php) this function
+        *creates a new instance and returns the id of this new
+        *instance.
+        *
+        *@param $data: an object from the form in mod_form.php
+        *@return int: the id of the newly inserted gradeimport record
+    */
     global $DB;
-  
-    $cmid = $data->coursemodule;
-  
-    $gradeimporterid = $DB->insert_record("gradeimporter", $data);
-    $data->id = $gradeimporterid;
-  
-    $context = context_module::instance($cmid);
-    $gradeimporter = $DB->get_record('gradeimporter', array('id' => $gradeimporterid), '*', MUST_EXIST);
-  
-   // iassign_grade_item($gradeimporter);
-  
-    // log event -----------------------------------------------------
-    iassign_log::add_log('add_gradeimporter', 'name: ' . $data->name, $cmid);
-    // log event -----------------------------------------------------
-  
-    return $iassign->id;
-    }
+    $data->timemodified = time();
+    
+    $data->id = $DB->insert_record("gradeimporter", $data);
+    
+    return $data->id;
+}
+
+function gradeimporter_update_instance ($data){
+    /*
+        *given an object containing all the necessary data,
+        *(defined by the form in mod_form.php) this function
+        *updates an existing instance with the new data.
+        *
+        *@param $data: an object from the form mod_form.php
+        *@return boolean: if the record update was a success of fail
+    */
+    global $DB;
+
+    $data->timemodified = time();
+    $data->id = $data->instance;
+
+    return $DB->update_record('gradeimporter', $data);
+}
+
+function gradeimporter_delete_instance($data){
+    /*
+    *Given an id of a gradeimporter instance,
+    * this function permanently deletes the instance
+    * and any data that depends on it.
+    *
+    *@param int $id: Id of the gradeimporter instance
+    *@return boolean, if the deletion was a success or
+    *                 a failure.
+    */
+
+    global $DB;
+    
+    if (!$data = $DB->get_record('gradeimporter', array('id'=>$id) ) ){
+        return false;
+    }
+
+    $DB->delete_records('gradeimporter', array('id'=>$id) );
+    return true;
+}

+ 22 - 13
mod_form.php

@@ -4,49 +4,58 @@
     }
 
     require_once($CFG->dirroot.'/course/moodleform_mod.php');
-    //require_once($CFG->dirroot.'/mod/gradeimporter/lib.php');
+    require_once($CFG->dirroot.'/mod/gradeimporter/lib.php');
 
     class mod_gradeimporter_mod_form extends moodleform_mod {
 
         function definition() {
-            global $CFG, $DB, $OUTPUT;
+            global $CFG, $DB;
 
             $mform =& $this->_form;
             $course_modules_id = optional_param('update', 0, PARAM_INT);
 
+            $mform->addElement('header', 'general', get_string('general', 'gradeimporter'));
+
             $mform->addElement('text', 'name', get_string('instanceName', 'gradeimporter'), array('size'=>'64'));
             $mform->setType('name', PARAM_TEXT);
             $mform->addRule('name', get_string('error_instanceNameField', 'gradeimporter'), 'required', null, 'client');
-
+            
+            
             $this->standard_intro_elements(get_string('description', 'gradeimporter'));
 
-            $ynoptions = array(0 => get_string('visibilityOn', 'gradeimporter'),
-                           1 => get_string('visibilityOff', 'gradeimporter'));
+            //$ynoptions = array(0 => get_string('visibilityOn', 'gradeimporter'), 1 => get_string('visibilityOff', 'gradeimporter'));
+            //$mform->addElement('')
+
 
-            $this->standard_coursemodule_elements();
+            $features = array('groups' => false, 'groupings' => false, 'groupmembersonly' => false,  'outcomes' => false,'gradecat' => false, 'idnumber' => false);
+            $this->standard_coursemodule_elements($features);
+            
 
+            
             $this->add_action_buttons();
             }
 
-        function data_preprocessing (&$default_values) {
+//$DB->insert_record($table, $dataobject, $returnid, $bulk); insert records on db
+
+        /*function data_preprocessing (&$default_values) {
             parent::data_preprocessing($default_values);
         
             $mform = & $this->_form;
         
             if (!$mform->isSubmitted() && array_key_exists('name', $default_values)) {
                 //TODO Remove when updating all the iassign that are tag &lt;ia_uc&gt;
-                $ia_uc = explode('&lt;ia_uc&gt;', $default_values['name']);
-                $default_values['name'] = $ia_uc[0];
+                //$ia_uc = explode('&lt;ia_uc&gt;', $default_values['name']);
+                //$default_values['name'] = $ia_uc[0];
                 }
-            }
+            }*/
 
-        function definition_after_data() {
+       /* function definition_after_data() {
             global $DB;
         
             $mform = & $this->_form;
             $data = $mform->exportValues();
         
-            if ($mform->isSubmitted() && array_key_exists('iassign_statement', $data)) {
+           if ($mform->isSubmitted()) {
         
                 $iassign_statements = $data['iassign_statement'];
                 foreach ($iassign_statements as $key => $value) {
@@ -73,5 +82,5 @@
                     }
                 }
                 }
-            }
+            }*/
     }

+ 61 - 5
view.php

@@ -1,7 +1,63 @@
 <?php
-    require('../../config.php');
-    //require_once('lib.php');
+    require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
+    require_once(dirname(__FILE__).'/lib.php');
+
+    global $DB;
+
+    $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
+
+    if ($id) {
+        if (! $cm = get_coursemodule_from_id('gradeimporter', $id)) {
+            error('Course Module ID was incorrect');
+        }
+
+        if (! $course = $DB->get_record('course', array('id'=> $cm->course))) {
+            error('Course is misconfigured');
+        }
+
+        if (! $gradeimporter = $DB->get_record('gradeimporter', array('id'=> $cm->instance) ) ) {
+            error('Course module is incorrect');
+        }
+
+    } else if ($g) {
+        if (! $gradeimporter = $DB->get_record('gradeimporter', array('id'=> $g)) ){
+            error('Course module is incorrect');
+        }
+        if (! $course = $DB->get_record('course', array('id'=> $gradeimporter->course)) ) {
+            error('Course is misconfigured');
+        }
+        if (! $cm = get_coursemodule_from_instance('gradeimporter', $gradeimporter->id, $course->id)) {
+            error('Course Module ID was incorrect');
+        }
+
+    } else {
+        error('You must specify a course_module ID or an instance ID');
+    }
+
+    require_login($course, true, $cm);
+
+    $context = context_module::instance($cm->id);
+
+
+
+    /// Print the page header
+    $PAGE->set_url('/mod/gradeimporter/view.php', array('id' => $cm->id));
+    $PAGE->set_title(format_string($gradeimporter->name));
+    $PAGE->set_heading(format_string($course->fullname));
+    $PAGE->set_context($context);
+/// Print the main part of the page
+
+$output = $PAGE->get_renderer('mod_folder');
+echo $output->header();
+$heading = get_string('displayingview', 'gradeimporter', $gradeimporter->name);
+echo $output->heading($heading);
+
+//tabela com as notas vem aqui
+echo 'parte principal do importador de notas';
+
+/// Finish the page
+echo $output->footer();
+
+
 
-    $id = required_param('id', PARAM_INT);
-    list ($course, $cm) = get_course_and_cm_from_cmid($id, 'certificate');
-    $certificate = $DB->get_record('certificate', array('id'=> $cm->instance), '*', MUST_EXIST);