Added region_uses_dock method which returns true if any blocks use the dock

From: Brandon Turner <brandont@thinkwell.com>

This method complements the existing region_completed_docked method.  It allows
themes to check if a dock will be rendered.
---
 lib/blocklib.php |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/lib/blocklib.php b/lib/blocklib.php
index cd3e7c5..585b86b 100644
--- a/lib/blocklib.php
+++ b/lib/blocklib.php
@@ -421,6 +421,7 @@ class block_manager {
      *
      * @param string $region
      * @return bool True if all of the blocks within that region are docked
+     * @see region_uses_dock
      */
     public function region_completely_docked($region, $output) {
         if (!$this->page->theme->enable_dock) {
@@ -436,6 +437,29 @@ class block_manager {
         return true;
     }
 
+    /**
+     * Checks to see whether any of the blocks within the given regions are docked
+     *
+     * @param array|string $regions array of regions (or single region)
+     * @return bool True if any of the blocks within that region are docked
+     * @see region_completely_docked
+     */
+    public function region_uses_dock($regions, $output) {
+        if (!$this->page->theme->enable_dock) {
+            return false;
+        }
+        $this->check_is_loaded();
+        foreach((array)$regions as $region) {
+            $this->ensure_content_created($region, $output);
+            foreach($this->visibleblockcontent[$region] as $instance) {
+                if(!empty($instance->content) && get_user_preferences('docked_block_instance_'.$instance->blockinstanceid, 0)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
 /// Actions ====================================================================
 
     /**
