function edit_metadata($element = NULL)
 {
     global $CFG;
     if (!isset($element)) {
         $element = 'general';
     }
     webquestscorm_print_header($this->webquestscorm->name, $element, $this->course, $this->cm);
     switch ($element) {
         case 'metadata':
             //METADATA
         //METADATA
         case 'general':
             require_once "general.php";
             break;
         case 'lifecycle':
             require_once "lifecycle.php";
             break;
         case 'metametadata':
             require_once "metametadata.php";
             break;
         case 'technical':
             require_once "technical.php";
             break;
         case 'educational':
             require_once "educational.php";
             break;
         case 'rights':
             require_once "rights.php";
             break;
         case 'relation':
             require_once "relation.php";
             break;
         case 'annotation':
             require_once "annotation.php";
             break;
         case 'classification':
             require_once "classification.php";
             break;
     }
     print_footer();
 }
 function edit_export()
 {
     webquestscorm_print_header($this->webquestscorm->name, 'export', $this->course, $this->cm);
     require_once "export.php";
     print_footer();
 }
/**
 * 
 * @author Julia Tejerina, Oscar Sanchez, Javier Gonzalez
 * @version $Id: upload.php, v 2.0 2009/25/04
 * @package webquestscorm
 **/
require_once "../../config.php";
require_once "locallib.php";
global $CFG, $USER;
require_once "submissions.class.php";
$cmid = required_param('cmid');
$submissionsinstance = new submissions($cmid);
require_login($submissionsinstance->course->id, false, $submissionsinstance->cm);
require_capability('mod/webquestscorm:submit', $submissionsinstance->context);
webquestscorm_print_header($submissionsinstance->wqname, 'uploadTasks', $submissionsinstance->course, $submissionsinstance->cm);
$filecount = $submissionsinstance->count_user_files($USER->id);
$submission = $submissionsinstance->get_submission($USER->id);
if ($submissionsinstance->isopen() && (!$filecount || $submissionsinstance->wqresubmit || !$submission->timemarked)) {
    if ($submission = $submissionsinstance->get_submission($USER->id)) {
        //TODO: change later to ">= 0", to prevent resubmission when graded 0
        if ($submission->grade > 0 and !$submissionsinstance->wqresubmit) {
            notify(get_string('alreadygraded', 'webquestscorm'));
        }
    }
    $dir = $submissionsinstance->file_area_name($USER->id);
    require_once $CFG->dirroot . '/lib/uploadlib.php';
    $um = new upload_manager('newfile', true, false, $submissionsinstance->course, false, $submissionsinstance->wqmaxbytes);
    if ($um->process_file_uploads($dir)) {
        $newfile_name = $um->get_new_filename();
        if ($submission) {