Browse Source

update submission form

bernardo 5 years ago
parent
commit
8e6d860f5b
3 changed files with 45 additions and 23 deletions
  1. 11 6
      lang/en/gradeimporter.php
  2. 2 2
      mod_form.php
  3. 32 15
      submission_form.php

+ 11 - 6
lang/en/gradeimporter.php

@@ -14,26 +14,31 @@ $string['displayingview'] = 'Posted Grades';
     //Generic 
     $string['description'] = 'Description';
     $string['visibility'] = 'Can students see this?';
-    
+    $string['name'] = 'Name';
 
     //Generic error Messages
+    $string['error_nameField'] = 'Insert a name';
+
 
     //gradeImporter form
     $string['general'] = 'General informations';
-    $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';
+
+    //submission form help buttons
+    $string['helpsubmissionfiles'] = 'Must be only one file, either a .zip or a .csv'
+    $string['helpcsvdelimiter'] = 'CSV delimiter of the config.csv file';
+
+    //submission form errors

+ 2 - 2
mod_form.php

@@ -16,9 +16,9 @@
 
             $mform->addElement('header', 'general', get_string('general', 'gradeimporter'));
 
-            $mform->addElement('text', 'name', get_string('instanceName', 'gradeimporter'), array('size'=>'64'));
+            $mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size'=>'64'));
             $mform->setType('name', PARAM_TEXT);
-            $mform->addRule('name', get_string('error_instanceNameField', 'gradeimporter'), 'required', null, 'client');
+            $mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client');
             
             
             $this->standard_intro_elements(get_string('description', 'gradeimporter'));

+ 32 - 15
submission_form.php

@@ -13,31 +13,48 @@
 
             $mform =& $this->_form;
 
-            $mform->addElement('text', 'name', get_string('submissionName', 'formStrings'), array('size'=>'64'));
+            $mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size'=>'64'));
             $mform->setType('name', PARAM_TEXT);
-            $mform->addRule('name', get_string('error_submissionNameField', 'formtrings'), 'required', null, 'client');
+            $mform->addRule('name', get_string('error_nameField', 'gradeimporter'), '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', 'gradeimporter'));
 
-            $this->standard_intro_elements(get_string('description', 'formStrings'));
-
-            $mform->addElement('filemanager', 'submissionFiles', getString('submissionFiles', 'formStrings'), null,
+            $mform->addElement('filemanager', 'submissionFiles', getString('submissionFiles', 'gradeimporter'), 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'));
+            $mform->addHelpButton('submissionFiles', 'helpsubmissionfiles', 'gradeimporter');
+            //csv delimiter
+
+           /* $csv_delimiter = array();
+            $csv_delimiter[1] = ',';
+            $csv_delimiter[2] = ';';
+            $csv_delimiter[3] = ':';
+            $csv_delimiter[4] = '\t';
+        
+            $mform->addElement('select', 'csv_delimiter', get_string('choose_type_activity', 'iassign'), $csv_delimiter, array('onChange' => 'config_type(this.value);'));
+            $mform->setDefault('csv_delimiter', 1); // default csv_delimiter = 3
+            $mform->addHelpButton('csv_delimiter', 'helpcsvdelimiter', 'gradeimporter');
+*/
+            //submissionType
+
+
+            //if the grades go into the gradebook or not
+            $radioarray = array();
+            $radioarray[] = $mform->createElement('radio', 'gradebook', '', get_string('gradebookY','gradeimporter'), 1, $attributes);
+            $radioarray[] = $mform->createElement('radio', 'gradebook', '', get_string('gradebookN', 'gradeimporter'), 0, $attributes);
+            $mform->addgroup($radioarray, 'radioar', '', array(' '), false);
+            $mform->setDefault('gradebook', 0);
 
-            $ynoptions = array(0 => get_string('visibilityOff', 'formStrings'),
-                           1 => get_string('visibilityOn', 'formStrings'));
 
-            $this->standard_coursemodule_elements();
+            //if students can se this submission or not
+            $visibilityar = array();
+            $visibilityar[] = $mform->createElement('radio', 'visibility', '', get_string('visibilityY','gradeimporter'), 1, $attributes);
+            $visibilityar[] = $mform->createElement('radio', 'visibility', '', get_string('visibilityN','gradeimporter'), 0, $attributes);
+            $mform->addgroup($visibilityar, 'radioar', '', array(' '), false);
+            $mform->setDefault('visibility', 1);
 
             $this->add_action_buttons();
         }
     }
 
-?>