123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?php
- function tool_devcourse_extend_navigation_course($navigation, $course, $coursecontext) {
- $url = new moodle_url('/admin/tool/devcourse/index.php');
- $devcoursenode = navigation_node::create('Development course', $url, navigation_node::TYPE_CUSTOM, 'Dev course', 'devcourse');
- $navigation->add_node($devcoursenode);
- }
- function gradeimporter_supports($feature) {
- switch ($feature) {
- case FEATURE_MOD_ARCHETYPE:
- return MOD_ARCHETYPE_RESOURCE;
- case FEATURE_GROUPS:
- return false;
- case FEATURE_GROUPINGS:
- return false;
- case FEATURE_MOD_INTRO:
- return true;
- case FEATURE_COMPLETION_TRACKS_VIEWS:
- return true;
- case FEATURE_GRADE_HAS_GRADE:
- return false;
- case FEATURE_GRADE_OUTCOMES:
- return false;
- case FEATURE_BACKUP_MOODLE2:
- return true;
- default:
- return null;
- }
- }
- function gradeimporter_add_instance($data, $mform) {
-
- global $DB;
- $data->timemodified = time();
- $data->id = $DB->insert_record("gradeimporter", $data);
- return $data->id;
- }
- function gradeimporter_update_instance($data) {
-
- global $DB;
- $data->timemodified = time();
- $data->id = $data->instance;
- return $DB->update_record('gradeimporter', $data);
- }
- function gradeimporter_delete_instance($data) {
-
- global $DB;
- if (!$data = $DB->get_record('gradeimporter', array('id' => $id))) {
- return false;
- }
- $cm = get_coursemodule_from_instance('gradeimporter', $gradeimporter->id);
- $context = context_module::instance($cm->id);
-
- $fs = get_file_storage();
- $fs->delete_area_files($context->id, 'submissionfiles');
-
- $DB->delete_records('gradeimporter_submission', array('gradeimporterid' => $gradeimporter->id));
- $DB->delete_records('gradeimporter_feedback', array('gradeimporterid' => $gradeimporter->id));
- $DB->delete_records('gradeimporter_submissiontype', array('gradeimporterid' => $gradeimporter->id));
-
- $DB->delete_records('gradeimporter', array('id' => $id));
- return true;
- }
- function mod_gradeimporter_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
-
- if ($context->contextlevel != CONTEXT_MODULE) {
- return false;
- }
-
- if ($filearea !== 'submissionfiles') {
- return false;
- }
-
-
- require_login($course, true, $cm);
-
- if (!has_capability('mod/gradeimporter:view', $context)) {
- return false;
- }
-
- $itemid = array_shift($args);
-
-
-
- $filename = array_pop($args);
- if (!$args) {
- $filepath = '/';
- } else {
- $filepath = '/'.implode('/', $args).'/';
- }
-
- $fs = get_file_storage();
- $file = $fs->get_file($context->id, 'mod_gradeimporter', $filearea, $itemid, $filepath, $filename);
- if (!$file) {
- echo "didnt find the file";
- return false;
- }
-
- send_stored_file($file, 86400, 0, $forcedownload, $options);
- }
|