Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/blocklib.php File Reference

Go to the source code of this file.

Data Structures

class  block_not_on_page_exception
class  block_manager

Namespaces

namespace  core

Enumerations

enum  BLOCK_MOVE_LEFT
enum  BLOCK_MOVE_RIGHT
enum  BLOCK_MOVE_UP
enum  BLOCK_MOVE_DOWN
enum  BLOCK_CONFIGURE
enum  BLOCK_POS_LEFT
enum  BLOCK_POS_RIGHT
enum  BLOCKS_PINNED_TRUE
enum  BLOCKS_PINNED_FALSE
enum  BLOCKS_PINNED_BOTH
enum  BUI_CONTEXTS_FRONTPAGE_ONLY
enum  BUI_CONTEXTS_FRONTPAGE_SUBS
enum  BUI_CONTEXTS_ENTIRE_SITE
enum  BUI_CONTEXTS_CURRENT
enum  BUI_CONTEXTS_CURRENT_SUBS

Functions

 block_method_result ($blockname, $method, $param=NULL)
 Helper functions for working with block classes ============================.
 block_instance ($blockname, $instance=NULL, $page=NULL)
 block_load_class ($blockname)
 matching_page_type_patterns ($pagetype)
 generate_page_type_patterns ($pagetype, $parentcontext=null, $currentcontext=null)
 default_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 my_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 mod_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 block_add_block_ui ($page, $output)
 Functions update the blocks if required by the request parameters ==========.
 blocks_get_missing (&$page, &$blockmanager)
 blocks_remove_inappropriate ($course)
 blocks_name_allowed_in_format ($name, $pageformat)
 blocks_delete_instance ($instance, $nolongerused=false, $skipblockstables=false)
 blocks_delete_all_for_context ($contextid)
 blocks_set_visibility ($instance, $page, $newvisibility)
 blocks_delete_all_on_page ($pagetype, $pageid)
 blocks_repopulate_page ($page)
 blocks_get_record ($blockid=NULL, $notusedanymore=false)
 blocks_find_block ($blockid, $blocksarray)
 blocks_parse_default_blocks_list ($blocksstr)
 blocks_get_default_site_course_blocks ()
 blocks_add_default_course_blocks ($course)
 blocks_add_default_system_blocks ()

Enumeration Type Documentation

Definition at line 38 of file blocklib.php.

Definition at line 37 of file blocklib.php.

#@+

Deprecated:
since Moodle 2.0. No longer used.

Definition at line 34 of file blocklib.php.

Definition at line 35 of file blocklib.php.

Definition at line 36 of file blocklib.php.

#@- #@+ Default names for the block regions in the standard theme.

Definition at line 44 of file blocklib.php.

Definition at line 45 of file blocklib.php.

Definition at line 53 of file blocklib.php.

Definition at line 52 of file blocklib.php.

#@- #@+

Deprecated:
since Moodle 2.0. No longer used.

Definition at line 51 of file blocklib.php.

Definition at line 60 of file blocklib.php.

Definition at line 61 of file blocklib.php.

Definition at line 58 of file blocklib.php.

#@-

Definition at line 56 of file blocklib.php.

Definition at line 57 of file blocklib.php.


Function Documentation

block_add_block_ui ( page,
output 
)

Functions update the blocks if required by the request parameters ==========.

Return a block_contents representing the add a new block UI, if this user is allowed to see it.

Returns:
block_contents an appropriate block_contents, or null if the user cannot add any blocks here.

Definition at line 1759 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

block_instance ( blockname,
instance = NULL,
page = NULL 
)

Creates a new instance of the specified block class.

Parameters:
string$blocknamethe name of the block.
$instanceblock_instances DB table row (optional).
moodle_page$pagethe page this block is appearing on.
Returns:
block_base the requested block instance.

Definition at line 1520 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

block_load_class ( blockname)

Load the block class for a particular type of block.

Parameters:
string$blocknamethe name of the block.
Returns:
boolean success or failure.

Definition at line 1542 of file blocklib.php.

Here is the caller graph for this function:

block_method_result ( blockname,
method,
param = NULL 
)

Helper functions for working with block classes ============================.

Call a class method (one that does not require a block instance) on a block class.

Parameters:
string$blocknamethe name of the block.
string$methodthe method name.
array$paramparameters to pass to the method.
Returns:
mixed whatever the method returns.

Definition at line 1505 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Add the default blocks to a course.

Parameters:
object$coursea course object.

Definition at line 2075 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Add the default system-context blocks. E.g. the admin tree.

Definition at line 2123 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Delete all the blocks that belong to a particular context.

Parameters:
int$contextidthe context id.

Definition at line 1898 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blocks_delete_all_on_page ( pagetype,
pageid 
)
Deprecated:
since 2.0 Delete all the blocks from a particular page.
Parameters:
string$pagetypethe page type.
integer$pageidthe page id.
Returns:
bool success or failure.

Definition at line 1947 of file blocklib.php.

Here is the call graph for this function:

blocks_delete_instance ( instance,
nolongerused = false,
skipblockstables = false 
)

Delete a block, and associated data.

Parameters:
object$instancea row from the block_instances table
bool$nolongerusedlegacy parameter. Not used, but kept for backwards compatibility.
bool$skipblockstablesfor internal use only. Makes
See also:
blocks_delete_all_for_context() more efficient.

Definition at line 1878 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blocks_find_block ( blockid,
blocksarray 
)

Find a given block by its blockid within a provide array

Parameters:
int$blockid
array$blocksarray
Returns:
bool|object Instance if found else false

Definition at line 2011 of file blocklib.php.

Returns:
array the blocks that should be added to the site course by default.

Definition at line 2057 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blocks_get_missing ( &$  page,
&$  blockmanager 
)
Deprecated:
since Moodle 2.0 - use $page->blocks->get_addable_blocks();

This function returns an array with the IDs of any blocks that you can add to your page. Parameters are passed by reference for speed; they are not modified at all.

Parameters:
$pagethe page object.
$blockmanagerNot used.
Returns:
array of block type ids.

Definition at line 1802 of file blocklib.php.

Here is the call graph for this function:

blocks_get_record ( blockid = NULL,
notusedanymore = false 
)

Get the block record for a particular blockid - that is, a particular type os block.

Parameters:
$intblockid block type id. If null, an array of all block types is returned.
bool$notusedanymoreNo longer used.
Returns:
array|object row from block table, or all rows.

Definition at line 1992 of file blocklib.php.

Here is the caller graph for this function:

blocks_name_allowed_in_format ( name,
pageformat 
)

Check that a given name is in a permittable format

Parameters:
string$name
string$pageformat
Returns:
bool

Definition at line 1850 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Parse a list of default blocks. See config-dist for a description of the format.

Parameters:
string$blocksstr
Returns:
array

Definition at line 2036 of file blocklib.php.

Here is the caller graph for this function:

Actually delete from the database any blocks that are currently on this page, but which should not be there according to blocks_name_allowed_in_format.

Todo:
Write/Fix this function. Currently returns immediately
Parameters:
$course

Definition at line 1819 of file blocklib.php.

Here is the caller graph for this function:

Dispite what this function is called, it seems to be mostly used to populate the default blocks when a new course (or whatever) is created.

Deprecated:
since 2.0
Parameters:
object$pagethe page to add default blocks to.
Returns:
boolean success or failure.

If the site override has been defined, it is the only valid one.

Definition at line 1965 of file blocklib.php.

Here is the call graph for this function:

blocks_set_visibility ( instance,
page,
newvisibility 
)

Set a block to be visible or hidden on a particular page.

Parameters:
object$instancea row from the block_instances, preferably LEFT JOINed with the block_positions table as return by block_manager.
moodle_page$pagethe back to set the visibility with respect to.
integer$newvisibility1 for visible, 0 for hidden.

Definition at line 1917 of file blocklib.php.

Here is the caller graph for this function:

default_page_type_list ( pagetype,
parentcontext = null,
currentcontext = null 
)

Generates a default page type list when a more appropriate callback cannot be decided upon.

Parameters:
string$pagetype
stdClass$parentcontext
stdClass$currentcontext
Returns:
array

Definition at line 1694 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

generate_page_type_patterns ( pagetype,
parentcontext = null,
currentcontext = null 
)

Given a specific page type, parent context and currect context, return all the page type patterns that might be used by this block.

Parameters:
string$pagetypefor example 'course-view-weeks' or 'mod-quiz-view'.
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block
Returns:
array an array of all the page type patterns that might match this page type.

Definition at line 1602 of file blocklib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

matching_page_type_patterns ( pagetype)

Given a specific page type, return all the page type patterns that might match it.

Parameters:
string$pagetypefor example 'course-view-weeks' or 'mod-quiz-view'.
Returns:
array an array of all the page type patterns that might match this page type.

Definition at line 1575 of file blocklib.php.

Here is the caller graph for this function:

mod_page_type_list ( pagetype,
parentcontext = null,
currentcontext = null 
)

Generates the page type list for a module by either locating and using the modules callback or by generating a default list.

Parameters:
string$pagetype
stdClass$parentcontext
stdClass$currentcontext
Returns:
array

Definition at line 1735 of file blocklib.php.

my_page_type_list ( pagetype,
parentcontext = null,
currentcontext = null 
)

Generates the page type list for the my moodle page

Parameters:
string$pagetype
stdClass$parentcontext
stdClass$currentcontext
Returns:
array

Definition at line 1722 of file blocklib.php.

 All Data Structures Namespaces Files Functions Variables Enumerations