| 1 |
<?php |
<?php |
| 2 |
// $Id: browscap.module,v 1.6.2.3.2.7 2009/09/16 22:11:57 greggles Exp $ |
// $Id: browscap.module,v 1.6.2.3.2.8 2009/09/17 15:04:47 greggles Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 120 |
*/ |
*/ |
| 121 |
|
|
| 122 |
/** |
/** |
| 123 |
* Callback for settings form |
* Callback for settings form. |
| 124 |
* Turn monitoring on or off |
* Turn monitoring on or off and refresh the reference data. |
| 125 |
* |
* |
| 126 |
* @return array |
* @return array |
| 127 |
*/ |
*/ |
| 128 |
function browscap_settings() { |
function browscap_settings() { |
| 129 |
$form['browscap_monitor'] = array( |
$form['browscap_data_status'] = array( |
| 130 |
'#type' => 'checkbox', |
'#value' => t('<p>Browscap data current as of %fileversion. [<a href="!refresh">Refresh now</a>]</p>', |
|
'#prefix' => t('<p>Browscap data current as of %fileversion. [<a href="!refresh">Refresh now</a>]</p>', |
|
| 131 |
array( |
array( |
| 132 |
'%fileversion' => variable_get('browscap_version', t('Never fetched')), |
'%fileversion' => variable_get('browscap_version', t('Never fetched')), |
| 133 |
'!refresh' => url('admin/settings/browscap/refresh'), |
'!refresh' => url('admin/settings/browscap/refresh'), |
| 134 |
)), |
)), |
| 135 |
|
); |
| 136 |
|
|
| 137 |
|
$form['browscap_monitor'] = array( |
| 138 |
|
'#type' => 'checkbox', |
| 139 |
'#title' => t('Monitor browsers'), |
'#title' => t('Monitor browsers'), |
| 140 |
'#default_value' => variable_get('browscap_monitor', FALSE), |
'#default_value' => variable_get('browscap_monitor', FALSE), |
| 141 |
'#description' => t('Monitor all user agents visiting the site.') |
'#description' => t('Monitor all user agents visiting the site. View the reports in the <a href="!reports">Browscap reports</a> area.', |
| 142 |
|
array( |
| 143 |
|
'!reports' => url('admin/reports/browscap'), |
| 144 |
|
)), |
| 145 |
); |
); |
| 146 |
return system_settings_form($form); |
return system_settings_form($form); |
| 147 |
} |
} |
| 148 |
|
|
| 149 |
|
/** |
| 150 |
|
* Simple page callback to manually refresh the data. |
| 151 |
|
* |
| 152 |
|
*/ |
| 153 |
function browscap_refresh() { |
function browscap_refresh() { |
| 154 |
_browscap_import(FALSE); |
_browscap_import(FALSE); |
| 155 |
drupal_goto('admin/settings/browscap'); |
drupal_goto('admin/settings/browscap'); |
| 236 |
$rows[] = array(array('data' => $pager, 'colspan' => 2)); |
$rows[] = array(array('data' => $pager, 'colspan' => 2)); |
| 237 |
} |
} |
| 238 |
|
|
| 239 |
$output = theme('table', $header, $rows); |
$output = ''; |
| 240 |
|
if (empty($rows)) { |
| 241 |
|
$output .= t('It appears that your site has not recorded any visits. If you want to record the visitors to your site you can enable "Monitor browsers" on the <a href="!settings_uri">Browscap settings screen</a>.', array('!settings_uri' => url('admin/settings/browscap'))); |
| 242 |
|
} |
| 243 |
|
$output .= theme('table', $header, $rows); |
| 244 |
|
|
| 245 |
print theme('page', $output, $title); |
print theme('page', $output, $title); |
| 246 |
} |
} |