/[drupal]/contributions/modules/counter/counter.settings.inc
ViewVC logotype

Contents of /contributions/modules/counter/counter.settings.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Mon Oct 26 04:58:57 2009 UTC (4 weeks, 4 days ago) by thenicespider
Branch: MAIN
CVS Tags: DRUPAL-6--2-3, DRUPAL-6--2-2, HEAD
Changes since 1.4: +38 -5 lines
File MIME type: text/x-php
6.x-2.2: New: Show Block/Unblock Users
         New: Redesign "Counter Settings" page
         New: Variable to show how many items per page on Counter Report
         Bug fix: Error on Counter Report when i18n module enable
1 <?php
2 // $Id: counter.settings.inc,v 1.4 2009/09/25 22:21:12 thenicespider Exp $
3 /**
4 * @file
5 * Settings page callback file for the counter module.
6 */
7
8 /**
9 * Menu callback;
10 */
11
12 function counter_admin_settings() {
13 $form = array();
14 // only administrators can access this function
15
16 // Generate the form - settings applying to all patterns first
17 $form['counter_settings'] = array(
18 '#type' => 'fieldset',
19 '#weight' => -30,
20 '#title' => t('Basic settings'),
21 '#collapsible' => TRUE,
22 '#collapsed' => FALSE
23 );
24
25 $form['counter_settings']['counter_show_site_counter'] = array(
26 '#type' => 'checkbox',
27 '#title' => t('Show Site Counter'),
28 '#default_value' => variable_get('counter_show_site_counter', 1),
29 '#description' => t('Show Site Counter')
30 );
31
32 $form['counter_settings']['counter_show_unique_visitor'] = array(
33 '#type' => 'checkbox',
34 '#title' => t('Show Unique Visitors'),
35 '#default_value' => variable_get('counter_show_unique_visitor', 1),
36 '#description' => t('Show Unique Visitors based on their IP')
37 );
38
39 $form['counter_settings']['counter_registered_user'] = array(
40 '#type' => 'checkbox',
41 '#title' => t('Show Registered Users'),
42 '#default_value' => variable_get('counter_registered_user', 1),
43 '#description' => t('Show Registered Users')
44 );
45
46 $form['counter_settings']['counter_unregistered_user'] = array(
47 '#type' => 'checkbox',
48 '#title' => t('Show Unregistered Users'),
49 '#default_value' => variable_get('counter_unregistered_user', 1),
50 '#description' => t('Show Unregistered Users')
51 );
52
53 $form['counter_settings']['counter_blocked_user'] = array(
54 '#type' => 'checkbox',
55 '#title' => t('Show Blocked Users'),
56 '#default_value' => variable_get('counter_blocked_user', 1),
57 '#description' => t('Show Blocked Users')
58 );
59
60 $form['counter_settings']['counter_published_node'] = array(
61 '#type' => 'checkbox',
62 '#title' => t('Show Published Nodes'),
63 '#default_value' => variable_get('counter_published_node', 1),
64 '#description' => t('Show Published Nodes')
65 );
66
67 $form['counter_settings']['counter_unpublished_node'] = array(
68 '#type' => 'checkbox',
69 '#title' => t('Show Unpublished Nodes'),
70 '#default_value' => variable_get('counter_unpublished_node', 1),
71 '#description' => t('Show Unpublished Users')
72 );
73
74 $form['counter_settings']['counter_show_server_ip'] = array(
75 '#type' => 'checkbox',
76 '#title' => t('Show Web Server IP'),
77 '#default_value' => variable_get('counter_show_server_ip', 1),
78 '#description' => t('Show Web Server IP')
79 );
80
81 $form['counter_settings']['counter_show_ip'] = array(
82 '#type' => 'checkbox',
83 '#title' => t('Show Client IP'),
84 '#default_value' => variable_get('counter_show_ip', 1),
85 '#description' => t('Show Client IP')
86 );
87
88 $form['counter_settings']['counter_show_counter_since'] = array(
89 '#type' => 'checkbox',
90 '#title' => t('Show Site Counter Since'),
91 '#default_value' => variable_get('counter_show_counter_since', 1),
92 '#description' => t('Show the first entry date in the Site Counter')
93 );
94
95 return system_settings_form($form);
96 }
97 function counter_settings_advanced() {
98 $form['counter_advanced'] = array(
99 '#type' => 'fieldset',
100 '#weight' => -20,
101 '#title' => t('Advanced settings'),
102 '#collapsible' => TRUE,
103 '#collapsed' => FALSE
104 );
105
106 $form['counter_advanced']['counter_show_administer_only'] = array(
107 '#type' => 'checkbox',
108 '#title' => t('Show Site Counter Result for Administer group only'),
109 '#default_value' => variable_get('counter_show_administer_only', 0),
110 '#description' => t("Show Site Counter block for role with 'administer counter' rights only. This setting usefull if you enable Counter block for any pages but want to hide it from public users except for admin.")
111 );
112
113 $form['counter_advanced']['counter_skip_admin'] = array(
114 '#type' => 'checkbox',
115 '#title' => t('Skip admin'),
116 '#default_value' => variable_get('counter_skip_admin', 0),
117 '#description' => t("Do not count when visitor is admin (uid=0).")
118 );
119
120 $form['counter_advanced']['counter_refresh_delay'] = array(
121 '#type' => 'textfield',
122 '#title' => t('Delay before refresh counter data (in second)'),
123 '#default_value' => variable_get('counter_refresh_delay', 10),
124 '#description' => t("Delay before re-calculate counter data, otherwise read from previous value."),
125 );
126
127 $form['counter_advanced']['counter_insert_delay'] = array(
128 '#type' => 'textfield',
129 '#title' => t('Delay before next insert (in second)'),
130 '#default_value' => variable_get('counter_insert_delay', 1),
131 '#description' => t("Wait for certain second before next insert. Increase this value if your server can not handle too much data recording. Set to 0 for no delay."),
132 );
133
134 return system_settings_form($form);
135 }
136
137 function counter_settings_initial() {
138 $form['counter_initial'] = array(
139 '#type' => 'fieldset',
140 '#weight' => -10,
141 '#title' => t('Initial Values'),
142 '#collapsible' => TRUE,
143 '#collapsed' => FALSE,
144 '#description' => t("Set initial values for Site Counter.")
145 );
146
147 $form['counter_initial']['counter_initial_counter'] = array(
148 '#type' => 'textfield',
149 '#title' => t('Initial value of Site Counter'),
150 '#default_value' => variable_get('counter_initial_counter', 0),
151 '#description' => t('Initial value of Site Counter')
152 );
153
154 $form['counter_initial']['counter_initial_unique_visitor'] = array(
155 '#type' => 'textfield',
156 '#title' => t('Initial value of Unique Visitor'),
157 '#default_value' => variable_get('counter_initial_unique_visitor', 0),
158 '#description' => t('Initial value of Unique Visitor')
159 );
160
161 $form['counter_initial']['counter_initial_since'] = array(
162 '#type' => 'textfield',
163 '#title' => t("Replace 'Since' value with this string"),
164 '#default_value' => variable_get('counter_initial_since', ''),
165 '#description' => t("If you leave this field blank then Counter module will use data from first inserted row of Counter table. This field type is textfield, so you can enter: '2008-08-12 or 12 August 2008 06:39'.")
166 );
167
168 return system_settings_form($form);
169 }
170
171 function counter_settings_report() {
172 $form['counter_report'] = array(
173 '#type' => 'fieldset',
174 '#weight' => -10,
175 '#title' => t('Report'),
176 '#collapsible' => TRUE,
177 '#collapsed' => FALSE,
178 '#description' => l(t('Click here to access: Site Counter Report'), "counter/report")
179 );
180
181 $form['counter_initial']['counter_report_page_item'] = array(
182 '#type' => 'textfield',
183 '#title' => t('Items per page'),
184 '#default_value' => variable_get('counter_report_page_item', 50),
185 '#description' => t('Items per page on Counter Report')
186 );
187
188 return system_settings_form($form);
189 }

  ViewVC Help
Powered by ViewVC 1.1.2