dirroot/files/mimetypes.php"); /*** Constants **********************************/ $EXERCISE_TYPE = array (0 => get_string("notgraded", "exercise"), 1 => get_string("accumulative", "exercise"), 2 => get_string("errorbanded", "exercise"), 3 => get_string("criterion", "exercise"), 4 => get_string("rubric", "exercise") ); $EXERCISE_SCALES = array( 0 => array( 'name' => get_string("scaleyes", "exercise"), 'type' => 'radio', 'size' => 2, 'start' => get_string("yes"), 'end' => get_string("no")), 1 => array( 'name' => get_string("scalepresent", "exercise"), 'type' => 'radio', 'size' => 2, 'start' => get_string("present", "exercise"), 'end' => get_string("absent", "exercise")), 2 => array( 'name' => get_string("scalecorrect", "exercise"), 'type' => 'radio', 'size' => 2, 'start' => get_string("correct", "exercise"), 'end' => get_string("incorrect", "exercise")), 3 => array( 'name' => get_string("scalegood3", "exercise"), 'type' => 'radio', 'size' => 3, 'start' => get_string("good", "exercise"), 'end' => get_string("poor", "exercise")), 4 => array( 'name' => get_string("scaleexcellent4", "exercise"), 'type' => 'radio', 'size' => 4, 'start' => get_string("excellent", "exercise"), 'end' => get_string("verypoor", "exercise")), 5 => array( 'name' => get_string("scaleexcellent5", "exercise"), 'type' => 'radio', 'size' => 5, 'start' => get_string("excellent", "exercise"), 'end' => get_string("verypoor", "exercise")), 6 => array( 'name' => get_string("scaleexcellent7", "exercise"), 'type' => 'radio', 'size' => 7, 'start' => get_string("excellent", "exercise"), 'end' => get_string("verypoor", "exercise")), 7 => array( 'name' => get_string("scale10", "exercise"), 'type' => 'selection', 'size' => 10), 8 => array( 'name' => get_string("scale20", "exercise"), 'type' => 'selection', 'size' => 20), 9 => array( 'name' => get_string("scale100", "exercise"), 'type' => 'selection', 'size' => 100)); $EXERCISE_EWEIGHTS = array( 0 => -4.0, 1 => -2.0, 2 => -1.5, 3 => -1.0, 4 => -0.75, 5 => -0.5, 6 => -0.25, 7 => 0.0, 8 => 0.25, 9 => 0.5, 10 => 0.75, 11=> 1.0, 12 => 1.5, 13=> 2.0, 14 => 4.0); $EXERCISE_ASSESSMENT_COMPS = array ( 0 => array('name' => get_string("verylax", "exercise"), 'value' => 1), 1 => array('name' => get_string("lax", "exercise"), 'value' => 0.6), 2 => array('name' => get_string("fair", "exercise"), 'value' => 0.4), 3 => array('name' => get_string("strict", "exercise"), 'value' => 0.33), 4 => array('name' => get_string("verystrict", "exercise"), 'value' => 0.2) ); /*** Standard Moodle functions ****************** function exercise_add_instance($exercise) function exercise_choose_from_menu ($options, $name, $selected="", $nothing="choose", $script="", $nothingvalue="0", $return=false) { function exercise_cron () function exercise_delete_instance($id) function exercise_grades($exerciseid) function exercise_print_recent_activity(&$logs, $isteacher=false) function exercise_update_instance($exercise) function exercise_user_outline($course, $user, $mod, $exercise) function exercise_user_complete($course, $user, $mod, $exercise) **********************************************/ /*******************************************************************/ function exercise_add_instance($exercise) { // Given an object containing all the necessary data, // (defined by the form in mod.html) this function // will create a new instance and return the id number // of the new instance. $exercise->timemodified = time(); $exercise->deadline = make_timestamp($exercise->deadlineyear, $exercise->deadlinemonth, $exercise->deadlineday, $exercise->deadlinehour, $exercise->deadlineminute); // encode password if necessary if (!empty($exercise->password)) { $exercise->password = md5($exercise->password); } else { unset($exercise->password); } return insert_record("exercise", $exercise); } /*******************************************************************/ function exercise_choose_from_menu ($options, $name, $selected="", $nothing="choose", $script="", $nothingvalue="0", $return=false) { /// Given an array of value, creates a popup menu to be part of a form /// $options["value"]["label"] if ($nothing == "choose") { $nothing = get_string("choose")."..."; } if ($script) { $javascript = "onChange=\"$script\""; } else { $javascript = ""; } $output = "