bernardo 4 years ago
parent
commit
329d10c2bc
7 changed files with 108 additions and 8 deletions
  1. 24 0
      .vscode/launch.json
  2. 0 0
      db/install.xml
  3. 29 0
      lang/en_utf8/formStrings.php
  4. 5 0
      lib.php
  5. 6 7
      mod_form.php
  6. 43 0
      submission_form.php
  7. 1 1
      version.php

+ 24 - 0
.vscode/launch.json

@@ -0,0 +1,24 @@
+{
+    // 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"
+
+    ]
+}

+ 0 - 0
db/install.xml


+ 29 - 0
lang/en_utf8/formStrings.php

@@ -0,0 +1,29 @@
+<?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'
+
+?>

+ 5 - 0
lib.php

@@ -0,0 +1,5 @@
+<?php
+    function certificate_add_instance($certificate);
+    function certificate_update_instance($certificate);
+    function certificate_delete_instance($id);
+?>

+ 6 - 7
mod_form.php

@@ -13,15 +13,14 @@
 
             $mform =& $this->_form;
 
-            $mform->addElement('text', 'name', get_string('moduleName', 'mod_gradeImporter'), array('size'=>'64'));
+            $mform->addElement('text', 'name', get_string('instanceName', 'formStrings'), array('size'=>'64'));
             $mform->setType('name', PARAM_TEXT);
-            $mform->addRule('name', null, 'required', null, 'client');
+            $mform->addRule('name', get_string('error_instanceNameField', 'formStrings'), 'required', null, 'client');
 
-            $ynoptions = array(0 => get_string('no'),
-                               1 => get_string('yes'));
-            $mform->addElement('select', 'usecode', 'USE CODE', $ynoptions);
-            $mform->setDefault('usecode', 0);
-            $mform->addHelpButton('usecode', 'usecode', 'certificate');
+            $this->standard_intro_elements(get_string('description', 'formStrings'));
+
+            $ynoptions = array(0 => get_string('visibilityOn', 'formStrings'),
+                           1 => get_string('visibilityOff', 'formStrings'));
 
             $this->standard_coursemodule_elements();
 

+ 43 - 0
submission_form.php

@@ -0,0 +1,43 @@
+<?php
+    if (!defined('MOODLE_INTERNAL')) {
+        die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
+    }
+
+    require_once($CFG->dirroot.'/course/moodleform_mod.php');
+    require_once($CFG->dirroot.'/mod/gradeImporter/lib.php');
+
+    class mod_submission_form extends moodleform_mod{
+        
+        function definition(){
+            global $CFG, $DB, $OUTPUT;
+
+            $mform =& $this->_form;
+
+            $mform->addElement('text', 'name', get_string('submissionName', 'formStrings'), array('size'=>'64'));
+            $mform->setType('name', PARAM_TEXT);
+            $mform->addRule('name', get_string('error_submissionNameField', 'formtrings'), 'required', null, 'client');
+
+            $mform->addElement('text', 'type', getString('submissionType', 'formStrings'), array('size'=>'64'));
+            $mform->setType('type', PARAM_TEXT);
+            $mform->addRule('type', get_string('error_submission', 'formStrings'), 'required', null, 'client');
+
+            $this->standard_intro_elements(get_string('description', 'formStrings'));
+
+            $mform->addElement('filemanager', 'submissionFiles', getString('submissionFiles', 'formStrings'), null,
+                                array('subdirs' => 1, 'maxbytes' => $maxbytes, 'areamaxbytes' => $maxbytes, 'maxfiles' => -1,
+                                'accepted_types' => array('*'),  'return_types' => FILE_INTERNAL | FILE_EXTERNAL)); 
+                                                                //restrict accepted types to compacted?
+            
+            $ynoptions = array(0 => get_string('gradebookY', 'formStrings'),
+                            1 => get_string('gradebookN', 'formStrings'));
+
+            $ynoptions = array(0 => get_string('visibilityOff', 'formStrings'),
+                           1 => get_string('visibilityOn', 'formStrings'));
+
+            $this->standard_coursemodule_elements();
+
+            $this->add_action_buttons();
+        }
+    }
+
+?>

+ 1 - 1
version.php

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