Quellcode durchsuchen

database tables xml created
this version can be installed on moodle

bernardo vor 4 Jahren
Ursprung
Commit
ad1ec20d72

+ 0 - 24
.vscode/launch.json

@@ -1,24 +0,0 @@
-{
-    // Use IntelliSense to learn about possible attributes.
-    // Hover to view descriptions of existing attributes.
-    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
-    "version": "0.2.0",
-    "configurations": [
-        {
-            "name": "Listen for XDebug",
-            "type": "php",
-            "request": "launch",
-            "port": 9000
-        },
-        {
-            "name": "Launch currently open script",
-            "type": "php",
-            "request": "launch",
-            "program": "${file}",
-            "cwd": "${fileDirname}",
-            "port": 9000
-        },
-        "phpcs.standard": "localhost/moodle/codechecker/moodle"
-
-    ]
-}

+ 2 - 5
db/access.php

@@ -1,6 +1,6 @@
 <?php
     $capabilities = array(
-        'mod/certificate:addinstance' => array(
+        'mod/gradeimporter:addinstance' => array(
             'riskbitmask' => RISK_XSS,
             'captype' => 'write',
             'contextlevel' => CONTEXT_COURSE,
@@ -10,7 +10,7 @@
             ),
             'clonepermissionsfrom' => 'moodle/course:manageactivies'
         ),
-        'mod/MODULENAME:view' => array(
+        'mod/gradeimporter:view' => array(
             'captype' => 'read',
             'contextlevel' => CONTEXT_MODULE,
             'archetypes' => array(
@@ -22,6 +22,3 @@
             )
         )
 );
-
-
- ?>

+ 73 - 0
db/install.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<XMLDB PATH="mod/gradeimporter/db" VERSION="20190920" 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.">
+      <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"/>
+      </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.">
+      <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."/>
+      </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_submissiontype" COMMENT="Submission types are recorded by this table, eg: exam, exercises list, etc.">
+      <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.)"/>
+      </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">
+      <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"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+        <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id"/>
+      </KEYS>
+    </TABLE>
+  </TABLES>
+</XMLDB>

+ 0 - 1
index.php

@@ -7,4 +7,3 @@
     if (!$course = $DB->get_record('course', array('id'=> $id))) {
         print_error('Course ID is incorrect');
     }
-?>

+ 8 - 0
lang/en/gradeimporter.php

@@ -0,0 +1,8 @@
+<?php
+$string['gradeimporter'] = 'Grade Importer';
+
+$string['modulename'] = 'Grade Importer';
+$string['modulenameplural'] = 'Grade Importers';
+
+$string['gradeimporterintro'] = 'This module facilitates...';
+$string['gradeimportername'] = 'Grade Importer Name';

+ 0 - 29
lang/en_utf8/formStrings.php

@@ -1,29 +0,0 @@
-<?php
-//Here we define the strings used on the forms
-
-//Generic strings
-$string['description'] = 'Description';
-$string['visibility'] = 'Can students see this?';
-
-//Generic error Messages
-
-//gradeImporter form
-$string['instanceName'] = 'Name';
-$string['visibilityOn'] = 'Students can see this';
-$string['visibilityOff'] = 'Students can\'t see this';
-
-//gradeImporter form errors
-$string['error_instanceNameField'] = 'Insert a name';
-
-//submission form
-$string['submissionName'] = 'Name';
-$string['gradebookN'] = 'This submission goes to gradebook';
-$string['gradebookY'] = 'This submission does not go to gradebook';
-$string['submissionFiles'] = 'Choose the students feedback file';
-$string[''] = '';
-$string[''] = '';
-
-//submission form errors
-$string['error_submissionNameField'] = 'Please insert a name for this submission'
-
-?>

+ 0 - 9
lang/en_utf8/mod_gradeImporter.php

@@ -1,9 +0,0 @@
-<?php
-$string['gradeImporter'] = 'Grade Importer';
-
-$string['moduleName'] = 'Grade Importer';
-$string['moduleNamePlural'] = 'Grade Importers';
-
-$string['gradeImporterintro'] = 'This module facilitates...';
-$string['gradeImportername'] = 'Grade Importer Name';
-?>

+ 3 - 4
lang/pt-br_utf8/mod_gradeImporter.php

@@ -1,10 +1,9 @@
 <?php
-$string['gradeImporter'] = 'Importador de notas';
+$string['gradeimporter'] = 'Importador de notas';
 
 $string['moduleName'] = 'Importador de notas';
 $string['moduleNamePlural'] = 'Importadores de notas';
 
-$string['gradeImporterintro'] = 'Esse módulo facilita a
+$string['gradeimporterintro'] = 'Esse módulo facilita a
             disponibilização de notas de atividades para os alunos';
-$string['gradeImportername'] = 'Importador de Notas';
-?>
+$string['gradeimportername'] = 'Importador de Notas';

+ 6 - 4
lib.php

@@ -1,5 +1,7 @@
 <?php
-    function certificate_add_instance($certificate);
-    function certificate_update_instance($certificate);
-    function certificate_delete_instance($id);
-?>
+
+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);
+}

+ 50 - 3
mod_form.php

@@ -4,14 +4,15 @@
     }
 
     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 {
+    class mod_gradeimporter_mod_form extends moodleform_mod {
 
         function definition() {
             global $CFG, $DB, $OUTPUT;
 
             $mform =& $this->_form;
+            $course_modules_id = optional_param('update', 0, PARAM_INT);
 
             $mform->addElement('text', 'name', get_string('instanceName', 'formStrings'), array('size'=>'64'));
             $mform->setType('name', PARAM_TEXT);
@@ -26,5 +27,51 @@
 
             $this->add_action_buttons();
             }
+
+        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];
+                }
+            }
+
+        function definition_after_data() {
+            global $DB;
+        
+            $mform = & $this->_form;
+            $data = $mform->exportValues();
+        
+            if ($mform->isSubmitted() && array_key_exists('iassign_statement', $data)) {
+        
+                $iassign_statements = $data['iassign_statement'];
+                foreach ($iassign_statements as $key => $value) {
+                if ($value == 1) {
+                    $updateentry = new stdClass();
+                    $updateentry->id = $key;
+                    $updateentry->timemodified = time();
+        
+                    if (isset($data['grade_enabled']) && $data['grade_enabled'] == 1)
+                    $updateentry->grade = $data['grade'];
+                    if (isset($data['timedue_enabled']) && $data['timedue_enabled'] == 1)
+                    $updateentry->timedue = $data['timedue'];
+                    if (isset($data['timeavailable_enabled']) && $data['timeavailable_enabled'] == 1)
+                    $updateentry->timeavailable = $data['timeavailable'];
+                    if (isset($data['preventlate_enabled']) && $data['preventlate_enabled'] == 1)
+                    $updateentry->preventlate = $data['preventlate'];
+                    if (isset($data['test_enabled']) && $data['test_enabled'] == 1)
+                    $updateentry->test = $data['test'];
+                    if (isset($data['max_experiment_enabled']) && $data['max_experiment_enabled'] == 1)
+                    $updateentry->max_experiment = $data['max_experiment'];
+        
+                    if (!$DB->update_record("iassign_statement", $updateentry))
+                    print_error('error_update', 'iassign');
+                    }
+                }
+                }
+            }
     }
-?>

+ 0 - 0
pix/icon.gif


+ 0 - 0
readme.md


+ 1 - 1
submission_form.php

@@ -4,7 +4,7 @@
     }
 
     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_submission_form extends moodleform_mod{
         

+ 2 - 3
version.php

@@ -5,7 +5,6 @@ defined('MOODLE_INTERNAL') || die();
 $plugin->version = 20190910;
 $plugin->requires = 2014021100;
 $plugin->release = 'v1.0';
-$plugin->component = 'mod_gradeImporter';
+$plugin->component = 'mod_gradeimporter';
 $plugin->maturity = MATURITY_STABLE;
-$plugin->release = 'TODO';
-?>
+

+ 1 - 2
view.php

@@ -1,8 +1,7 @@
 <?php
     require('../../config.php');
-    require_once('lib.php');
+    //require_once('lib.php');
 
     $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);
-?>