Skip to content

Commit

Permalink
More information for context-info
Browse files Browse the repository at this point in the history
  • Loading branch information
tmuras committed May 15, 2017
1 parent 2dddde1 commit 70748c5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Moosh/Command/Moodle27/Info/DevContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ public function execute()

// Get all contexts under given one
$context = \context::instance_by_id($contextid, MUST_EXIST);
var_dump($context);
echo $context->get_context_name();

echo $this->context_info($contextid);
echo "\n";
//var_dump($context);
//echo $context->get_context_name();
return ;

$sql = "SELECT * FROM {context} WHERE path LIKE '$contextpath/%'";
Expand All @@ -70,8 +73,14 @@ private function context_info($contextid)
//var_dump($context);
if (is_a($context, "context_module")) {
/** @var \context_module $context */
$out .= "$contextid, module: " . $context->get_context_name() ;
}
$out .= "$contextid, module: " . $context->get_context_name() . "\n";
$coursemodule = $DB->get_record('course_modules', ['id'=>$context->instanceid]);
$out .= "Course: {$coursemodule->module}\n";
$out .= "Section: {$coursemodule->section}\n";
$out .= $context->get_url() . "\n";
} else {
$out .= $context->get_context_name();
}


return $out;
Expand Down

0 comments on commit 70748c5

Please sign in to comment.