3
* This file implements the Comment list Widget class.
5
* This file is part of Quam Plures - {@link http://quamplures.net/}
6
* See also {@link https://launchpad.net/quam-plures}.
8
* @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
9
* @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
11
* {@internal License choice
12
* - If you have received this file as part of a package, please find the license.txt file in
13
* the same folder or the closest folder above for complete license terms.
14
* - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
15
* then you must choose one of the following licenses before using the file:
16
* - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
17
* - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
20
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
21
* @author fplanque: Francois PLANQUE.
22
* @author Yabba - {@link http://www.astonishme.co.uk/}
26
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
28
load_class( 'widgets/model/_widget.class.php' );
34
class comment_list_Widget extends ComponentWidget
39
function comment_list_Widget( $db_row = NULL )
41
// Call parent constructor:
42
parent::ComponentWidget( $db_row, 'widget', 'comment_list' );
44
$this->widget_name = $this->T_('Comment list');
45
$this->widget_title = $this->T_('Recent comments');
50
* Get definitions for editable params
52
* @see Plugin::GetDefaultSettings()
53
* @param local params like 'for_editing' => true
55
function get_param_definitions( $params )
57
$r = array_merge( array(
58
'disp_order' => array(
59
'label' => $this->T_('Order'),
60
'note' => $this->T_('Order to display items'),
62
'options' => array( 'DESC' => $this->T_('Newest to oldest'), 'ASC' => $this->T_('Oldest to newest'), 'RAND' => $this->T_('Random selection') ),
63
'defaultvalue' => 'DESC',
66
'label' => $this->T_('Max items'),
67
'note' => $this->T_('Maximum number of items to display.'),
71
'author_links' => array(
72
'label' => $this->T_('Link to author'),
73
'note' => $this->T_('Link the author to their url'),
74
'defaultvalue' => true,
77
'hover_text' => array(
78
'label' => $this->T_('Hover text'),
79
'note' => $this->T_('Text to show when hovering over the link'),
81
'defaultvalue' => $this->T_('Read the full comment'),
85
'label' => $this->T_('Blog'),
86
'note' => $this->T_('ID of the blog to use, leave empty for the current blog.'),
89
), parent::get_param_definitions( $params ) );
96
* Get a very short desc. Used in the widget list.
98
function get_short_desc()
100
return format_to_output($this->disp_params['widget_title']);
105
* Get short description
109
return $this->T_('List of comments; click goes to comment.');
114
* Display the widget!
116
* @param array MUST contain at least the basic display params
118
function display( $params )
120
$this->init_display( $params );
124
$blogCache = get_Cache( 'BlogCache' );
125
$listBlog = ( $this->disp_params[ 'blog_ID' ] ? $blogCache->get_by_ID( $this->disp_params[ 'blog_ID' ] ) : $Blog );
128
// Note: we pass a widget specific prefix in order to make sure to never interfere with the mainlist
129
$limit = $this->disp_params[ 'limit' ];
130
$order = $this->disp_params[ 'disp_order' ];
132
$CommentList = new CommentList( $listBlog, "'comment','trackback'", array('published'), '', '', $order, '', $limit );
134
echo $this->disp_params[ 'block_start'];
136
// Display title if requested
139
echo $this->disp_params[ 'list_start' ];
144
while( $Comment = & $CommentList->get_next() )
145
{ // Loop through comments:
146
// Load comment's Item object:
147
$Comment->get_Item();
148
echo $this->disp_params[ 'item_start' ];
149
// display comment author's name
150
$Comment->author( array(
151
'after_visitor' => ' ',
153
'make_link' => $this->disp_params[ 'author_links' ],
155
echo $this->T_('on').' ';
156
// display a permalink link to the comment
157
$Comment->permanent_link( array(
158
'text' => $Comment->Item->title,
159
'title' => $this->disp_params[ 'hover_text' ],
161
echo $this->disp_params[ 'item_end' ];
162
} // End of comment loop.
163
echo $this->disp_params[ 'list_end' ];
164
echo $this->disp_params[ 'block_end' ];
b'\\ No newline at end of file'