PHP Class QnAPlugin, addons

Author: Zach Copley ([email protected])
Inheritance: extends MicroAppPlugin
Show file Open project: vanilla/addons

Protected Properties

Property Type Description
$Badges boolean | array
$Reactions boolean | array

Public Methods

Method Description
__construct ( ) QnAPlugin constructor.
_commentOptions ( $sender, integer | string $commentID )
base_addonEnabled_handler ( $sender, array $args ) Trigger reaction or badge creation if those addons are enabled later.
base_afterDiscussionFilters_handler ( $sender ) New Html method of adding to discussion filters.
base_beforeCommentDisplay_handler ( $sender, array $args )
base_beforeDiscussionMeta_handler ( $sender, array $args )
base_commentInfo_handler ( $sender, array $args )
base_discussionOptions_handler ( CommentModel $sender, array $args )
base_discussionTypes_handler ( $sender, array $args )
base_render_before ( $sender, $args ) Add Javascript.
categoriesController_render_before ( CategoriesController $sender ) Add 'Ask a Question' button if using BigButtons.
commentModel_afterSaveComment_handler ( CommentModel $sender, array $args ) Give point(s) to the current user if the right conditions are met.
commentModel_beforeNotification_handler ( CommentModel $sender, array $args )
commentModel_beforeUpdateCommentCount_handler ( CommentModel $sender, array $args )
discussionController_QnAOptions_create ( DiscussionController $sender, string | integer $discussionID = '', string | integer $commentID = '' )
discussionController_QnA_create ( DiscussionController $sender, array $args )
discussionController_afterCommentBody_handler ( DiscussionController $sender, array $args ) Write the accept/reject buttons.
discussionController_afterDiscussion_handler ( DiscussionController $sender, array $args )
discussionController_beforeDiscussionRender_handler ( DiscussionController $sender, array $args ) Modify flow of discussion by pinning accepted answers.
discussionController_commentOptions_handler ( DiscussionController $sender, array $args )
discussionController_render_before ( DiscussionController $sender ) Add 'Ask a Question' button if using BigButtons.
discussionModel_beforeGet_handler ( DiscussionModel $sender, array $args )
discussionModel_beforeSaveDiscussion_handler ( DiscussionModel $sender, array $args )
discussionsController_afterDiscussionTabs_handler ( ) Old Html method of adding to discussion filters.
discussionsController_beforeBuildPager_handler ( DiscussionsController $sender, array $args )
discussionsController_unansweredCount_create ( DiscussionsController $sender, array $args ) Displays the amounts of unanswered questions.
discussionsController_unanswered_create ( DiscussionsController $sender, array $args )
discussionsController_unanswered_render ( DiscussionsController $sender, array $args ) Displays the amounts of unanswered questions.
getUnansweredCount ( ) : integer Return the number of unanswered questions.
messageController_afterGetLocationData_handler ( $sender, $args ) Add 'New Question Form' location to Messages.
notificationsController_beforeInformNotifications_handler ( NotificationsController $sender, array $args ) Notifies the current user when one of his questions have been answered.
postController_afterForms_handler ( PostController $sender ) Add the question form to vanilla's post page.
postController_beforeDiscussionRender_handler ( PostController $sender ) Override the PostController->Discussion() method before render to use our view instead.
postController_question_create ( PostController $sender, $CategoryUrlCode = '' ) Create the new question method on post controller.
recalculateDiscussionQnA ( $discussion )
recalculateUserQnA ( string | integer $userID )
settingsController_QnA_create ( $sender ) Create a method called "QnA" on the SettingController.
setup ( ) Run once on enable.
structure ( ) Database updates.

Protected Methods

Method Description
_discussionOptions ( $sender, integer | string $discussionID )

Method Details

__construct() public method

QnAPlugin constructor.
public __construct ( )

_commentOptions() public method

public _commentOptions ( $sender, integer | string $commentID )
$sender controller instance.
$commentID integer | string Identifier of the comment.

_discussionOptions() protected method

protected _discussionOptions ( $sender, integer | string $discussionID )
$sender controller instance.
$discussionID integer | string Identifier of the discussion.

base_addonEnabled_handler() public method

Trigger reaction or badge creation if those addons are enabled later.
public base_addonEnabled_handler ( $sender, array $args )
$sender Sending controller instance.
$args array Event arguments.

base_afterDiscussionFilters_handler() public method

New Html method of adding to discussion filters.
public base_afterDiscussionFilters_handler ( $sender )
$sender

base_beforeCommentDisplay_handler() public method

public base_beforeCommentDisplay_handler ( $sender, array $args )
$sender Sending controller instance.
$args array Event arguments.

base_beforeDiscussionMeta_handler() public method

public base_beforeDiscussionMeta_handler ( $sender, array $args )
$sender Sending controller instance.
$args array Event arguments.

base_commentInfo_handler() public method

public base_commentInfo_handler ( $sender, array $args )
$sender Sending controller instance.
$args array Event arguments.

base_discussionOptions_handler() public method

public base_discussionOptions_handler ( CommentModel $sender, array $args )
$sender CommentModel Sending controller instance.
$args array Event arguments.

base_discussionTypes_handler() public method

public base_discussionTypes_handler ( $sender, array $args )
$sender Sending controller instance.
$args array Event arguments.

base_render_before() public method

Add Javascript.
public base_render_before ( $sender, $args )
$sender
$args

categoriesController_render_before() public method

Add 'Ask a Question' button if using BigButtons.
public categoriesController_render_before ( CategoriesController $sender )
$sender CategoriesController Sending controller instance.

commentModel_afterSaveComment_handler() public method

Give point(s) to the current user if the right conditions are met.
public commentModel_afterSaveComment_handler ( CommentModel $sender, array $args )
$sender CommentModel Sending controller instance.
$args array Event arguments.

commentModel_beforeNotification_handler() public method

public commentModel_beforeNotification_handler ( CommentModel $sender, array $args )
$sender CommentModel Sending controller instance.
$args array Event arguments.

commentModel_beforeUpdateCommentCount_handler() public method

public commentModel_beforeUpdateCommentCount_handler ( CommentModel $sender, array $args )
$sender CommentModel Sending controller instance.
$args array Event arguments.

discussionController_QnAOptions_create() public method

public discussionController_QnAOptions_create ( DiscussionController $sender, string | integer $discussionID = '', string | integer $commentID = '' )
$sender DiscussionController Sending controller instance.
$discussionID string | integer Identifier of the discussion
$commentID string | integer Identifier of the comment.

discussionController_QnA_create() public method

public discussionController_QnA_create ( DiscussionController $sender, array $args )
$sender DiscussionController Sending controller instance.
$args array Event arguments.

discussionController_afterCommentBody_handler() public method

Write the accept/reject buttons.
public discussionController_afterCommentBody_handler ( DiscussionController $sender, array $args )
$sender DiscussionController Sending controller instance.
$args array Event arguments.

discussionController_afterDiscussion_handler() public method

public discussionController_afterDiscussion_handler ( DiscussionController $sender, array $args )
$sender DiscussionController Sending controller instance.
$args array Event arguments.

discussionController_beforeDiscussionRender_handler() public method

Modify flow of discussion by pinning accepted answers.
public discussionController_beforeDiscussionRender_handler ( DiscussionController $sender, array $args )
$sender DiscussionController Sending controller instance.
$args array Event arguments.

discussionController_commentOptions_handler() public method

public discussionController_commentOptions_handler ( DiscussionController $sender, array $args )
$sender DiscussionController Sending controller instance.
$args array Event arguments.

discussionController_render_before() public method

Add 'Ask a Question' button if using BigButtons.
public discussionController_render_before ( DiscussionController $sender )
$sender DiscussionController Sending controller instance.

discussionModel_beforeGet_handler() public method

public discussionModel_beforeGet_handler ( DiscussionModel $sender, array $args )
$sender DiscussionModel Sending controller instance.
$args array Event arguments.

discussionModel_beforeSaveDiscussion_handler() public method

public discussionModel_beforeSaveDiscussion_handler ( DiscussionModel $sender, array $args )
$sender DiscussionModel Sending controller instance.
$args array Event arguments.

discussionsController_afterDiscussionTabs_handler() public method

Old Html method of adding to discussion filters.

discussionsController_beforeBuildPager_handler() public method

public discussionsController_beforeBuildPager_handler ( DiscussionsController $sender, array $args )
$sender DiscussionsController Sending controller instance.
$args array Event arguments.

discussionsController_unansweredCount_create() public method

Displays the amounts of unanswered questions.
public discussionsController_unansweredCount_create ( DiscussionsController $sender, array $args )
$sender DiscussionsController Sending controller instance.
$args array Event arguments.

discussionsController_unanswered_create() public method

public discussionsController_unanswered_create ( DiscussionsController $sender, array $args )
$sender DiscussionsController Sending controller instance.
$args array Event arguments.

discussionsController_unanswered_render() public method

Displays the amounts of unanswered questions.
public discussionsController_unanswered_render ( DiscussionsController $sender, array $args )
$sender DiscussionsController Sending controller instance.
$args array Event arguments.

getUnansweredCount() public method

Return the number of unanswered questions.
public getUnansweredCount ( ) : integer
return integer

messageController_afterGetLocationData_handler() public method

Add 'New Question Form' location to Messages.

notificationsController_beforeInformNotifications_handler() public method

Notifies the current user when one of his questions have been answered.
public notificationsController_beforeInformNotifications_handler ( NotificationsController $sender, array $args )
$sender NotificationsController Sending controller instance.
$args array Event arguments.

postController_afterForms_handler() public method

Add the question form to vanilla's post page.
public postController_afterForms_handler ( PostController $sender )
$sender PostController Sending controller instance.

postController_beforeDiscussionRender_handler() public method

Override the PostController->Discussion() method before render to use our view instead.
public postController_beforeDiscussionRender_handler ( PostController $sender )
$sender PostController Sending controller instance.

postController_question_create() public method

Create the new question method on post controller.
public postController_question_create ( PostController $sender, $CategoryUrlCode = '' )
$sender PostController Sending controller instance.

recalculateDiscussionQnA() public method

public recalculateDiscussionQnA ( $discussion )
$discussion A discussion.

recalculateUserQnA() public method

public recalculateUserQnA ( string | integer $userID )
$userID string | integer User identifier

settingsController_QnA_create() public method

Create a method called "QnA" on the SettingController.
public settingsController_QnA_create ( $sender )
$sender Sending controller instance

setup() public method

Run once on enable.
public setup ( )

structure() public method

Database updates.
public structure ( )

Property Details

$Badges protected property

protected bool|array $Badges
return boolean | array

$Reactions protected property

protected bool|array $Reactions
return boolean | array