MDL-34466 mod_folder Replace all instances of get_context_instance() with respective context_XXXX class in mod/folder

This commit is contained in:
David Monllao 2012-07-26 14:53:42 +08:00
parent 6536217c78
commit c068b41bed
4 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ require_once("$CFG->dirroot/repository/lib.php");
$id = required_param('id', PARAM_INT); // Course module ID
$cm = get_coursemodule_from_id('folder', $id, 0, false, MUST_EXIST);
$context = get_context_instance(CONTEXT_MODULE, $cm->id, MUST_EXIST);
$context = context_module::instance($cm->id, MUST_EXIST);
$folder = $DB->get_record('folder', array('id'=>$cm->instance), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);

View File

@ -98,7 +98,7 @@ function folder_add_instance($data, $mform) {
// we need to use context now, so we need to make sure all needed info is already in db
$DB->set_field('course_modules', 'instance', $data->id, array('id'=>$cmid));
$context = get_context_instance(CONTEXT_MODULE, $cmid);
$context = context_module::instance($cmid);
if ($draftitemid) {
file_save_draft_area_files($draftitemid, $context->id, 'mod_folder', 'content', 0, array('subdirs'=>true));
@ -125,7 +125,7 @@ function folder_update_instance($data, $mform) {
$DB->update_record('folder', $data);
$context = get_context_instance(CONTEXT_MODULE, $cmid);
$context = context_module::instance($cmid);
if ($draftitemid = file_get_submitted_draft_itemid('files')) {
file_save_draft_area_files($draftitemid, $context->id, 'mod_folder', 'content', 0, array('subdirs'=>true));
}
@ -334,7 +334,7 @@ function folder_page_type_list($pagetype, $parentcontext, $currentcontext) {
function folder_export_contents($cm, $baseurl) {
global $CFG, $DB;
$contents = array();
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$context = context_module::instance($cm->id);
$folder = $DB->get_record('folder', array('id'=>$cm->instance), '*', MUST_EXIST);
$fs = get_file_storage();

View File

@ -98,7 +98,7 @@ class folder_tree implements renderable {
$this->cm = $cm;
$this->course = $course;
$this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
$this->context = context_module::instance($cm->id);
$fs = get_file_storage();
$this->dir = $fs->get_area_tree($this->context->id, 'mod_folder', 'content', 0);
}

View File

@ -44,7 +44,7 @@ if ($f) { // Two ways to specify the module
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$context = context_module::instance($cm->id);
require_capability('mod/folder:view', $context);
add_to_log($course->id, 'folder', 'view', 'view.php?id='.$cm->id, $folder->id, $cm->id);