fetch($berichtid) <= 0) bericht_ajax_fail('Bericht nicht gefunden', 404); $langs->loadLangs(array('bericht@bericht', 'other')); $out = array(); $pages = BerichtPage::fetchAllForBericht($db, $bericht->id); $out['page_count'] = count($pages); if ($what === 'pages' || $what === 'both') { ob_start(); bericht_print_page_list($pages); $out['pages_html'] = ob_get_clean(); } if ($what === 'attachments' || $what === 'both') { $parent = bericht_fetch_parent($db, $bericht->element_type, $bericht->fk_element); if (!$parent) bericht_ajax_fail('Verknüpftes Objekt nicht gefunden', 404); $attachments = bericht_collect_attachments($db, $parent, $bericht->element_type); $used_paths = bericht_used_source_paths($db, $bericht->id); $by_source = array(); foreach ($attachments as $a) { $by_source[$a['source'].':'.$a['source_ref']][] = $a; } ob_start(); bericht_print_attachment_list($by_source, $used_paths); $out['attachments_html'] = ob_get_clean(); $out['attachment_count'] = count($attachments); } bericht_ajax_ok($out);