Permalink
Browse files

MDL-34466 mod_folder Replace all instances of get_context_instance() …

…with respective context_XXXX class in mod/folder
  • Loading branch information...
1 parent 6536217 commit c068b41bede7a8845ee0d99c018bb51b7165032b @dmonllao dmonllao committed Jul 26, 2012
Showing with 6 additions and 6 deletions.
  1. +1 −1 mod/folder/edit.php
  2. +3 −3 mod/folder/lib.php
  3. +1 −1 mod/folder/renderer.php
  4. +1 −1 mod/folder/view.php
View
@@ -32,7 +32,7 @@
$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
@@ -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
@@ -98,7 +98,7 @@ public function __construct($folder, $cm, $course) {
$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
@@ -44,7 +44,7 @@
$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);

0 comments on commit c068b41

Please sign in to comment.