Changeset 11615 for extensions/Copyrights
- Timestamp:
- Jul 4, 2011, 12:33:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Copyrights/batch_single.php
r11505 r11615 3 3 // Add a prefilter 4 4 add_event_handler('loc_end_element_set_unit', 'set_prefilter_batch_single', 55 ); 5 add_event_handler('loc_end_element_set_unit', 'CR_batch_single_submit', 55 ); 5 6 6 7 // Change the variables used by the function that changes the template 7 //add_event_handler('loc_begin_admin', ' copyrights_add_bsm_vars_to_template');8 //add_event_handler('loc_begin_admin', 'CR_add_bsm_vars_to_template'); 8 9 9 10 function set_prefilter_batch_single() 10 11 { 11 12 global $template; 12 $template->set_prefilter('batch_manager_unit', ' copyrights_batch_single');13 $template->set_prefilter('batch_manager_unit', 'CR_batch_single'); 13 14 } 14 15 15 function copyrights_batch_single($content, &$smarty)16 function CR_batch_single($content, &$smarty) 16 17 { 17 18 $search = "#<td><strong>{'Creation date'#"; // Not ideal, but ok for now :) … … 34 35 } 35 36 36 function copyrights_add_bsm_vars_to_template()37 function CR_add_bsm_vars_to_template() 37 38 { 38 39 //global $page, $template, $prefixeTable; … … 49 50 } 50 51 52 function CR_batch_single_submit() 53 { 54 // The image id's: 55 $collection = explode(',', $_POST['element_ids']); 56 57 // Delete all existing id's of which the Copyright is going to be set 58 if (count($collection) > 0) { 59 $query = sprintf( 60 'DELETE 61 FROM %s 62 WHERE media_id IN (%s) 63 ;', 64 COPYRIGHTS_MEDIA, implode(',', $collection)); 65 pwg_query($query); 66 } 67 $edits = array(); 68 foreach ($collection as $image_id) 69 { 70 // The copyright id's 71 $crID = pwg_db_real_escape_string($_POST['copyrightID-'.$image_id]); 72 73 array_push( 74 $edits, 75 array( 76 'media_id' => $image_id, 77 'cr_id' => $crID, 78 ) 79 ); 80 } 81 mass_inserts( 82 COPYRIGHTS_MEDIA, // Table name 83 array_keys($edits[0]), // Columns 84 $edits // Data 85 ); 86 } 87 51 88 ?>
Note: See TracChangeset
for help on using the changeset viewer.