filebrowser.form.actions.inc in Filebrowser 6.2
File
filebrowser.form.actions.inc
View source
<?php
function filebrowser_form_actions($form_state, $table, $actions, $node) {
$form = array();
$form['#node'] = $node;
$form['table'] = array(
'#value' => $table,
);
foreach ($node->file_listing as $file_name => $data) {
$form["select_{$data['fid']}"] = array(
'#type' => 'checkbox',
'#prefix' => '<!-- ',
'#suffix' => ' -->',
);
}
$options = array(
'' => t('choose an action'),
);
foreach ($actions as $action) {
$options[$action['operation']] = $action['title'];
}
$form['action'] = array(
'#prefix' => '<br/><div class="container-inline">',
'#title' => t('actions'),
'#type' => 'select',
'#options' => $options,
);
$form['submit'] = array(
'#value' => t('Process'),
'#type' => 'submit',
'#suffix' => '</div><br/>',
);
return $form;
}
function filebrowser_form_actions_submit($form, $form_state) {
if (!empty($form_state['values']['action'])) {
$fids = array();
foreach ($form['#node']->file_listing as $file_name => $data) {
if ($form_state['values']["select_{$data['fid']}"]) {
$fids[] = $data['fid'];
}
}
$result = module_invoke_all('filebrowser_action_process', $form['#node'], $form_state['values']['action'], $fids);
if ($result) {
return $result;
}
}
header('Location: ' . request_uri(), TRUE, 302);
exit;
}