set_prefilter('batch_manager_unit', 'CR_batch_single');
}
function CR_batch_single($content, &$smarty)
{
$search = "#
{'Creation date'#"; // Not ideal, but ok for now :)
// We use the from the Creation date, and give them a new
$replacement = 'DWO TESTJE |
DWO TESTJE
|
{\'Creation date\'';
return preg_replace($search, $replacement, $content);
// Dit is een interresant testje - deze functie word dus een aantal keren (3) aangeroepen,
// en pas de laatste keer is bevat $content meer dan een aantal enters...
//return $content.' '.$content.' ';
}
function CR_add_bsm_vars_to_template()
{
//global $page, $template, $prefixeTable;
// Show block only on the photo page
//if ( !empty($page['image_id']) )
//{
// Sending data to the template
//$template->assign(
//array (
//'CR_TEST' => 'TEST'
// ));
//}
}
function CR_batch_single_submit()
{
// The image id's:
$collection = explode(',', $_POST['element_ids']);
// Delete all existing id's of which the Copyright is going to be set
if (count($collection) > 0) {
$query = sprintf(
'DELETE
FROM %s
WHERE media_id IN (%s)
;',
COPYRIGHTS_MEDIA, implode(',', $collection));
pwg_query($query);
}
$edits = array();
foreach ($collection as $image_id)
{
// The copyright id's
$crID = pwg_db_real_escape_string($_POST['copyrightID-'.$image_id]);
array_push(
$edits,
array(
'media_id' => $image_id,
'cr_id' => $crID,
)
);
}
mass_inserts(
COPYRIGHTS_MEDIA, // Table name
array_keys($edits[0]), // Columns
$edits // Data
);
}
?>
| |