Auto get first available context on viewing
This commit is contained in:
parent
793ecd0756
commit
780765ff79
|
@ -32,11 +32,11 @@ elseif($contextid > 0)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If no context is selected, find the first available one
|
// If no context is selected, find the first available one
|
||||||
$available_contexts = courseservice::list_used_categories("view");
|
$available_contexts = courseservice::list_accessible_categories_with_usage("view");
|
||||||
$contextid=1; // fallback to system context
|
$contextid=1; // fallback to system context
|
||||||
foreach($available_contexts as $ctx){
|
foreach($available_contexts as $ctx){
|
||||||
if($ctx["studyplancount"] > 0){
|
if($ctx->count > 0){
|
||||||
$contextid = $ctx["context_id"];
|
$contextid = $ctx->ctxid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user