| 
					
				 | 
			
			
				@@ -1,28 +1,26 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <?php 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// This file is part of 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// This file is part of LInE contributions to Free Education, Private Data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// LInE (Laboratory of Informatics in Education) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// http://www.usp.br/line 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// Moodle is free software: you can redistribute it and/or modify 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// it under the terms of the GNU General Public License as published by 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// the Free Software Foundation, either version 3 of the License, or 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// (at your option) any later version. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Moodle is free software: you can redistribute it or modify it under the terms of the GNU General Public License as published by 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// Moodle is distributed in the hope that it will be useful, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// GNU General Public License for more details. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Moodle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // You should have received a copy of the GNU General Public License 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 defined('MOODLE_INTERNAL') || die(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-require_once("$CFG->dirroot/course/moodleform_mod.php"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-require_once("$CFG->libdir/formslib.php"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+require_once($CFG->dirroot . "/course/moodleform_mod.php"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+require_once($CFG->libdir . "/formslib.php"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 require_once("submission_form_functions.php"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class mod_gradeimporter_submission_form extends moodleform { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  public function definition() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  public function definition () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     global $CFG, $DB; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform = $this->_form; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -46,19 +44,15 @@ class mod_gradeimporter_submission_form extends moodleform { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform->addElement('editor', 'description', get_string('description')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform->setType('description', PARAM_TEXT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $mform->addElement('filemanager', 'submissionfiles_filemanager', get_string('submissionfiles', 'gradeimporter'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              null, $filemanageroptions); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $mform->addElement('filemanager', 'submissionfiles_filemanager', get_string('submissionfiles', 'gradeimporter'), null, $filemanageroptions); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform->addHelpButton('submissionfiles_filemanager', 'submissionfiles', 'gradeimporter'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // Add button to open new subtypeform 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    $subtypeformurl = new moodle_url("/mod/gradeimporter/forms/submissiontype/submissiontype.php", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      array('cmid' => $cmid, 'id' => $gradeimporterid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $subtypeformurl = new moodle_url("/mod/gradeimporter/forms/submissiontype/submissiontype.php", array('cmid' => $cmid, 'id' => $gradeimporterid)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $newsubtypebutton = "<div class=\"col-md-9 form-inline align-items-start felement\"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                <button class=\"btn btn-primary\" onclick=\"window.open('$subtypeformurl','_self')\"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  New type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                </button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              </div>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  <button class=\"btn btn-primary\" onclick=\"window.open('" . $subtypeformurl . "','_self')\">New type</button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  </div>\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform->addElement('html', $newsubtypebutton); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // To edit 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -67,10 +61,11 @@ class mod_gradeimporter_submission_form extends moodleform { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       $selectvalues = array(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       foreach ($subtypes as $id => $type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $selectvalues[$id] = $type->name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       $selectvalues = array(-1 => 'create new type first'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform->addElement('select', 'type', get_string('submissiontype', 'gradeimporter'), $selectvalues); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $mform->addElement('selectyesno', 'visibility',  get_string('visibility', 'gradeimporter')); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -95,6 +90,6 @@ class mod_gradeimporter_submission_form extends moodleform { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // ------------------------------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // Sets preloaded data to fields 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     $this->set_data($submission); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } // public function definition() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } // class mod_gradeimporter_submission_form extends moodleform 
			 |