Changeset 11439 for extensions/Copyrights
- Timestamp:
- Jun 20, 2011, 9:05:36 AM (13 years ago)
- Location:
- extensions/Copyrights
- Files:
-
- 3 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 -
extensions/Copyrights/batch_single.php
r11423 r11439 10 10 add_event_handler('loc_begin_admin', 'set_prefilter_batch_single', 55 ); 11 11 12 // Change the variables used by the function that changes the template 13 //add_event_handler('loc_begin_admin', 'copyrights_add_bsm_vars_to_template'); 14 12 15 function set_prefilter_batch_single() 13 16 { 17 //mail("matheiusb@gmail.com", "Content of $content", $content); 14 18 global $template; 15 $template->set_prefilter('picture', 'copyrights_batch_single'); 19 $template->set_prefilter('batch_manager_unit', 'copyrights_batch_single'); 20 } 21 22 function copyrights_batch_single($content, &$smarty) 23 { 24 //mail("matheiusb@gmail.com", "Content of $content", $content); 25 //$content = $content.'<div>DWO TEST</div>'; 26 return $content; 27 } 28 29 function copyrights_add_bsm_vars_to_template() 30 { 31 //global $page, $template, $prefixeTable; 32 33 // Show block only on the photo page 34 //if ( !empty($page['image_id']) ) 35 //{ 36 // Sending data to the template 37 //$template->assign( 38 //array ( 39 //'CR_TEST' => 'TEST' 40 // )); 41 //} 16 42 } 17 43 -
extensions/Copyrights/image.php
r11423 r11439 16 16 add_event_handler('loc_begin_picture', 'copyrights_set_prefilter_add_to_pic_info', 55 ); 17 17 18 // Another function of which i cant see the use ;-)18 // Change the variables used by the function that changes the template 19 19 add_event_handler('loc_begin_picture', 'copyrights_add_vars_to_template'); 20 21 // The big question is - WHY THIS WAY!!! 20 22 21 23 function copyrights_set_prefilter_add_to_pic_info() … … 42 44 </tr> 43 45 <tr id="datecreate">'; 44 // "Copyright" label is nog hardcoded - moet een @translate achter van de smarty, maar dat laat ik maar aan Johan over =P45 46 46 47 return preg_replace($search, $replacement, $content); … … 49 50 function copyrights_add_vars_to_template() 50 51 { 51 // For as far as i know i only need the $prefixtable, $page and $template52 //global $conf, $page, $template, $tab, $cit, $nbr, $prefixeTable;53 global $page, $template, $prefixeTable;54 //load_language('plugin.lang', ADDINFO_PATH);55 //load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );52 // For as far as i know i only need the $prefixtable, $page and $template 53 //global $conf, $page, $template, $tab, $cit, $nbr, $prefixeTable; 54 global $page, $template, $prefixeTable; 55 //load_language('plugin.lang', ADDINFO_PATH); 56 //load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); 56 57 57 58 // Show block only on the photo page 58 if ( !empty($page['image_id']) ) 59 if ( !empty($page['image_id']) ) 59 60 { 60 61 // Get the copyright name and url (FROM cr_admin) that belongs to the current media_item (FROM cr_media)
Note: See TracChangeset
for help on using the changeset viewer.