Ignore:
Timestamp:
Jul 9, 2011, 4:43:05 PM (13 years ago)
Author:
J.Commelin
Message:

Finished adding comments to the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Copyrights/batch_single.php

    r11635 r11678  
    11<?php
    22
    3 // Add a prefilter
     3// Add event handlers for the prefilter
    44add_event_handler('loc_end_element_set_unit', 'CR_set_prefilter_batch_single', 55 );
    55add_event_handler('loc_begin_element_set_unit', 'CR_batch_single_submit', 50 );
     
    88add_event_handler('loc_end_element_set_unit', 'CR_add_batch_single_vars_to_template');
    99
     10// Add a prefilter to the template
    1011function CR_set_prefilter_batch_single()
    1112{
     
    1415}
    1516
     17// Insert the copyright selector to the template
    1618function CR_batch_single($content, &$smarty)
    1719{
    18         $search = "#<td><strong>{'Creation date'#"; // Not ideal, but ok for now :)
     20        $search = "#<td><strong>{'Creation date'#";
    1921
    2022        // We use the <tr> from the Creation date, and give them a new <tr>
     
    3133                <td><strong>{\'Creation date\'';
    3234
    33     return preg_replace($search, $replacement, $content);
    34        
    35         // Dit is een interresant testje - deze functie word dus een aantal keren (3) aangeroepen,
    36         // en pas de laatste keer is bevat $content meer dan een aantal enters...
    37         // return $content.'<div id="dwo_test" style="display: none;">'.$content.'</div>';
     35  return preg_replace($search, $replacement, $content);
    3836}
    3937
     38// Assign the variables to the Smarty template
    4039function CR_add_batch_single_vars_to_template()
    4140{
     
    7069        while ($row = pwg_db_fetch_assoc($result)) {
    7170                $CRcopyrights[$row['media_id']] = $row['cr_id'];
    72         }
     71  }
     72
     73  // Assign the copyrights to the template
    7374        $template->assign('CRcopyrights', $CRcopyrights);
    7475}
    7576
     77// Catch the submit and update the copyrights tables
    7678function CR_batch_single_submit()
    7779{
     
    8183                $collection = explode(',', $_POST['element_ids']);
    8284
    83                 // Delete all existing id's of which the Copyright is going to be set
     85                // Delete all existing id's of which the copyright is going to be set
    8486                if (count($collection) > 0) {
    8587                        $query = sprintf(
     
    9092                                COPYRIGHTS_MEDIA, implode(',', $collection));
    9193                        pwg_query($query);
    92                 }
    93                 // Add all Copyrights to an array
     94    }
     95
     96                // Add all copyrights to an array
    9497                $edits = array();
    9598                foreach ($collection as $image_id) {
     
    105108                                )
    106109                        );
    107                 }
    108                 // Add the array to the database
     110    }
     111
     112                // Insert the array to the database
    109113                mass_inserts(
    110114                        COPYRIGHTS_MEDIA,        // Table name
Note: See TracChangeset for help on using the changeset viewer.