'BMPD', 'NAME' => l10n('With no description'), )); return $prefilters; } function BMPD_perform_batch_manager_prefilters($filter_sets, $prefilter) { if ($prefilter == 'BMPD') { $query = ' SELECT id FROM '.IMAGES_TABLE.' WHERE comment is null ;'; $filter_sets[] = array_from_query($query, 'id'); } return $filter_sets; } add_event_handler('get_batch_manager_prefilters', 'BMPD2_add_batch_manager_prefilters'); add_event_handler('perform_batch_manager_prefilters', 'BMPD2_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); function BMPD2_add_batch_manager_prefilters($prefilters) { array_push($prefilters, array( 'ID' => 'BMPD2', 'NAME' => l10n('With description'), )); return $prefilters; } function BMPD2_perform_batch_manager_prefilters($filter_sets, $prefilter) { if ($prefilter == 'BMPD2') { $query = ' SELECT id FROM '.IMAGES_TABLE.' WHERE comment is not null ;'; $filter_sets[] = array_from_query($query, 'id'); } return $filter_sets; } add_event_handler('loc_end_element_set_global', 'BMPD_loc_end_element_set_global'); add_event_handler('element_set_global_action', 'BMPD_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); function BMPD_loc_end_element_set_global() { global $template; $template->append('element_set_global_plugins_actions', array( 'ID' => 'BMPD3', 'NAME' => l10n('Set description'), 'CONTENT' => ' '.l10n('remove description').'
'.l10n('confirm').' ', )); } function BMPD_element_set_global_action($action, $collection) { if ($action == 'BMPD3') { global $page; if (empty($_POST['check_BMPD'])) { array_push($page['warnings'], l10n('You need to confirm')); } else { if (isset($_POST['check_BMPD4'])) { $_POST['BMPD3'] = null; } $datas = array(); foreach ($collection as $image_id) { array_push( $datas, array( 'id' => $image_id, 'comment' => $_POST['BMPD3'] ) ); } mass_updates( IMAGES_TABLE, array('primary' => array('id'), 'update' => array('comment')), $datas ); } } } ?>