Ignore:
Timestamp:
Jul 4, 2011, 12:33:10 PM (13 years ago)
Author:
J.Commelin
Message:

Functie voor submit toegevoegd. Nu de tpl nog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Copyrights/batch_single.php

    r11505 r11615  
    33// Add a prefilter
    44add_event_handler('loc_end_element_set_unit', 'set_prefilter_batch_single', 55 );
     5add_event_handler('loc_end_element_set_unit', 'CR_batch_single_submit', 55 );
    56
    67// 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');
    89
    910function set_prefilter_batch_single()
    1011{
    1112        global $template;
    12         $template->set_prefilter('batch_manager_unit', 'copyrights_batch_single');
     13        $template->set_prefilter('batch_manager_unit', 'CR_batch_single');
    1314}
    1415
    15 function copyrights_batch_single($content, &$smarty)
     16function CR_batch_single($content, &$smarty)
    1617{
    1718  $search = "#<td><strong>{'Creation date'#"; // Not ideal, but ok for now :)
     
    3435}
    3536
    36 function copyrights_add_bsm_vars_to_template()
     37function CR_add_bsm_vars_to_template()
    3738{
    3839        //global $page, $template, $prefixeTable;
     
    4950}
    5051
     52function 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
    5188?>
Note: See TracChangeset for help on using the changeset viewer.