DLComments

Provides an interface for submitting comments to a page.

Summary
DLCommentsProvides an interface for submitting comments to a page.
AuthorDuc Tri Le <cmsmadesimple---at---email.tiger-inc.com>
LicenseThis class is released under the GNU General Public License.
Changelog
Data
$get_groupsA boolean specifiying whether or not we should connect to the database to retrieve the current list of comment groups or use what is in the cache.
Class Construction
__constructCreate a new instance of DLComments.
Override Methods
Module Specific
GetCommentsGroupsRetrieve all the comment groups currently in the database.
GetCommentsListingRetrieve various information regarding the listing of the comments.
GetIconA wrapper function for calling “DLSupport::GetIcon” since the majority of the icon retrieval will be on the same size.
GetIconFrontendRetrieve the icon for the frontend.
GetSettingsHTMLRetrieve the HTML for the settings page.
GetStoredTemplatesRetrieve HTML for the listing of the templates.
IncludeAdminRetrieve the HTML for including required JavaScript and CSS on an admin page.
IncludeFrontendRetrieve the HTML for including required JavaScript and CSS on a regular page.
ShowFilterAreaRetrieve the HTML for the filter area on the backend.
ShowFrontendCSSRetrieve the HTML for the frontend CSS inclusion.
ShowListingAreaRetrieve the HTML for the listing area on the backend.
ShowSettingsAreaRetrieve the HTML for the settings area on the backend.
ShowSubmissionFormRetrieve the HTML for the submission form on the frontend.
ShowTemplateAreaRetrieve the HTML for the template area.
ShowUserCommentsRetrieve the HTML for the user comments.
Upgrades and Degrades
DegradeUndo any upgrades that has been made.

Author

Duc Tri Le <cmsmadesimple---at---email.tiger-inc.com>

License

This class is released under the GNU General Public License.

Changelog

  • 1.0RC2 (December 12, 2008): Switched comments to NaturalDocs and moved methods back into file.  Hence, the method __call is removed.  Fixed bug with the display of the CSS not showing another CSS template.  Changed the way some data are stored in the database.
  • 1.0RC1 (August 15, 2008): Added the ability to auto approve comments and sending an e-mail to let you know a comment was submitted.
  • 0.3 (May 30, 2008): Second try at bug fix for Module Manager.
  • 0.2 (May 30, 2008): Fixed bug when installing via Module Manager.
  • 0.1 (May 16, 2008): Initial release.
  • 0.0 (April 10, 2008): Started.

Data

$get_groups

protected $get_groups

A boolean specifiying whether or not we should connect to the database to retrieve the current list of comment groups or use what is in the cache.

Class Construction

__construct

public function __construct()

Create a new instance of DLComments.  This will also register this class as a plugin.

Returns

(DLComments) An instance of DLComments.

Override Methods

Methods

AllowAutoInstallWhether or not an auto install is allowed.
AllowAutoUpgradeWhether or not an auto upgrade is allowed.
GetAboutGet about information.
GetAdminSectionGet the admin section this module belongs to.
GetAuthorGet the author.
GetAuthorEmailGet the author e-mail address.
GetChangeLogGet the changelog.
GetDependenciesGet other modules depended by this module.
GetDescriptionGet a description of module.
GetFriendlyNameGet module friendly name.
GetHelpGet help information.
GetNameGet module name.
GetParametersGet parameters.
GetVersionGet version number of module.
HasAdminWhether or not module has admin panel.
InstallPostMessageMessage to be displayed after installation.
IsPluginModuleWhether or not this is a plugin module.
MinimumCMSVersionMinimum CMS version to run this module.
UninstallPostMessageMessage to be displayed after uninstall.
UninstallPreMessageMessage to be alerted before uninstall.
VisibileToAdminUserPrivilege checking.

Module Specific

GetCommentsGroups

protected function GetCommentsGroups($htmlentities =  FALSE)

Retrieve all the comment groups currently in the database.  This will try to retrieve the information from cache to prevent many connections to the database.  If you need to force this to read from the database, be sure to set the member data $get_groups to TRUE.

Parameters

$htmlentities(boolean) Optional and defaults to FALSE.  If this is set to TRUE, then the comment groups value will be passed through the function “htmlentities”, otherwise, it won’t.

Returns

(array) An array containing all of the comment groups.

GetCommentsListing

protected function GetCommentsListing($id,
$returnid,
$params)

Retrieve various information regarding the listing of the comments.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.

Returns

(array) An array containing the various results generated by this method.

GetIcon

protected function GetIcon($icon,  
$alt =  '',
$size =  32)

A wrapper function for calling “DLSupport::GetIcon” since the majority of the icon retrieval will be on the same size.

Parameters

$icon(string) The filename of the icon to get without its file extension.  Note that not all icons exist.  Be sure to check that they exist first.
$alt(string) Optional and defaults to an empty string.  The text to be placed in the “alt” attribute of the IMG tag.  If it is not given or empty, it will use the $icon value with underscores converted to whitespace and the first letter of each word would be capitalize.
$size(int) Optional and defaults to 32.  This is the dimension of the icon.  Note that not all dimensions exist.  Be sure to check that the dimension folder you are requesting exist.

Returns

(string) The HTML for the IMG tag with appropriate information for displaying the icon.

GetIconFrontend

protected function GetIconFrontend($icon,
$alt)

Retrieve the icon for the frontend.  If there is a preference with a value for the given $icon, then this will use that.  Otherwise, it will use the default icon from DLSupport.

Parameters

$icon(string) The icon to retrieve.
$alt(string) The text that will be in the alt attribute of the IMG tag.

Returns

(string) The HTML for the IMG tag with appropriate information for displaying the icon.

GetSettingsHTML

protected function GetSettingsHTML($id,
$returnin,
$params)

Retrieve the HTML for the settings page.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.

Returns

(string) The HTML for the settings page.

GetStoredTemplates

protected function GetStoredTemplates($id,
$returnid,
$params,
$type)

Retrieve HTML for the listing of the templates.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.
$type(string) The type of template to get the listing for.

Returns

(string) The HTML for the listing of the templates.

IncludeAdmin

protected function IncludeAdmin()

Retrieve the HTML for including required JavaScript and CSS on an admin page.

Returns

(string) The HTML to be used to include the necessary JavaScript and CSS for the admin page.

IncludeFrontend

protected function IncludeFrontend()

Retrieve the HTML for including required JavaScript and CSS on a regular page.

Returns

(string) The HTML to be used to include the necessary JavaScript and CSS for the frontend page.

ShowFilterArea

protected function ShowFilterArea($id,
$returnid,
$params,
$type)

Retrieve the HTML for the filter area on the backend.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.
$type(string) The type of template to get the listing for.

Returns

(string) The HTML for the filter area.

ShowFrontendCSS

protected function ShowFrontendCSS($css =  NULL)

Retrieve the HTML for the frontend CSS inclusion.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.
$css(string) Optional and defaults to NULL.  The CSS template to retrieve.

Returns

(string) The HTML for the frontend CSS.

ShowListingArea

protected function ShowListingArea($id,
$returnid,
$params,
$type)

Retrieve the HTML for the listing area on the backend.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.
$type(string) The type of template to get the listing for.

Returns

(string) The HTML for the listing area.

ShowSettingsArea

protected function ShowSettingsArea($id,
$returnid,
$params)

Retrieve the HTML for the settings area on the backend.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.

Returns

(string) The HTML for the settings area.

ShowSubmissionForm

protected function ShowSubmissionForm($id,  
$returnid,  
$params,  
$group,  
$template =  NULL)

Retrieve the HTML for the submission form on the frontend.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.
$group(string) The name of the comment group to submit the comment.
$template(string) Optional and defaults to NULL.  If it is NULL, then the default template will be used.

Returns

(string) The HTML for the submission form.

ShowTemplateArea

protected function ShowTemplateArea($id,
$returnid,
$params,
$type)

Retrieve the HTML for the template area.

Parameters

$id(numeric) The ID given to this module upon execution.
$returnid(string) The ID of the page to return to when the required action is completed.  An empty string means that it is just an internal page on the admin site whereas any numeric number is the ID of a frontend page.
$params(array) An array containing various user inputs.
$type(string) The type of template to get the listing for.

Returns

(string) The HTML for the template area.

ShowUserComments

protected function ShowUserComments($group,  
$template =  NULL)

Retrieve the HTML for the user comments.

Parameters

$group(string) The name of the comment group to submit the comment.
$template(string) Optional and defaults to NULL.  If it is NULL, then the default template will be used.

Returns

(string) The HTML for the user comments.

Upgrades and Degrades

Degrade

protected function Degrade($start,
$counter)

Undo any upgrades that has been made.

Parameters

$start(int) The starting degrading method.
$counter(int) The number of degrading that needs to be done.
protected $get_groups
A boolean specifiying whether or not we should connect to the database to retrieve the current list of comment groups or use what is in the cache.
public function __construct()
Create a new instance of DLComments.
protected function GetCommentsGroups($htmlentities =  FALSE)
Retrieve all the comment groups currently in the database.
protected function GetCommentsListing($id,
$returnid,
$params)
Retrieve various information regarding the listing of the comments.
protected function GetIcon($icon,  
$alt =  '',
$size =  32)
A wrapper function for calling “DLSupport::GetIcon” since the majority of the icon retrieval will be on the same size.
protected function GetIconFrontend($icon,
$alt)
Retrieve the icon for the frontend.
protected function GetSettingsHTML($id,
$returnin,
$params)
Retrieve the HTML for the settings page.
protected function GetStoredTemplates($id,
$returnid,
$params,
$type)
Retrieve HTML for the listing of the templates.
protected function IncludeAdmin()
Retrieve the HTML for including required JavaScript and CSS on an admin page.
protected function IncludeFrontend()
Retrieve the HTML for including required JavaScript and CSS on a regular page.
protected function ShowFilterArea($id,
$returnid,
$params,
$type)
Retrieve the HTML for the filter area on the backend.
protected function ShowFrontendCSS($css =  NULL)
Retrieve the HTML for the frontend CSS inclusion.
protected function ShowListingArea($id,
$returnid,
$params,
$type)
Retrieve the HTML for the listing area on the backend.
protected function ShowSettingsArea($id,
$returnid,
$params)
Retrieve the HTML for the settings area on the backend.
protected function ShowSubmissionForm($id,  
$returnid,  
$params,  
$group,  
$template =  NULL)
Retrieve the HTML for the submission form on the frontend.
protected function ShowTemplateArea($id,
$returnid,
$params,
$type)
Retrieve the HTML for the template area.
protected function ShowUserComments($group,  
$template =  NULL)
Retrieve the HTML for the user comments.
protected function Degrade($start,
$counter)
Undo any upgrades that has been made.