function lingotek_config_action_submit in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.6 lingotek.config.inc \lingotek_config_action_submit()
Submit function for The Grid's actions The action corresponds to the key of the option selected Often redirects to batch operations or to other pages entirely
1 string reference to 'lingotek_config_action_submit'
File
- ./
lingotek.config.inc, line 454 - Config grid form elements
Code
function lingotek_config_action_submit($form, $form_state) {
$lids = array();
if (isset($form_state['clicked_button']) && $form_state['clicked_button']['#name'] == 'submit_actions') {
// If submitting an action
foreach ($form_state['values']['the_grid'] as $value) {
if ($value != 0) {
$lids[] = $value;
}
}
if (isset($form_state['values']['select_actions'])) {
// If an action was selected (which it would be, I don't know if this could ever NOT occur with normal use)
$action = $form_state['values']['select_actions'];
// Get the action
if (count($lids) <= 0) {
// Select a node
drupal_set_message(t('You must select at least one node to @action.', array(
'@action' => $action,
)), 'warning');
// Or pay the price
}
elseif ($action == 'upload') {
// If uploading
lingotek_config_upload_selected($lids);
}
elseif (substr($action, 0, 8) == 'download') {
// If downloading all targets
lingotek_config_download_selected($action, $lids);
}
elseif ($action == 'sync') {
// If syncing the progress
lingotek_config_update_selected($lids);
// Run batch operations to get the progress report from Lingotek
}
elseif ($action == 'delete' || $action == 'reset') {
// ajax ctools modal employed (see lingotek_bulk_grid_form() and lingotek.bulk_grid.js)
}
elseif ($action == 'marked') {
lingotek_config_mark_items($lids);
}
elseif ($action == 'unmarked') {
lingotek_config_unmark_items($lids);
}
}
}
}