See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
Core global functions for Blog.
Copyright: | 2009 Nicolas Connault |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1308 lines (52 kb) |
Included or required: | 2 times |
Referenced: | 8 times |
Includes or requires: | 0 files |
blog_user_can_edit_entry($blogentry) X-Ref |
User can edit a blog entry if this is their own blog entry and they have the capability moodle/blog:create, or if they have the capability moodle/blog:manageentries. This also applies to deleting of entries. |
blog_user_can_view_user_entry($targetuserid, $blogentry=null) X-Ref |
Checks to see if a user can view the blogs of another user. Only blog level is checked here, the capabilities are enforced in blog/index.php |
blog_remove_associations_for_user($userid) X-Ref |
remove all associations for the blog entries of a particular user param: int userid - id of user whose blog associations will be deleted |
blog_remove_associations_for_course($courseid) X-Ref |
remove all associations for the blog entries of a particular course param: int courseid - id of user whose blog associations will be deleted |
blog_remove_associations_for_module($modcontextid) X-Ref |
Remove module associated blogs and blog tag instances. param: int $modcontextid Module context ID. |
blog_sync_external_entries($externalblog) X-Ref |
Given a record in the {blog_external} table, checks the blog's URL for new entries not yet copied into Moodle. Also attempts to identify and remove deleted blog entries param: object $externalblog return: boolean False if the Feed is invalid |
blog_delete_external_entries($externalblog) X-Ref |
Given an external blog object, deletes all related blog entries from the post table. NOTE: The external blog's id is saved as post.content, a field that is not oterhwise used by blog entries. param: object $externablog |
blog_is_enabled_for_user() X-Ref |
This function checks that blogs are enabled, and that the user can see blogs at all return: bool |
blog_get_all_options(moodle_page $page, stdClass $userid = null) X-Ref |
This function gets all of the options available for the current user in respect to blogs. It loads the following if applicable: - Module options {@see blog_get_options_for_module} - Course options {@see blog_get_options_for_course} - User specific options {@see blog_get_options_for_user} - General options (BLOG_LEVEL_GLOBAL) param: moodle_page $page The page to load for (normally $PAGE) param: stdClass $userid Load for a specific user return: array An array of options organised by type. |
blog_get_options_for_user(stdClass $user=null) X-Ref |
Get all of the blog options that relate to the passed user. If no user is passed the current user is assumed. param: stdClass $user return: array The array of options for the requested user |
blog_get_options_for_course(stdClass $course, stdClass $user=null) X-Ref |
Get the blog options that relate to the given course for the given user. param: stdClass $course The course to load options for param: stdClass $user The user to load options for null == current user return: array The array of options |
blog_get_options_for_module($module, $user=null) X-Ref |
Get the blog options relating to the given module for the given user param: stdClass|cm_info $module The module to get options for param: stdClass $user The user to get options for null == currentuser return: array |
blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=null, $tag=null, $modid=null, $entryid=null,$search = null) X-Ref |
This function encapsulates all the logic behind the complex navigation, titles and headings of the blog listing page, depending on URL params. It looks at URL params and at the current context level. It builds and returns an array containing: 1. heading: The heading displayed above the blog entries 2. stradd: The text to be used as the "Add entry" link 3. strview: The text to be used as the "View entries" link 4. url: The moodle_url object used as the base for add and view links 5. filters: An array of parameters used to filter blog listings. Used by index.php and the Recent blogs block All other variables are set directly in $PAGE It uses the current URL to build these variables. A number of mutually exclusive use cases are used to structure this function. param: int $courseid course id the the blog is associated to (can be null). param: int $groupid group id to filter blogs I can see (can be null) param: int $userid blog author id (can be null) param: int $tagid tag id to filter (can be null) param: string $tag tag name to filter (can be null) param: int $modid module id the blog is associated to (can be null). param: int $entryid blog entry id to filter(can be null) param: string $search string to search (can be null) return: array |
blog_get_associated_count($courseid, $cmid=null) X-Ref |
Shortcut function for getting a count of blog entries associated with a course or a module param: int $courseid The ID of the course param: int $cmid The ID of the course_modules return: string The number of associated entries |
blog_comment_permissions($commentparam) X-Ref |
Running addtional permission check on plugin, for example, plugins may have switch to turn on/off comments option, this callback will affect UI display, not like pluginname_comment_validate only throw exceptions. blog_comment_validate will be called before viewing/adding/deleting comment, so don't repeat checks. Capability check has been done in comment->check_permissions(), we don't need to do it again here. param: stdClass $commentparam { return: array |
blog_comment_validate($commentparam) X-Ref |
Validate comment parameter before perform other comments actions param: stdClass $comment { return: boolean |
blog_page_type_list($pagetype, $parentcontext, $currentcontext) X-Ref |
Return a list of page types param: string $pagetype current page type param: stdClass $parentcontext Block's parent context param: stdClass $currentcontext Current context of block |
core_blog_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) X-Ref |
Add nodes to myprofile page. param: \core_user\output\myprofile\tree $tree Tree object param: stdClass $user user object param: bool $iscurrentuser param: stdClass $course Course object return: bool |
blog_get_tagged_posts($tag, $exclusivemode = false, $fromctx = 0, $ctx = 0, $rec = true, $page = 0) X-Ref |
Returns posts tagged with a specified tag. param: core_tag_tag $tag param: bool $exclusivemode if set to true it means that no other entities tagged with this tag param: int $fromctx context id where the link was displayed, may be used by callbacks param: int $ctx context id where to search for records param: bool $rec search in subcontexts as well param: int $page 0-based number of page being displayed return: \core_tag\output\tagindex |
blog_validate_access($courseid, $modid, $groupid, $entryid, $userid) X-Ref |
Validate the access to a blog. param: int $courseid course id the the blog is associated to (can be null). param: int $modid module id the blog is associated to (can be null). param: int $groupid group id to filter blogs I can see (can be null) param: int $entryid blog entry id (can be null) param: int $userid blog author id (can be null) return: array with the calculated course and id |