Blog_entry class.  
 More...
|  | 
|  | __construct ($id=null, $params=null, $form=null) | 
|  | Constructor. 
 | 
|  | 
|  | add () | 
|  | Inserts this entry in the database. 
 | 
|  | 
|  | add_association ($contextid, $unused=null) | 
|  | Add a single association for a blog entry. 
 | 
|  | 
|  | add_associations ($unused=null) | 
|  | Function to add all context associations to an entry. 
 | 
|  | 
|  | can_user_edit ($userid=null) | 
|  | 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. 
 | 
|  | 
|  | can_user_view ($targetuserid) | 
|  | Checks to see if a user can view the blogs of another user. 
 | 
|  | 
|  | delete () | 
|  | Deletes this entry from the database. 
 | 
|  | 
|  | delete_attachments () | 
|  | Deletes all the user files in the attachments area for an entry. 
 | 
|  | 
|  | edit ($params=array(), $form=null, $summaryoptions=array(), $attachmentoptions=array()) | 
|  | Updates this entry in the database. 
 | 
|  | 
|  | get_attachments () | 
|  | Gets the entry attachments list. 
 | 
|  | 
|  | prepare_render () | 
|  | Gets the required data to print the entry. 
 | 
|  | 
|  | process_attachment ($form) | 
|  | Inserts this entry in the database. 
 | 
|  | 
|  | remove_associations () | 
|  | remove all associations for a blog entry 
 | 
|  | 
|  | 
| string | $action | 
|  | 
| string null | $alternatename | 
|  | user alternate name. 
 | 
|  | 
|  | $attachment | 
|  | 
| mixed | $attachment_filemanager | 
|  | attachment. 
 | 
|  | 
| string | $body | 
|  | blog post body. 
 | 
|  | 
|  | $content | 
|  | 
| int | $courseassoc | 
|  | course associated with the blog post. 
 | 
|  | 
|  | $courseid = 0 | 
|  | 
|  | $coursemoduleid = 0 | 
|  | 
|  | $created | 
|  | 
| string null | $email | 
|  | user email address. 
 | 
|  | 
| int | $entryid | 
|  | attachment entry id. 
 | 
|  | 
| string null | $firstname | 
|  | user first name. 
 | 
|  | 
| string null | $firstnamephonetic | 
|  | user first name phonetic. 
 | 
|  | 
|  | $form | 
|  | 
|  | $format = 1 | 
|  | 
|  | $groupid = 0 | 
|  | 
|  | $id | 
|  | 
| string null | $imagealt | 
|  | user picture description. 
 | 
|  | 
|  | $lastmodified | 
|  | 
| string null | $lastname | 
|  | user last name. 
 | 
|  | 
| string null | $lastnamephonetic | 
|  | user last name phonetic. 
 | 
|  | 
| string null | $middlename | 
|  | user middle name. 
 | 
|  | 
| string | $modassoc | 
|  | module associated with the blog post. 
 | 
|  | 
| int | $modid | 
|  | module instance id. 
 | 
|  | 
|  | $module = 'blog' | 
|  | 
|  | $moduleid = 0 | 
|  | 
| string null | $picture | 
|  | user picture. 
 | 
|  | 
|  | $publishstate | 
|  | 
|  | $rating = 0 | 
|  | 
| StdClass | $renderable | 
|  | Data needed to render the entry. 
 | 
|  | 
|  | $subject | 
|  | 
| string null | $submitbutton | 
|  | submit button. 
 | 
|  | 
|  | $summary | 
|  | 
| array array | $summary_editor | 
|  | summary editor. 
 | 
|  | 
| string string | $summaryformat | 
|  | summary format. 
 | 
|  | 
| string | $summarytrust | 
|  | 
|  | $tags = array() | 
|  | 
|  | $uniquehash = '' | 
|  | 
|  | $userid | 
|  | 
| string null | $useridalias | 
|  | user alias. 
 | 
|  | 
|  | $usermodified | 
|  | 
Blog_entry class. 
Represents an entry in a user's blog. Contains all methods for managing this entry. This class does not contain any HTML-generating code. See blog_listing sub-classes for such code. This class follows the Object Relational Mapping technique, its member variables being mapped to the fields of the post table.
- Copyright
- 2009 Nicolas Connault 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | blog_entry::__construct | ( |  | $id = null, | 
        
          |  |  |  | $params = null, | 
        
          |  |  |  | $form = null ) | 
      
 
Constructor. 
If given an id, will fetch the corresponding record from the DB.
- Parameters
- 
  
    | mixed | $idorparams | A blog entry id if INT, or data for a new entry if array |  
 
 
 
◆ add()
Inserts this entry in the database. 
Access control checks must be done by calling code. TODO Set the publishstate correctly 
- Return values
- 
  
  
 
 
◆ add_association()
      
        
          | blog_entry::add_association | ( |  | $contextid, | 
        
          |  |  |  | $unused = null ) | 
      
 
Add a single association for a blog entry. 
- Parameters
- 
  
    | int | $contextid | - id of context to associate with the blog entry. |  | string | $unused | This does nothing, do not use it. |  
 
 
 
◆ add_associations()
      
        
          | blog_entry::add_associations | ( |  | $unused = null | ) |  | 
      
 
Function to add all context associations to an entry. 
- Parameters
- 
  
    | string | $unused | This does nothing, do not use it. |  
 
 
 
◆ can_user_edit()
      
        
          | blog_entry::can_user_edit | ( |  | $userid = null | ) |  | 
      
 
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.
- Parameters
- 
  
    | int | $userid | Optional. If not given, $USER is used |  
 
- Return values
- 
  
  
 
 
◆ can_user_view()
      
        
          | blog_entry::can_user_view | ( |  | $targetuserid | ) |  | 
      
 
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
- Parameters
- 
  
    | int | $targetuserid | ID of the user we are checking |  
 
- Return values
- 
  
  
 
 
◆ delete()
Deletes this entry from the database. 
Access control checks must be done by calling code.
- Return values
- 
  
  
 
 
◆ delete_attachments()
      
        
          | blog_entry::delete_attachments | ( |  | ) |  | 
      
 
Deletes all the user files in the attachments area for an entry. 
- Return values
- 
  
  
 
 
◆ edit()
      
        
          | blog_entry::edit | ( |  | $params = array(), | 
        
          |  |  |  | $form = null, | 
        
          |  |  |  | $summaryoptions = array(), | 
        
          |  |  |  | $attachmentoptions = array() ) | 
      
 
Updates this entry in the database. 
Access control checks must be done by calling code.
- Parameters
- 
  
    | array | $params | Entry parameters. |  | moodleform | $form | Used for attachments. |  | array | $summaryoptions | Summary options. |  | array | $attachmentoptions | Attachment options. |  
 
- Return values
- 
  
  
 
 
◆ get_applicable_publish_states()
  
  | 
        
          | static blog_entry::get_applicable_publish_states | ( |  | ) |  |  | static | 
 
Use this function to retrieve a list of publish states available for the currently logged in user. 
- Return values
- 
  
    | array | This function returns an array ideal for sending to moodles' choose_from_menu function. |  
 
 
 
◆ get_attachments()
      
        
          | blog_entry::get_attachments | ( |  | ) |  | 
      
 
Gets the entry attachments list. 
- Return values
- 
  
  
 
 
◆ process_attachment()
      
        
          | blog_entry::process_attachment | ( |  | $form | ) |  | 
      
 
Inserts this entry in the database. 
Access control checks must be done by calling code.
- Parameters
- 
  
    | mform | $form | Used for attachments |  
 
- Return values
- 
  
  
 
 
◆ remove_associations()
      
        
          | blog_entry::remove_associations | ( |  | ) |  | 
      
 
remove all associations for a blog entry 
- Return values
- 
  
  
 
 
The documentation for this class was generated from the following file: