Changeset 11439 for extensions/Copyrights/batch_global.php
- Timestamp:
- Jun 20, 2011, 9:05:36 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Copyrights/batch_global.php
r11423 r11439 16 16 function copyrights_batch_global() 17 17 { 18 18 global $template; 19 19 20 load_language('plugin.lang', dirname(__FILE__).'/'); // Engels is voorlopig goed zat 20 load_language('plugin.lang', dirname(__FILE__).'/'); 21 21 22 23 22 // Assign the template for batch management 23 $template->set_filename('batch_global', dirname(__FILE__).'/batch_global.tpl'); 24 24 25 26 27 28 29 30 31 32 33 34 35 36 37 25 // Fetch all the copyrights and assign them to the template 26 $query = sprintf( 27 'SELECT `cr_id`,`name` 28 FROM %s 29 WHERE `visible`<>0 30 ;', 31 COPYRIGHTS_ADMIN); 32 $result = pwg_query($query); 33 $CRoptions = array(); 34 while ($row = pwg_db_fetch_assoc($result)) { 35 $CRoptions[$row['cr_id']] = $row['name']; 36 } 37 $template->assign('CRoptions', $CRoptions); 38 38 39 40 // Goed, ik weet dus echt niet waarom dit hieronder gedaan wordt... 41 // AHA!!!! - dit is er zodat de "choose action" optie deze plugin gebruikt.... 42 $template->append('element_set_global_plugins_actions', array( 43 'ID' => 'copyrights', // ID of the batch manager action 44 'NAME' => l10n('Edit copyright'), // Description of the batch manager action 45 'CONTENT' => $template->parse('batch_global', true) 46 ) 47 ); 39 40 // Add info on the "choose action" dropdown in the batch manager 41 $template->append('element_set_global_plugins_actions', array( 42 'ID' => 'copyrights', // ID of the batch manager action 43 'NAME' => l10n('Edit copyright'), // Description of the batch manager action 44 'CONTENT' => $template->parse('batch_global', true) 45 ) 46 ); 48 47 } 49 48 … … 53 52 function copyrights_batch_global_submit($action, $collection) 54 53 { 55 if ($action == 'copyrights') 56 { 57 $crID = pwg_db_real_escape_string($_POST['copyrightID']); 58 59 if (count($collection) > 0) { 60 $query = sprintf( 61 'DELETE 62 FROM %s 63 WHERE media_id IN (%s) 64 ;', 65 COPYRIGHTS_MEDIA, implode(',', $collection)); 66 pwg_query($query); 67 } 54 // If its our plugin that is called 55 if ($action == 'copyrights') 56 { 57 $crID = pwg_db_real_escape_string($_POST['copyrightID']); 68 58 69 $edits = array(); 70 foreach ($collection as $image_id) 71 { 72 array_push( 73 $edits, 74 array( 75 'media_id' => $image_id, 76 'cr_id' => $crID, 77 ) 78 ); 79 } 59 if (count($collection) > 0) { 60 $query = sprintf( 61 'DELETE 62 FROM %s 63 WHERE media_id IN (%s) 64 ;', 65 COPYRIGHTS_MEDIA, implode(',', $collection)); 66 pwg_query($query); 67 } 80 68 81 mass_inserts( 82 COPYRIGHTS_MEDIA, // Table name 83 array_keys($edits[0]), //Columns 84 $edits // Data 85 ); 86 } 69 $edits = array(); 70 foreach ($collection as $image_id) 71 { 72 array_push( 73 $edits, 74 array( 75 'media_id' => $image_id, 76 'cr_id' => $crID, 77 ) 78 ); 79 } 80 81 mass_inserts( 82 COPYRIGHTS_MEDIA, // Table name 83 array_keys($edits[0]), //Columns 84 $edits // Data 85 ); 86 } 87 87 } 88 88
Note: See TracChangeset
for help on using the changeset viewer.