~quam-plures-core/quam-plures/fix-auto_p_plugin

« back to all changes in this revision

Viewing changes to qp_inc/_core/ui/_uiwidget.class.php

  • Committer: EdB
  • Date: 2013-03-18 19:30:14 UTC
  • mfrom: (7602.1.58 quam-plures)
  • Revision ID: 1912webworks@gmail.com-20130318193014-qogr0c0lwd5ix8lj
quam-plures/qp5_colls-blogs_chaps-cats

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * {@link replace_vars()} that can be used to replace object properties in given
7
7
 * strings. You can also register global action icons.
8
8
 *
9
 
 * @todo (1111): Why is this file where it is and not with all the other widget stuff?
10
 
 * @todo (1111): vars type 'foo' need useful/valid descriptions
11
 
 *
 
9
 * @todo (1111) Why is this file where it is and not with all the other widget stuff?
 
10
 * @todo (1111) vars type 'foo' need useful/valid descriptions
12
11
 * @author {@link http://wonderwinds.com/ Ed Bennett}
13
12
 * @author {@link http://daniel.hahler.de/ Daniel HAHLER}
14
13
 * @author {@link http://fplanque.net/ Francois PLANQUE}
20
19
 
21
20
/**
22
21
 * Widget base class
 
22
 *
23
23
 * @package widgets
24
24
 */
25
25
class Widget
27
27
        /**
28
28
         * Display parameters
29
29
         *
30
 
         * Example params would be 'block_start' and 'block_end'. Params may contain special variables that
31
 
         * will be replaced by replace_vars(). Different types of Widgets will expect different parameters.
 
30
         * Example params would be 'block_start' and 'block_end'. Params may contain special
 
31
         * variables that will be replaced by replace_vars(). Different types of Widgets
 
32
         * will expect different parameters.
 
33
         *
32
34
         * @var array
33
35
         */
34
36
        var $params = NULL;
38
40
         */
39
41
        var $title;
40
42
        /**
41
 
         * List of registered global action icons that get substituted through '$global_icons$'.
 
43
         * List of registered global action icons that get substituted through '$global_icons$'
42
44
         * @see global_icon()
43
45
         * @var array
44
46
         */
63
65
 
64
66
        /**
65
67
         * Registers a global action icon
66
 
         * @todo (3069): $icon_weight and $word_weight are stupid and need to go away forever
 
68
         *
 
69
         * @todo (3069) EdB> $icon_weight and $word_weight are stupid and need to go away forever
67
70
         * @param string TITLE text (IMG and A link)
68
71
         * @param string icon code for {@link get_icon()}
69
72
         * @param string URL to link to
70
 
         * @param integer 1-5: weight of the icon. the icon will be displayed only if its weight is >= than the user setting threshold
71
 
         * @param integer 1-5: weight of the word. the word will be displayed only if its weight is >= than the user setting threshold
 
73
         * @param integer 1-5: weight of the icon. the icon will be displayed only if
 
74
         * its weight is >= than the user setting threshold
 
75
         * @param integer 1-5: weight of the word. the word will be displayed only if
 
76
         * its weight is >= than the user setting threshold
72
77
         * @param array Additional attributes to the A tag. See {@link action_icon()}.
73
78
         */
74
 
        function global_icon( $title, $icon, $url, $word = '', $icon_weight = 3, $word_weight = 2, $link_attribs = array( 'class' => 'action_icon' ) )
 
79
        function global_icon(
 
80
                $title,
 
81
                $icon,
 
82
                $url,
 
83
                $word = '',
 
84
                $icon_weight = 3,
 
85
                $word_weight = 2,
 
86
                $link_attribs = array( 'class' => 'action_icon' ) )
75
87
        {
76
88
                $this->global_icons[] = array(
77
89
                        'title' => $title,
104
116
 
105
117
 
106
118
        /**
107
 
         * Replaces $vars$ with appropriate values.
 
119
         * Replaces $vars$ with appropriate values
108
120
         *
109
121
         * You can give an alternative string to display, if the substituted variable
110
122
         * is empty, like:
111
123
         * <code>$vars "Display if empty"$</code>
112
124
         *
113
125
         * @param string template
114
 
         * @param array optional params that are put into {@link $this->params}
115
 
         * to be accessible by derived replace_callback() methods
 
126
         * @param array optional params that are put into {@link $this->params}, to be
 
127
         * accessible by derived replace_callback() methods
116
128
         * @return string The substituted string
117
129
         */
118
130
        function replace_vars( $template, $params = NULL )
134
146
         *
135
147
         * This is an additional wrapper to {@link replace_vars()} that allows
136
148
         * to react on the return value of it. Used by replace_callback()
 
149
         *
137
150
         * @param array {@link preg_match() preg match}
138
151
         * @return string
139
152
         */
159
172
         * Callback function used to replace only necessary values in template
160
173
         *
161
174
         * This gets used by {@link replace_vars()} to replace $vars$.
 
175
         *
162
176
         * @param array {@link preg_match() preg match}. Index 1 is the template variable.
163
177
         * @return string to be substituted
164
178
         */
212
226
 
213
227
/**
214
228
 * Class Table
215
 
 * @todo (0000): shouldn't this be in a separate file?
216
 
 * @todo (1111): vars type 'foo' need useful/valid descriptions
 
229
 *
 
230
 * @todo (0000) shouldn't this be in a separate file?
 
231
 * @todo (1111) vars type 'foo' need useful/valid descriptions
217
232
 * @package core
218
233
 */
219
234
class Table extends Widget
271
286
 
272
287
        /**
273
288
         * Constructor
 
289
         *
274
290
         * @param string template name to get from $AdminUI
275
291
         * @param string prefix to differentiate page/order/filter params
276
292
         */
286
302
         * Initialize things in order to be ready for displaying
287
303
         *
288
304
         * Lazy fills $this->params
 
305
         *
289
306
         * @param array ***please document***
290
307
         * @param array Fadeout settings array( 'key column' => array of values ) or 'session'
291
308
         */
345
362
 
346
363
        /**
347
364
         * Display options area
 
365
         *
348
366
         * @param string name of the option ( ma_colselect, tsk_filter....)
349
367
         * @param string area name ( colselect_area, filter_area )
350
368
         * @param string option title
934
952
 
935
953
                if( ( $this->displayed_cols_count == 0 ) && isset( $this->params['col_start_first'] ) )
936
954
                {
937
 
                        // Display first column column start:
 
955
                        // Display first column column start
938
956
                        $output = $this->params['col_start_first'];
939
957
                        // Add the total column class in the col start first param class
940
958
                        $output = str_replace( '$class$', $class, $output );
972
990
         * Widget callback for template vars
973
991
         *
974
992
         * This allows to replace template vars, see {@link Widget::replace_callback()}.
 
993
         *
975
994
         * @return string
976
995
         */
977
996
        function replace_callback( $matches )