Permalink
Browse files

MDL-34467 imscp: Repalce all instances of get_context_instanc() with …

…respective context_XXX::instance()
  • Loading branch information...
1 parent e0a91e1 commit b631c40835be1e5d01a06eae3f720a2edf4c336a @ankitagarwal ankitagarwal committed Jul 27, 2012
Showing with 6 additions and 6 deletions.
  1. +2 −2 mod/imscp/lib.php
  2. +2 −2 mod/imscp/locallib.php
  3. +1 −1 mod/imscp/mod_form.php
  4. +1 −1 mod/imscp/view.php
View
@@ -101,7 +101,7 @@ function imscp_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);
$imscp = $DB->get_record('imscp', array('id'=>$data->id), '*', MUST_EXIST);
if ($filename = $mform->get_new_filename('package')) {
@@ -136,7 +136,7 @@ function imscp_update_instance($data, $mform) {
$DB->update_record('imscp', $data);
- $context = get_context_instance(CONTEXT_MODULE, $cmid);
+ $context = context_module::instance($cmid);
$imscp = $DB->get_record('imscp', array('id'=>$data->id), '*', MUST_EXIST);
if ($filename = $mform->get_new_filename('package')) {
View
@@ -35,7 +35,7 @@ function imscp_print_content($imscp, $cm, $course) {
$items = unserialize($imscp->structure);
$first = reset($items);
- $context = get_context_instance(CONTEXT_MODULE, $cm->id);
+ $context = context_module::instance($cm->id);
$urlbase = "$CFG->wwwroot/pluginfile.php";
$path = '/'.$context->id.'/mod_imscp/content/'.$imscp->revision.'/'.$first['href'];
$firsturl = file_encode_url($urlbase, $path, false);
@@ -61,7 +61,7 @@ function imscp_print_content($imscp, $cm, $course) {
function imscp_htmllize_item($item, $imscp, $cm) {
global $CFG;
- $context = get_context_instance(CONTEXT_MODULE, $cm->id);
+ $context = context_module::instance($cm->id);
$urlbase = "$CFG->wwwroot/pluginfile.php";
$path = '/'.$context->id.'/mod_imscp/content/'.$imscp->revision.'/'.$item['href'];
$url = file_encode_url($urlbase, $path, false);
View
@@ -70,7 +70,7 @@ function validation($data, $files) {
return $errors;
}
- $usercontext = get_context_instance(CONTEXT_USER, $USER->id);
+ $usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
if (!$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data['package'], 'id', false)) {
View
@@ -43,7 +43,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/imscp:view', $context);
add_to_log($course->id, 'imscp', 'view', 'view.php?id='.$cm->id, $imscp->id, $cm->id);

0 comments on commit b631c40

Please sign in to comment.