/**
 * Public API to page locks: determine
 * if the page lock is visible - should
 * only be called on pages that do
 * have a lock
 *
 * @param object $page The page to test
 * @return boolean
 **/
function page_is_visible_lock($page)
{
    global $CFG;
    static $cache = array();
    static $include = false;
    if (!isset($cache[$page->id])) {
        if (!empty($page->locks)) {
            if (!$include) {
                require_once $CFG->dirroot . '/course/format/page/plugin/lock.php';
                $include = true;
            }
            $cache[$page->id] = format_page_lock::is_visible_lock($page);
        } else {
            $cache[$page->id] = true;
        }
    }
    return $cache[$page->id];
}