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

Go to the source code of this file.

Namespaces

namespace  moodlecore

Functions

 blog_user_can_edit_entry ($blogentry)
 blog_user_can_view_user_entry ($targetuserid, $blogentry=null)
 blog_remove_associations_for_user ($userid)
 blog_remove_associations_for_course ($courseid)
 blog_sync_external_entries ($externalblog)
 blog_delete_external_entries ($externalblog)
 blog_get_context_url ($context=null)
 blog_is_enabled_for_user ()
 blog_get_all_options (moodle_page $page, stdClass $userid=null)
 blog_get_options_for_user (stdClass $user=null)
 blog_get_options_for_course (stdClass $course, stdClass $user=null)
 blog_get_options_for_module ($module, $user=null)
 blog_get_headers ($courseid=null, $groupid=null, $userid=null, $tagid=null)
 blog_get_associated_count ($courseid, $cmid=null)
 blog_comment_permissions ($comment_param)
 blog_comment_validate ($comment_param)
 blog_page_type_list ($pagetype, $parentcontext, $currentcontext)

Function Documentation

blog_comment_permissions ( comment_param)

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. Capability check has been done in comment->check_permissions(), we don't need to do it again here.

Parameters:
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Returns:
array

Definition at line 1014 of file lib.php.

blog_comment_validate ( comment_param)

Validate comment parameter before perform other comments actions

Parameters:
stdClass$comment{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Returns:
boolean

Definition at line 1030 of file lib.php.

blog_delete_external_entries ( externalblog)

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.

Parameters:
object$externablog

Definition at line 290 of file lib.php.

Here is the call graph for this function:

blog_get_all_options ( moodle_page page,
stdClass $  userid = null 
)

This function gets all of the options available for the current user in respect to blogs.

It loads the following if applicable:

Parameters:
moodle_page$pageThe page to load for (normally $PAGE)
stdClass$useridLoad for a specific user
Returns:
array An array of options organised by type.

Definition at line 373 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_get_associated_count ( courseid,
cmid = null 
)

Shortcut function for getting a count of blog entries associated with a course or a module

Parameters:
int$courseidThe ID of the course
int$cmidThe ID of the course_modules
Returns:
string The number of associated entries

Definition at line 988 of file lib.php.

Here is the call graph for this function:

blog_get_context_url ( context = null)

Returns a URL based on the context of the current page. This URL points to blog/index.php and includes filter parameters appropriate for the current page.

Parameters:
stdclass$context
Returns:
string

Definition at line 305 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_get_headers ( courseid = null,
groupid = null,
userid = null,
tagid = null 
)

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.

Returns:
array

Definition at line 673 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_get_options_for_course ( stdClass $  course,
stdClass $  user = null 
)

Get the blog options that relate to the given course for the given user.

array $courseoptions A cache so we can save regenerating multiple times

Parameters:
stdClass$courseThe course to load options for
stdClass$userThe user to load options for null == current user
Returns:
array The array of options

Definition at line 503 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_get_options_for_module ( module,
user = null 
)

Get the blog options relating to the given module for the given user

array $moduleoptions Cache

Parameters:
stdClass | cm_info$moduleThe module to get options for
stdClass$userThe user to get options for null == currentuser
Returns:
array

Definition at line 581 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_get_options_for_user ( stdClass $  user = null)

Get all of the blog options that relate to the passed user.

If no user is passed the current user is assumed.

array $useroptions Cache so we don't have to regenerate multiple times

Parameters:
stdClass$user
Returns:
array The array of options for the requested user

Definition at line 432 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

This function checks that blogs are enabled, and that the user can see blogs at all

Returns:
bool

Definition at line 353 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_page_type_list ( pagetype,
parentcontext,
currentcontext 
)

Return a list of page types

Parameters:
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

Definition at line 1065 of file lib.php.

remove all associations for the blog entries of a particular course

Parameters:
intcourseid - id of user whose blog associations will be deleted

Definition at line 132 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

remove all associations for the blog entries of a particular user

Parameters:
intuserid - id of user whose blog associations will be deleted

Definition at line 115 of file lib.php.

blog_sync_external_entries ( externalblog)

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

Parameters:
object$externalblog
Returns:
boolean False if the Feed is invalid

Definition at line 146 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_user_can_edit_entry ( blogentry)

Library of functions and constants for blog 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.

Definition at line 42 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

blog_user_can_view_user_entry ( targetuserid,
blogentry = null 
)

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

Definition at line 64 of file lib.php.

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations