PHP Class PostController, vanilla

Inheritance: extends AppController
Show file Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$DiscussionModel DiscussionModel
$Form Gdn_Form
$FormCollection An associative array of form types and their locations.
$ShowCategorySelector Whether or not to show the category dropdown.
$Uses Models to include.

Public Methods

Method Description
announceOptions ( ) : array Get available announcement options for discussions.
comment ( integer $DiscussionID = '' ) Create or update a comment.
comment2 ( integer $CommentID, boolean $Inserted = false ) Triggers saving the extra info about a comment like notifications and unread totals.
discussion ( $CategoryUrlCode = '' ) Create or update a discussion.
editComment ( integer $CommentID = '', integer $DraftID = '' ) Edit a comment (wrapper for PostController::Comment).
editDiscussion ( integer $DiscussionID = '', integer $DraftID = '' ) Edit a discussion (wrapper for PostController::Discussion).
index ( $CurrentFormName = 'discussion' ) General "post" form, allows posting of any kind of form. Attach to PostController_AfterFormCollection_Handler.
initialize ( ) Include CSS for all methods.
notifyNewDiscussion ( $DiscussionID )

Protected Methods

Method Description
populateForm ( Gdn_Form $Form ) Pre-populate the form with values from the query string.

Method Details

announceOptions() public method

Get available announcement options for discussions.
Since: 2.1
public announceOptions ( ) : array
return array

comment() public method

Create or update a comment.
Since: 2.0.0
public comment ( integer $DiscussionID = '' )
$DiscussionID integer Unique ID to add the comment to. If blank, this method will throw an error.

comment2() public method

Triggers saving the extra info about a comment like notifications and unread totals.
Since: 2.0.?
public comment2 ( integer $CommentID, boolean $Inserted = false )
$CommentID integer Unique ID of the comment.
$Inserted boolean

discussion() public method

Create or update a discussion.
Since: 2.0.0
public discussion ( $CategoryUrlCode = '' )

editComment() public method

Will throw an error if both params are blank.
Since: 2.0.0
public editComment ( integer $CommentID = '', integer $DraftID = '' )
$CommentID integer Unique ID of the comment to edit.
$DraftID integer Unique ID of the draft to edit.

editDiscussion() public method

Will throw an error if both params are blank.
Since: 2.0.0
public editDiscussion ( integer $DiscussionID = '', integer $DraftID = '' )
$DiscussionID integer Unique ID of the discussion to edit.
$DraftID integer Unique ID of draft discussion to edit.

index() public method

General "post" form, allows posting of any kind of form. Attach to PostController_AfterFormCollection_Handler.
Since: 2.0.0
public index ( $CurrentFormName = 'discussion' )

initialize() public method

Always called by dispatcher before controller's requested method.
Since: 2.0.0
public initialize ( )

notifyNewDiscussion() public method

public notifyNewDiscussion ( $DiscussionID )

populateForm() protected method

Pre-populate the form with values from the query string.
protected populateForm ( Gdn_Form $Form )
$Form Gdn_Form

Property Details

$DiscussionModel public property

public DiscussionModel $DiscussionModel
return DiscussionModel

$Form public property

public Gdn_Form $Form
return Gdn_Form

$FormCollection public property

An associative array of form types and their locations.
public $FormCollection

$ShowCategorySelector public property

Whether or not to show the category dropdown.
public $ShowCategorySelector

$Uses public property

Models to include.
public $Uses