~quam-plures-core/quam-plures/qp5_colls-blogs_chaps-cats

« back to all changes in this revision

Viewing changes to qp_inc/widgets/_post_list.widget.php

http://forums.quamplures.net/viewtopic.php?p=9237#p9237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * This file implements the "Simple Post list" widget
 
4
 *
 
5
 * @author {@link http://wonderwinds.com/ Ed Bennett}
 
6
 * @author {@link http://fplanque.net/ Francois PLANQUE}
 
7
 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
 
8
 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
 
9
 * @package widgets
 
10
 */
 
11
if(!defined('QP_MAIN_INIT')) die('fail');
 
12
 
 
13
$wiCache = get_Cache('WidgetCache');
 
14
$wiCache->load_widget( 'item_list' );
 
15
 
 
16
/**
 
17
 * post_list_Widget class
 
18
 * @package widgets
 
19
 */
 
20
class post_list_Widget extends item_list_Widget
 
21
{
 
22
        /**
 
23
         * Constructor
 
24
         */
 
25
        function post_list_Widget( $db_row = NULL )
 
26
        {
 
27
                // Call parent constructor
 
28
                parent::ComponentWidget( $db_row, 'widget', 'post_list' );
 
29
                $this->widget_name = T_('Post List');
 
30
                $this->widget_title = T_('Contents');
 
31
        }
 
32
 
 
33
 
 
34
        /**
 
35
         * Get widget's short description
 
36
         */
 
37
        function get_desc()
 
38
        {
 
39
                return T_('Simplified Item list for listing posts.');
 
40
        }
 
41
 
 
42
 
 
43
        /**
 
44
         * Get widget's title
 
45
         * @todo (3069): rename this to get_title()
 
46
         */
 
47
        function get_short_desc()
 
48
        {
 
49
                return format_to_output( $this->disp_params['widget_title'] );
 
50
        }
 
51
 
 
52
 
 
53
        /**
 
54
         * Get definitions for editable params
 
55
         * @see Plugin::GetDefaultSettings()
 
56
         * @param local params like 'for_editing' => true
 
57
         */
 
58
        function get_param_definitions( $params )
 
59
        {
 
60
                // This is derived from post_list_Widget
 
61
                $r = parent::get_param_definitions( $params );
 
62
                // We only change the defaults and hide some params
 
63
                $r['title_link']['no_edit'] = true;
 
64
                $r['item_type']['no_edit'] = true;
 
65
                $r['follow_mainlist']['no_edit'] = true;
 
66
                $r['blog_ID']['no_edit'] = true;
 
67
                $r['item_title_link_type']['no_edit'] = true;
 
68
                $r['disp_excerpt']['no_edit'] = true;
 
69
                $r['disp_teaser']['no_edit'] = true;
 
70
                $r['disp_teaser_maxwords']['no_edit'] = true;
 
71
                $r['widget_css_class']['no_edit'] = true;
 
72
                $r['widget_ID']['no_edit'] = true;
 
73
                return $r;
 
74
        }
 
75
 
 
76
 
 
77
        /**
 
78
         * Display the widget!
 
79
         * @param array must contain at least the basic display params
 
80
         */
 
81
        function display( $params )
 
82
        {
 
83
                // Force some params (because this is a simplified widget)
 
84
                $params['item_type'] = '#'; // Use default item types
 
85
 
 
86
                parent::display( $params );
 
87
                return true;
 
88
        }
 
89
 
 
90
}
 
91
 
 
92
?>