';
// print_r($contents);
echo '';
// Identify orphans
foreach ($contents as $ad)
if (!array_key_exists($ad['position'], $positions)) $contents[$ad['id']]['position'] = '-';
// Save the changes
update_post_meta(get_option('administer_post_id'), 'administer_content', $contents);
// Group the content according to position & sort
$content = array();
foreach($contents as $ad) {
$content[$ad['position']][$ad['id']] = $ad;
}
ksort($content);
// Create the JavaScript for toggling all of them
$js_toggle_all = '';
$keys = array_keys($content);
for ($i = 0 ; $i < count($content); $i++)
if (!empty($content[$keys[$i]]))
$js_toggle_all .= "\$('pos_" . $i . "').toggle(); ";
?>
id="pos_">
';
}
}
?>