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

« back to all changes in this revision

Viewing changes to qp_inc/widgets/_common_links.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 "Common Navigation Links" widget
 
4
 *
 
5
 * @todo (0000): dh> why are "STRONG" tags hardcoded here? can this get
 
6
 * dropped/removed? should the style get adjusted to use font-weight:bold then?
 
7
 *
 
8
 * @author {@link http://wonderwinds.com/ Ed Bennett}
 
9
 * @author {@link http://fplanque.net/ Francois PLANQUE}
 
10
 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
 
11
 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
 
12
 * @package widgets
 
13
 */
 
14
if(!defined('QP_MAIN_INIT')) die('fail');
 
15
 
 
16
/**
 
17
 * common_links_Widget class
 
18
 * @package widgets
 
19
 */
 
20
class common_links_Widget extends ComponentWidget
 
21
{
 
22
        /**
 
23
         * Constructor
 
24
         */
 
25
        function common_links_Widget( $db_row = NULL )
 
26
        {
 
27
                // Call parent constructor
 
28
                parent::ComponentWidget( $db_row, 'widget', 'common_links' );
 
29
                $this->widget_name = T_('Common Navigation Links');
 
30
                $this->widget_title = '';
 
31
        }
 
32
 
 
33
 
 
34
        /**
 
35
         * Get widget's short description
 
36
         */
 
37
        function get_desc()
 
38
        {
 
39
                return T_('Display these links: Recently, Archives, Categories, Latest Comments');
 
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
                $r = array_merge( array(
 
61
                                'show_recently' => array(
 
62
                                        'label' => T_('Show "Recently"'),
 
63
                                        'type' => 'checkbox',
 
64
                                        'defaultvalue' => '1',
 
65
                                        'note' => T_('Go to the most recent posts / the blog\'s home.'),
 
66
                                ),
 
67
                                'show_archives' => array(
 
68
                                        'label' => T_('Show "Archives"'),
 
69
                                        'type' => 'checkbox',
 
70
                                        'defaultvalue' => '1',
 
71
                                        'note' => T_('Go to the monthly/weekly/daily archive list.'),
 
72
                                ),
 
73
                                'show_categories' => array(
 
74
                                        'label' => T_('Show "Categories"'),
 
75
                                        'type' => 'checkbox',
 
76
                                        'defaultvalue' => '1',
 
77
                                        'note' => T_('Go to the category tree.'),
 
78
                                ),
 
79
                                'show_latestcomments' => array(
 
80
                                        'label' => T_('Show "Latest comments"'),
 
81
                                        'type' => 'checkbox',
 
82
                                        'defaultvalue' => '1',
 
83
                                        'note' => T_('Go to the latest comments.'),
 
84
                                ),
 
85
                        ), parent::get_param_definitions( $params ) );
 
86
                return $r;
 
87
        }
 
88
 
 
89
 
 
90
        /**
 
91
         * Display the widget!
 
92
         * @param array must contain at least the basic display params
 
93
         */
 
94
        function display( $params )
 
95
        {
 
96
                global $Blog;
 
97
 
 
98
                $this->init_display( $params );
 
99
 
 
100
                echo $this->disp_params['block_start'];
 
101
                $this->disp_title();
 
102
                echo $this->disp_params['list_start'];
 
103
 
 
104
                if( $this->disp_params['show_recently'] )
 
105
                {
 
106
                        echo $this->disp_params['item_start'];
 
107
                        echo '<strong><a href="'.$Blog->get( 'url' ).'" title="'.T_('visit this blog\'s home page').'">'.T_('Recently').'</a></strong>';
 
108
                        echo $this->disp_params['item_end'];
 
109
                }
 
110
 
 
111
                if( $this->disp_params['show_archives'] )
 
112
                {
 
113
                        // @todo (0000): fp> don't display this if archives plugin not installed... or depluginize archives (I'm not sure)
 
114
                        echo $this->disp_params['item_start'];
 
115
                        echo '<strong><a href="'.$Blog->get( 'arcdirurl' ).'" title="'.T_('visit this blog\'s archives').'">'.T_('Archives').'</a></strong>';
 
116
                        echo $this->disp_params['item_end'];
 
117
                }
 
118
 
 
119
                if( $this->disp_params['show_categories'] )
 
120
                {
 
121
                        // @todo (0000): fp> don't display this if categories plugin not installed... or depluginize categories (I'm not sure)
 
122
                        echo $this->disp_params['item_start'];
 
123
                        echo '<strong><a href="'.$Blog->get( 'catdirurl' ).'" title="'.T_('visit this blog\'s categories').'">'.T_('Categories').'</a></strong>';
 
124
                        echo $this->disp_params['item_end'];
 
125
                }
 
126
 
 
127
                if( $this->disp_params['show_latestcomments'] )
 
128
                {
 
129
                        echo $this->disp_params['item_start'];
 
130
                        echo '<strong><a href="'.$Blog->get( 'lastcommentsurl' ).'" title="'.T_('see this blog\'s latest comments').'">'.T_('Latest comments').'</a></strong>';
 
131
                        echo $this->disp_params['item_end'];
 
132
                }
 
133
 
 
134
                echo $this->disp_params['list_end'];
 
135
                echo $this->disp_params['block_end'];
 
136
 
 
137
                return true;
 
138
        }
 
139
 
 
140
}
 
141
 
 
142
?>