From: martinlanghoff Date: Wed, 19 Sep 2007 07:56:14 +0000 (+0000) Subject: accesslib: build_context_path() now sets path/depth for other blocks X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=99be2a7fad15ac09b095a3773ce8e0297f689a5c;p=moodle.git accesslib: build_context_path() now sets path/depth for other blocks Blocks not on the coursepage should have their context "hanging" from the site context. get_context_instance() was doing this correctly, but not build_context_path(). --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 26a12c8f1b..539de87ac0 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4464,7 +4464,7 @@ function build_context_path($force=false) { $emptyclause "; execute_sql($sql, false); - // Blocks - non-pinned only + // Blocks - non-pinned course-view only $sql = "UPDATE {$CFG->prefix}context SET depth=it.pdepth+1, path=" . sql_concat('it.ppath', "'/'", 'id') . " FROM (SELECT bi.id AS instanceid, pctx.path AS ppath, @@ -4480,6 +4480,18 @@ function build_context_path($force=false) { $emptyclause "; execute_sql($sql, false); + // Blocks - others + $sql = "UPDATE {$CFG->prefix}context + SET depth=2, path=" . sql_concat("'$base/'", 'id') . " + FROM (SELECT bi.id AS instanceid + FROM {$CFG->prefix}block_instance bi + WHERE bi.pagetype != 'course-view' + ) AS it + WHERE contextlevel=".CONTEXT_BLOCK." + AND {$CFG->prefix}context.instanceid=it.instanceid + $emptyclause "; + execute_sql($sql, false); + // User $sql = "UPDATE {$CFG->prefix}context SET depth=2, path=".sql_concat("'$base/'", 'id')."