PHP Class DiscussionController, vanilla

Author: azazello
Datei anzeigen Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$CategoryID Unique identifier.
$CommentModel CommentModel
$DiscussionModel DiscussionModel
$Uses Models to include.

Public Methods

Method Description
__get ( $Name ) : mixed
announce ( integer $DiscussionID = '', $Target = '' ) Allows user to announce or unannounce a discussion.
bookmark ( integer $DiscussionID = null ) Allows user to bookmark or unbookmark a discussion.
close ( integer $DiscussionID = '', boolean $Close = true, $From = 'list' ) Allows user to close or re-open a discussion.
comment ( integer $CommentID ) Display discussion page starting with a particular comment.
delete ( integer $DiscussionID, $Target = '' ) Allows user to delete a discussion.
deleteComment ( integer $CommentID = '', string $TransientKey = '' ) Allows user to delete a comment.
dismissAnnouncement ( integer $DiscussionID = '' ) Allows user to remove announcement.
embed ( integer $DiscussionID = '', string $DiscussionStub = '', integer $Offset = '', integer $Limit = '' ) Alternate version of Index that uses the embed master view.
getNew ( integer $DiscussionID, integer $LastCommentID ) Display comments in a discussion since a particular CommentID.
index ( integer $DiscussionID = '', string $DiscussionStub = '', integer $Page = '' ) Default single discussion display.
initialize ( ) Highlight route & add common JS definitions.
refetchPageInfo ( type $DiscussionID ) Re-fetch a discussion's content based on its foreign url.
sendOptions ( $discussion )
sink ( integer $DiscussionID = '', boolean $Sink = true, $From = 'list' ) Allows user to sink or unsink a discussion.

Protected Methods

Method Description
_setOpenGraph ( )
redirectDiscussion ( array | object $Discussion ) Redirect to the url specified by the discussion.

Method Details

__get() public method

public __get ( $Name ) : mixed
$Name
return mixed

_setOpenGraph() protected method

protected _setOpenGraph ( )

announce() public method

If the discussion isn't announced, this announces it. If it is already announced, this unannounces it. Announced discussions stay at the top of the discussions list regardless of how long ago the last comment was.
Since: 2.0.0
public announce ( integer $DiscussionID = '', $Target = '' )
$DiscussionID integer Unique discussion ID.

bookmark() public method

If the discussion isn't bookmarked by the user, this bookmarks it. If it is already bookmarked, this unbookmarks it.
Since: 2.0.0
public bookmark ( integer $DiscussionID = null )
$DiscussionID integer Unique discussion ID.

close() public method

If the discussion isn't closed, this closes it. If it is already closed, this re-opens it. Closed discussions may not have new comments added to them.
Since: 2.0.0
public close ( integer $DiscussionID = '', boolean $Close = true, $From = 'list' )
$DiscussionID integer Unique discussion ID.
$Close boolean Whether or not to close the discussion.

comment() public method

Display discussion page starting with a particular comment.
Since: 2.0.0
public comment ( integer $CommentID )
$CommentID integer Unique comment ID

delete() public method

This is a "hard" delete - it is removed from the database.
Since: 2.0.0
public delete ( integer $DiscussionID, $Target = '' )
$DiscussionID integer Unique discussion ID.

deleteComment() public method

If the comment is the only one in the discussion, the discussion will be deleted as well. Users without administrative delete abilities should not be able to delete a comment unless it is a draft. This is a "hard" delete - it is removed from the database.
Since: 2.0.0
public deleteComment ( integer $CommentID = '', string $TransientKey = '' )
$CommentID integer Unique comment ID.
$TransientKey string Single-use hash to prove intent.

dismissAnnouncement() public method

Users may remove announcements from being displayed for themselves only. Does not affect what announcements are shown for other users.
Since: 2.0.0
public dismissAnnouncement ( integer $DiscussionID = '' )
$DiscussionID integer Unique discussion ID.

embed() public method

Alternate version of Index that uses the embed master view.
public embed ( integer $DiscussionID = '', string $DiscussionStub = '', integer $Offset = '', integer $Limit = '' )
$DiscussionID integer Unique identifier, if discussion has been created.
$DiscussionStub string Deprecated.
$Offset integer
$Limit integer

getNew() public method

Display comments in a discussion since a particular CommentID.
Since: 2.0.0
public getNew ( integer $DiscussionID, integer $LastCommentID )
$DiscussionID integer Unique discussion ID
$LastCommentID integer Only shows comments posted after this one

index() public method

Default single discussion display.
Since: 2.0.0
public index ( integer $DiscussionID = '', string $DiscussionStub = '', integer $Page = '' )
$DiscussionID integer Unique discussion ID
$DiscussionStub string URL-safe title slug
$Page integer The current page of comments

initialize() public method

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

redirectDiscussion() protected method

Redirect to the url specified by the discussion.
protected redirectDiscussion ( array | object $Discussion )
$Discussion array | object

refetchPageInfo() public method

Re-fetch a discussion's content based on its foreign url.
public refetchPageInfo ( type $DiscussionID )
$DiscussionID type

sendOptions() public method

public sendOptions ( $discussion )
$discussion

sink() public method

If the discussion isn't sunk, this sinks it. If it is already sunk, this unsinks it. Sunk discussions do not move to the top of the discussion list when a new comment is added.
Since: 2.0.0
public sink ( integer $DiscussionID = '', boolean $Sink = true, $From = 'list' )
$DiscussionID integer Unique discussion ID.
$Sink boolean Whether or not to unsink the discussion.

Property Details

$CategoryID public_oe property

Unique identifier.
public $CategoryID

$CommentModel public_oe property

public CommentModel $CommentModel
return CommentModel

$DiscussionModel public_oe property

public DiscussionModel $DiscussionModel
return DiscussionModel

$Uses public_oe property

Models to include.
public $Uses