Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Public Member Functions | |
_load_instance ($instance, $page) | |
Set up a particular instance of this class given data from the block_insances table and the current page. More... | |
_self_test () | |
Tests if this block has been implemented correctly. More... | |
applicable_formats () | |
Set the applicable formats for this block to all. More... | |
before_delete () | |
Function that can be overridden to do extra cleanup before the database tables are deleted. More... | |
config_save ($data) | |
Default behavior: save all variables as $CFG properties You don't need to override this if you 're satisfied with the above. More... | |
get_aria_role () | |
Returns the role that best describes the navigation block... More... | |
get_config_for_external () | |
Return the plugin config settings for external functions. More... | |
get_content () | |
Gets the content for this block by grabbing it from $this->page. More... | |
get_content_for_external ($output) | |
Return an object containing all the block content to be returned by external functions. More... | |
get_content_for_output ($output) | |
Return a block_contents object representing the full contents of this block. More... | |
get_content_type () | |
Returns the class $content_type var value. More... | |
get_required_javascript () | |
Gets Javascript that may be required for navigation. | |
get_title () | |
Returns the class $title var value. More... | |
has_config () | |
Subclasses should override this and return true if the subclass block has a settings.php file. More... | |
hide_header () | |
Default return is false - header will be shown. More... | |
html_attributes () | |
Returns the attributes to set for this block. More... | |
init () | |
Set the initial properties for the block. | |
instance_allow_config () | |
Allow the user to configure a block instance. More... | |
instance_allow_multiple () | |
All multiple instances of this block. More... | |
instance_can_be_collapsed () | |
If overridden and set to false by the block it will not be collapsible. More... | |
instance_can_be_docked () | |
Find out if an instance can be docked. More... | |
instance_can_be_hidden () | |
The navigation block cannot be hidden by default as it is integral to the navigation of Moodle. More... | |
instance_config_commit ($nolongerused=false) | |
Replace the instance's configuration data with those currently in $this->config;. | |
instance_config_save ($data, $nolongerused=false) | |
Serialize and store config data. | |
instance_copy ($fromid) | |
Copy any block-specific data when copying to a new block instance. More... | |
instance_create () | |
Do any additional initialization you may need at the time a new block instance is created. More... | |
instance_delete () | |
Delete everything related to this instance if you have been using persistent storage other than the configdata field. More... | |
is_empty () | |
Returns true or false, depending on whether this block has any content to display and whether the user has permission to view the block. More... | |
name () | |
Returns the block name, as present in the class name, the database, the block directory, etc etc. More... | |
refresh_content () | |
First sets the current value of $this->content to NULL then calls the block's get_content() function to set its value back. More... | |
specialization () | |
This function is called on your subclass right after an instance is loaded Use this function to act on instance data just after it's loaded and before anything else is done For instance: if your block will have different title's depending on location (site, course, blog, etc) | |
trim (navigation_node $node, $mode=1, $long=50, $short=25, $recurse=true) | |
Trims the text and shorttext properties of this node and optionally all of its children. More... | |
user_can_addto ($page) | |
Allows the block class to have a say in the user's ability to create new instances of this block. More... | |
user_can_edit () | |
Allows the block class to have a say in the user's ability to edit (i.e., configure) blocks of this type. More... | |
Static Public Member Functions | |
static | comment_add (&$comments, $options) |
static | comment_display ($comments, $options) |
static | comment_permissions ($options) |
static | comment_template ($options) |
@callback callback functions for comments api | |
static | comment_url ($options) |
static | get_extra_capabilities () |
Public Attributes | |
string | $arialabel = NULL |
The name of the block to be displayed in the block title area if the title is empty. More... | |
string | $blockname = null |
The name of the block. | |
stdObject | $config = NULL |
An object containing the instance configuration information for the current instance of this block. More... | |
stdObject | $content = NULL |
An object to contain the information to be displayed in the block. More... | |
int | $content_type = BLOCK_TYPE_TEXT |
The type of content that this block creates. More... | |
stdClass | $context = NULL |
This blocks's context. | |
int | $cron = NULL |
How often the cronjob should run, 0 if not at all. More... | |
block | $instance = NULL |
The initialized instance of this block object. More... | |
moodle_page | $page = NULL |
The page that this block is appearing on. | |
string | $str |
Internal var for storing/caching translated strings $str. | |
string | $title = NULL |
The title of the block to be displayed in the block title area. More... | |
int const | TRIM_CENTER = 3 |
Trim characters from the center. | |
int const | TRIM_LEFT = 2 |
Trim characters from the left. | |
int const | TRIM_RIGHT = 1 |
Trim characters from the right. | |
Static Public Attributes | |
static int | $navcount |
This allows for multiple navigation trees. | |
Protected Member Functions | |
formatted_contents ($output) | |
Convert the contents of the block to HTML. More... | |
get_navigation () | |
Returns the navigation. More... | |
trim_center ($string, $length) | |
Truncate a string in the center. More... | |
trim_left ($string, $length) | |
Truncate a string from the left. More... | |
trim_right ($string, $length) | |
Truncate a string from the right. More... | |
Protected Attributes | |
bool | $contentgenerated = false |
A switch to indicate whether content has been generated or not. | |
bool null | $docked = null |
variable for checking if the block is docked | |
|
inherited |
Set up a particular instance of this class given data from the block_insances table and the current page.
(See block_manager::load_blocks().)
stdClass | $instance | data from block_insances, block_positions, etc. |
moodle_page | $the | page this block is on. |
|
inherited |
Tests if this block has been implemented correctly.
Also, $errors isn't used right now
boolean |
block_navigation::applicable_formats | ( | ) |
Set the applicable formats for this block to all.
array |
Reimplemented from block_base.
|
inherited |
Function that can be overridden to do extra cleanup before the database tables are deleted.
(Called once per block, not per instance!)
Reimplemented in block_myprofile.
|
inherited |
Default behavior: save all variables as $CFG properties You don't need to override this if you 're satisfied with the above.
|
protectedinherited |
Convert the contents of the block to HTML.
This is used by block base classes like block_list to convert the structured $this->content->list and $this->content->icons arrays to HTML. So, in most blocks, you probaby want to override the get_contents() method, which generates that structured representation of the contents.
$output | The core_renderer to use when generating the output. |
string | the HTML that should appearn in the body of the block. |
Reimplemented in block_tree, and block_list.
block_navigation::get_aria_role | ( | ) |
Returns the role that best describes the navigation block...
'navigation'
string | 'navigation' |
Reimplemented from block_base.
block_navigation::get_config_for_external | ( | ) |
Return the plugin config settings for external functions.
stdClass | the configs for both the block instance and plugin |
Reimplemented from block_base.
block_navigation::get_content | ( | ) |
Gets the content for this block by grabbing it from $this->page.
object::$this-,>content |
Reimplemented from block_base.
|
inherited |
Return an object containing all the block content to be returned by external functions.
If your block is returning formatted content or provide files for download, you should override this method to use the external_format_text, external_format_string functions for formatting or external_util::get_area_files for files.
core_renderer | $output | the rendered used for output |
stdClass | object containing the block title, central content, footer and linked files (if any). |
Reimplemented in block_html.
|
inherited |
Return a block_contents object representing the full contents of this block.
This internally calls ->get_content(), and then adds the editing controls etc.
You probably should not override this method, but instead override }, formatted_contents()} or get_content()}, * hide_header()}, (get_edit_controls), etc.
block_contents | a representation of the block, for rendering. |
|
inherited |
Returns the class $content_type var value.
Intentionally doesn't check if content_type is set. This is already done in _self_test()
string::$this-,>content_type |
|
protected |
Returns the navigation.
navigation_node | The navigation object to display |
|
inherited |
Returns the class $title var value.
Intentionally doesn't check if a title is set. This is already done in _self_test()
string::$this-,>title |
|
inherited |
Subclasses should override this and return true if the subclass block has a settings.php file.
boolean |
Reimplemented in block_tag_youtube, block_starredcourses, block_section_links, block_rss_client, block_recentlyaccessedcourses, block_online_users, block_myprofile, block_myoverview, block_mnet_hosts, block_html, block_course_list, block_blog_tags, block_blog_menu, block_badges, and block_activity_results.
|
inherited |
Default return is false - header will be shown.
boolean |
Reimplemented in block_course_summary.
block_navigation::html_attributes | ( | ) |
Returns the attributes to set for this block.
This function returns an array of HTML attributes for this block including the defaults. block_tree::html_attributes() is used to get the default arguments and then we check whether the user has enabled hover expansion and add the appropriate hover class if it has.
array | An array of HTML attributes |
Reimplemented from block_base.
block_navigation::instance_allow_config | ( | ) |
Allow the user to configure a block instance.
bool | Returns true |
Reimplemented from block_base.
block_navigation::instance_allow_multiple | ( | ) |
All multiple instances of this block.
bool | Returns false |
Reimplemented from block_base.
|
inherited |
If overridden and set to false by the block it will not be collapsible.
bool |
block_navigation::instance_can_be_docked | ( | ) |
Find out if an instance can be docked.
bool | true or false depending on whether the instance can be docked or not. |
Reimplemented from block_base.
block_navigation::instance_can_be_hidden | ( | ) |
The navigation block cannot be hidden by default as it is integral to the navigation of Moodle.
false |
Reimplemented from block_base.
|
inherited |
Copy any block-specific data when copying to a new block instance.
int | $fromid | the id number of the block instance to copy from |
boolean |
Reimplemented in block_html.
|
inherited |
Do any additional initialization you may need at the time a new block instance is created.
boolean |
|
inherited |
Delete everything related to this instance if you have been using persistent storage other than the configdata field.
boolean |
Reimplemented in block_html.
|
inherited |
Returns true or false, depending on whether this block has any content to display and whether the user has permission to view the block.
boolean |
Reimplemented in block_list.
|
inherited |
Returns the block name, as present in the class name, the database, the block directory, etc etc.
string |
|
inherited |
First sets the current value of $this->content to NULL then calls the block's get_content() function to set its value back.
stdObject |
block_navigation::trim | ( | navigation_node | $node, |
$mode = 1 , |
|||
$long = 50 , |
|||
$short = 25 , |
|||
$recurse = true |
|||
) |
Trims the text and shorttext properties of this node and optionally all of its children.
navigation_node | $node | |
int | $mode | One of navigation_node::TRIM_* |
int | $long | The length to trim text to |
int | $short | The length to trim shorttext to |
bool | $recurse | Recurse all children |
|
protected |
Truncate a string in the center.
string | $string | The string to truncate |
int | $length | The length to truncate to |
string | The truncated string |
|
protected |
Truncate a string from the left.
string | $string | The string to truncate |
int | $length | The length to truncate to |
string | The truncated string |
|
protected |
Truncate a string from the right.
string | $string | The string to truncate |
int | $length | The length to truncate to |
string | The truncated string |
|
inherited |
Allows the block class to have a say in the user's ability to create new instances of this block.
The framework has first say in whether this will be allowed (e.g., no adding allowed unless in edit mode) but if the framework does allow it, the block can still decide to refuse. This function has access to the complete page object, the creation related to which is being determined.
moodle_page | $page |
boolean |
|
inherited |
Allows the block class to have a say in the user's ability to edit (i.e., configure) blocks of this type.
The framework has first say in whether this will be allowed (e.g., no editing allowed unless in edit mode) but if the framework does allow it, the block can still decide to refuse.
boolean |
|
inherited |
The name of the block to be displayed in the block title area if the title is empty.
arialabel
|
inherited |
An object containing the instance configuration information for the current instance of this block.
$config
|
inherited |
An object to contain the information to be displayed in the block.
$content
|
inherited |
The type of content that this block creates.
Currently support options - BLOCK_TYPE_LIST, BLOCK_TYPE_TEXT $content_type
|
inherited |
How often the cronjob should run, 0 if not at all.
$cron
|
inherited |
The initialized instance of this block object.
$instance
|
inherited |
The title of the block to be displayed in the block title area.
$title