function auditfiles_notindb_form in Audit Files 5
Same name and namespace in other branches
- 6.3 notindb.admin.inc \auditfiles_notindb_form()
- 6.2 notindb.admin.inc \auditfiles_notindb_form()
Menu callback: audit files not in the database.
1 string reference to 'auditfiles_notindb_form'
- auditfiles_notindb in ./
auditfiles.module - Menu callback; audit files not in the database.
File
- ./
auditfiles.module, line 145
Code
function auditfiles_notindb_form() {
global $form_values;
// Get the list of files that aren't in the database
$filesnotindb = _auditfiles_filesnotindb();
// Output count at top of form
if ($filesnotindb) {
$form['count'] = array(
'#value' => format_plural(count($filesnotindb), '1 file found.', '@count files found.'),
);
}
else {
$form['count'] = array(
'#value' => t('No files found.'),
);
}
// Action button
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Action'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$options = array(
'donothing' => t('Do nothing'),
'delete' => t('Delete checked files'),
);
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => 'donothing',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
// Process each result in turn and build check box list
$files_dir = file_directory_path();
foreach ($filesnotindb as $file) {
$files[$file] = '';
// Can't use file_create_url as the links fail if the site uses private transfers
// Force a public url instead
$form['file'][$file] = array(
'#value' => l($file, $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $file)),
);
}
$form['files'] = array(
'#type' => 'checkboxes',
'#options' => $files,
);
return $form;
}