function getclicky_admin_settings in Clicky - Web Analytics in Real Time 5
Implementation of hook_admin_settings() for configuring the module
1 string reference to 'getclicky_admin_settings'
File
- ./
getclicky.module, line 165
Code
function getclicky_admin_settings() {
$form['account'] = array(
'#type' => 'fieldset',
'#title' => t('Get Clicky Account Settings'),
'#collapsible' => FALSE,
);
$form['account']['getclicky_account'] = array(
'#type' => 'textfield',
'#title' => t('User ID'),
'#default_value' => variable_get('getclicky_account', ''),
'#size' => 15,
'#maxlength' => 20,
'#required' => TRUE,
'#description' => t('The user account is unique to the websites domain. You can obtain a user account from the <a href="@url">Get Clicky</a> website.', array(
'@url' => ' http://getclicky.com/',
)),
);
// Render the role overview.
$result = db_query('SELECT * FROM {role} ORDER BY name');
$form['roles'] = array(
'#type' => 'fieldset',
'#title' => t('User Role Tracking'),
'#collapsible' => TRUE,
'#description' => t('Define what user roles should be tracked by Get Clicky. <strong>Note:</strong> Drupal Admin pages are never tracked.'),
);
$form['roles']['getclicky_track__user1'] = array(
'#type' => 'checkbox',
'#title' => t('Admin (user 1)'),
'#default_value' => variable_get('getclicky_track__user1', FALSE),
);
while ($role = db_fetch_object($result)) {
$form['roles']['getclicky_track_' . $role->rid] = array(
'#type' => 'checkbox',
'#title' => check_plain($role->name),
'#default_value' => variable_get('getclicky_track_' . $role->rid, FALSE),
);
}
$form['getimg'] = array(
'#type' => 'fieldset',
'#title' => t('Enable Image'),
'#collapsible' => TRUE,
'#description' => t(''),
);
$form['getimg']['getclicky_image'] = array(
'#type' => 'checkbox',
'#title' => t('GetClicky Image'),
'#default_value' => variable_get('getclicky_image', FALSE),
);
$form['segmentation'] = array(
'#type' => 'fieldset',
'#title' => t('User Segmentation'),
'#collapsible' => TRUE,
'#description' => t('If your users have profile fields completed, you can track your logged in users based on a defined profile field.'),
);
if (!module_exists('profile')) {
$form['segmentation']['profile'] = array(
'#type' => 'markup',
'#value' => t('You need to activate the !profile to use this feature.', array(
'!profile' => l(t('Profile module'), 'admin/build/modules'),
)),
'#prefix' => '<p>',
'#suffix' => '</p>',
);
}
else {
// Compile a list of fields to show.
$fields = array(
'uid' => t('User ID'),
'name' => t('Username'),
'roles' => t('User Roles'),
);
$result = db_query('SELECT name, title, type, weight FROM {profile_fields} ORDER BY weight');
while ($record = db_fetch_object($result)) {
$fields[$record->name] = $record->title;
}
$form['segmentation']['getclicky_segmentation'] = array(
'#type' => 'select',
'#title' => t('Track'),
'#description' => t('Selecting one or more values allows you to track users by profile values rather than simply an IP address. To select multiple items, hold down CTRL whilst selecting fields.'),
'#default_value' => variable_get('getclicky_segmentation', ''),
'#options' => $fields,
'#size' => 10,
'#multiple' => TRUE,
);
}
$form['getclicky_trackfiles'] = array(
'#type' => 'textfield',
'#title' => t('File Extensions To Track'),
'#default_value' => variable_get('getclicky_trackfiles', GC_TRACKFILES),
'#description' => t('A pipe seperated list of file extensions that should be tracked when clicked. Example !extensions', array(
'!extensions' => GC_TRACKFILES,
)),
);
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('You can add custom Get Clicky code here.'),
);
$form['advanced']['getclicky_codesnippet'] = array(
'#type' => 'textarea',
'#title' => t('JavaScript Code'),
'#default_value' => variable_get('getclicky_codesnippet', ''),
'#rows' => 15,
'#description' => t('Paste <a href="@snippets">custom code snippets here</a>. These will be added to every page that Get Clicky appears on. For help with this feature see the <a href="@blog">cutroni.com blog</a>. <strong>Do not include the <script> tags</strong>, and always end your code with a semicolon (;).', array(
'@snippets' => 'http://drupal.org/node/39282',
'@blog' => 'http://cutroni.com/blog/',
)),
);
return system_settings_form($form);
}