function track_da_files_config_form in Track da files 8
Same name and namespace in other branches
- 7 includes/track_da_files.admin.inc \track_da_files_config_form()
Settings form.
File
- includes/
track_da_files.admin.inc, line 11 - Administrative page callbacks for Track da files module.
Code
function track_da_files_config_form() {
// Variable which stores options to show in main reports.
$track_da_files_report_datas = variable_get('track_da_files_report_datas', array(
'total_ips',
'average_by_ip',
'last_display',
));
// Variable which stores datas that will appear in files displays reports.
$track_da_files_report_files_datas = variable_get('track_da_files_report_files_datas', array(
'timestamp',
'filesize',
'filemime',
));
// Variable which stores stores options to show in file specific report.
$track_da_files_single_file_report_datas = variable_get('track_da_files_single_file_report_datas', array(
'id',
'referer',
'browser',
'browser_version',
'browser_platform',
'ip',
'uid',
));
// Variable which stores value for enabling user specific report.
$track_da_files_user_report_enabled = variable_get('track_da_files_user_report_enabled', 1);
// Variable which stores stores options to show in user specific report.
$track_da_files_single_user_report_datas = variable_get('track_da_files_single_user_report_datas', array(
'referer',
'browser',
'browser_version',
'browser_platform',
'ip',
));
// Variable storing value for enabling showing tracking datas on the site.
$track_da_files_file_field_links_show_enabled = variable_get('track_da_files_file_field_links_show_enabled', 1);
if (module_exists('colorbox')) {
$track_da_files_colorbox_enabled = variable_get('track_da_files_colorbox_enabled', 0);
}
$form['track_da_files'] = array(
'#type' => 'vertical_tabs',
);
// Main report configuration section.
$form['track_da_files']['track_da_files_report_datas'] = array(
'#type' => 'fieldset',
'#title' => t('Main report'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['track_da_files']['track_da_files_report_datas']['track_da_files_report_datas'] = array(
'#type' => 'checkboxes',
'#title' => t('Displays datas to show in main report'),
'#options' => array(
'total_ips' => t('Total ips'),
'average_by_ip' => t('Average count by ip'),
'last_display' => t('Last display date'),
),
'#default_value' => $track_da_files_report_datas,
'#description' => t('Datas that will appear in main files displays reports.'),
);
$form['track_da_files']['track_da_files_report_datas']['track_da_files_report_files_datas'] = array(
'#type' => 'checkboxes',
'#title' => t('Files datas to show in main report'),
'#options' => array(
'timestamp' => t('Created'),
'filesize' => t('File size'),
'filemime' => t('File mime'),
),
'#default_value' => $track_da_files_report_files_datas,
'#description' => t('Specific files datas that will appear in main report.'),
);
// File specific report configuration section.
$form['track_da_files']['file_specific_reports'] = array(
'#type' => 'fieldset',
'#title' => t('File report'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['track_da_files']['file_specific_reports']['track_da_files_single_file_report_datas'] = array(
'#type' => 'checkboxes',
'#title' => t('Displays datas to show in file report'),
'#options' => array(
'id' => t('Related content'),
'browser' => t('Browser'),
'browser_version' => t('Browser version'),
'browser_platform' => t('Browser platform'),
'referer' => t('Displayed from URL'),
'ip' => t('Ip'),
'uid' => t('User who displayed file'),
),
'#default_value' => $track_da_files_single_file_report_datas,
'#description' => t('Datas that will appear in file specific report.'),
);
// User specific report configuration section.
$form['track_da_files']['user_specific_reports'] = array(
'#type' => 'fieldset',
'#title' => t('User report'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['track_da_files']['user_specific_reports']['track_da_files_user_report_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable user specific report'),
'#default_value' => $track_da_files_user_report_enabled,
);
$form['track_da_files']['user_specific_reports']['track_da_files_single_user_report_datas'] = array(
'#type' => 'checkboxes',
'#title' => t('Displays datas to show in user report'),
'#options' => array(
'browser' => t('Browser'),
'browser_version' => t('Browser version'),
'browser_platform' => t('Browser platform'),
'referer' => t('Displayed from URL'),
'ip' => t('Ip'),
),
'#default_value' => $track_da_files_single_user_report_datas,
'#description' => t('Datas that will appear in users displays reports.'),
'#states' => array(
'visible' => array(
':input[name=track_da_files_user_report_enabled]' => array(
'checked' => TRUE,
),
),
),
);
// Configure to show datas near from file field links.
$form['file_field_links_show'] = array(
'#type' => 'fieldset',
'#title' => t('File field links'),
);
$form['file_field_links_show']['track_da_files_file_field_links_show_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Provide counter near file field links'),
'#default_value' => $track_da_files_file_field_links_show_enabled,
'#description' => t('A counter showing number of times a file has been displayed will appear in a near from files links'),
);
if (module_exists('colorbox')) {
$form['track_da_files_colorbox'] = array(
'#type' => 'fieldset',
'#title' => t('Colorbox'),
);
$form['track_da_files_colorbox']['track_da_files_colorbox_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Track da files colorbox compatibility'),
'#default_value' => $track_da_files_colorbox_enabled,
'#description' => t('When enabled, in content interface select display "tdf : Colorbox image" for desired fields'),
);
}
// Render the role overview.
$form['track_da_files_roles']['role_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Roles'),
);
$form['track_da_files_roles']['role_settings']['track_da_files_roles'] = array(
'#type' => 'radios',
'#title' => t('Add tracking for roles'),
'#options' => array(
t('Add to the selected roles only'),
t('Add to every role except the selected ones'),
),
'#default_value' => variable_get('track_da_files_roles', 0),
);
$role_options = array_map('check_plain', user_roles());
$form['track_da_files_roles']['role_settings']['track_da_files_specific_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#default_value' => variable_get('track_da_files_specific_roles', array()),
'#options' => $role_options,
'#description' => t('If none of the roles are selected, all users will be tracked. If a user has any of the roles checked, that user will be tracked (or excluded, depending on the setting above).'),
);
return system_settings_form($form);
}