Index: extensions/Copyrights/batch_global.php =================================================================== --- extensions/Copyrights/batch_global.php (revision 11423) +++ extensions/Copyrights/batch_global.php (revision 11439) @@ -16,34 +16,33 @@ function copyrights_batch_global() { - global $template; + global $template; - load_language('plugin.lang', dirname(__FILE__).'/'); // Engels is voorlopig goed zat + load_language('plugin.lang', dirname(__FILE__).'/'); - // Assign the template for batch management - $template->set_filename('batch_global', dirname(__FILE__).'/batch_global.tpl'); + // Assign the template for batch management + $template->set_filename('batch_global', dirname(__FILE__).'/batch_global.tpl'); - // Fetch all the copyrights and assign them to the template - $query = sprintf( - 'SELECT `cr_id`,`name` - FROM %s - WHERE `visible`<>0 - ;', - COPYRIGHTS_ADMIN); - $result = pwg_query($query); - $CRoptions = array(); - while ($row = pwg_db_fetch_assoc($result)) { - $CRoptions[$row['cr_id']] = $row['name']; - } - $template->assign('CRoptions', $CRoptions); + // Fetch all the copyrights and assign them to the template + $query = sprintf( + 'SELECT `cr_id`,`name` + FROM %s + WHERE `visible`<>0 + ;', + COPYRIGHTS_ADMIN); + $result = pwg_query($query); + $CRoptions = array(); + while ($row = pwg_db_fetch_assoc($result)) { + $CRoptions[$row['cr_id']] = $row['name']; + } + $template->assign('CRoptions', $CRoptions); - - // Goed, ik weet dus echt niet waarom dit hieronder gedaan wordt... - // AHA!!!! - dit is er zodat de "choose action" optie deze plugin gebruikt.... - $template->append('element_set_global_plugins_actions', array( - 'ID' => 'copyrights', // ID of the batch manager action - 'NAME' => l10n('Edit copyright'), // Description of the batch manager action - 'CONTENT' => $template->parse('batch_global', true) - ) - ); + + // Add info on the "choose action" dropdown in the batch manager + $template->append('element_set_global_plugins_actions', array( + 'ID' => 'copyrights', // ID of the batch manager action + 'NAME' => l10n('Edit copyright'), // Description of the batch manager action + 'CONTENT' => $template->parse('batch_global', true) + ) + ); } @@ -53,36 +52,37 @@ function copyrights_batch_global_submit($action, $collection) { - if ($action == 'copyrights') - { - $crID = pwg_db_real_escape_string($_POST['copyrightID']); - - if (count($collection) > 0) { - $query = sprintf( - 'DELETE - FROM %s - WHERE media_id IN (%s) - ;', - COPYRIGHTS_MEDIA, implode(',', $collection)); - pwg_query($query); - } + // If its our plugin that is called + if ($action == 'copyrights') + { + $crID = pwg_db_real_escape_string($_POST['copyrightID']); - $edits = array(); - foreach ($collection as $image_id) - { - array_push( - $edits, - array( - 'media_id' => $image_id, - 'cr_id' => $crID, - ) - ); - } + if (count($collection) > 0) { + $query = sprintf( + 'DELETE + FROM %s + WHERE media_id IN (%s) + ;', + COPYRIGHTS_MEDIA, implode(',', $collection)); + pwg_query($query); + } - mass_inserts( - COPYRIGHTS_MEDIA, // Table name - array_keys($edits[0]), //Columns - $edits // Data - ); - } + $edits = array(); + foreach ($collection as $image_id) + { + array_push( + $edits, + array( + 'media_id' => $image_id, + 'cr_id' => $crID, + ) + ); + } + + mass_inserts( + COPYRIGHTS_MEDIA, // Table name + array_keys($edits[0]), //Columns + $edits // Data + ); + } } Index: extensions/Copyrights/batch_single.php =================================================================== --- extensions/Copyrights/batch_single.php (revision 11423) +++ extensions/Copyrights/batch_single.php (revision 11439) @@ -10,8 +10,34 @@ add_event_handler('loc_begin_admin', 'set_prefilter_batch_single', 55 ); +// Change the variables used by the function that changes the template +//add_event_handler('loc_begin_admin', 'copyrights_add_bsm_vars_to_template'); + function set_prefilter_batch_single() { + //mail("matheiusb@gmail.com", "Content of $content", $content); global $template; - $template->set_prefilter('picture', 'copyrights_batch_single'); + $template->set_prefilter('batch_manager_unit', 'copyrights_batch_single'); +} + +function copyrights_batch_single($content, &$smarty) +{ + //mail("matheiusb@gmail.com", "Content of $content", $content); + //$content = $content.'