/** * Удаляет документы. * * @param unknown_type $doc_id * @param unknown_type $doc_section_id * * @return unknown */ function DeleteDoc($doc_id, $doc_section_id = false) { $objResponse = new xajaxResponse(); if (hasPermissions('docs')) { $error = false; if (!($error = docs::Delete($doc_id))) { $docs = docs::getDocs(); $sections = docs_sections::getSections(); $page = $_SERVER['DOCUMENT_ROOT'] . '/service/docs/admin_docs.php'; ob_start(); include $page; $html = ob_get_contents(); ob_end_clean(); $objResponse->assign('admin_docs', 'innerHTML', $html); if ($doc_section_id) { $cnt = (int) count(docs::getDocs($doc_section_id)); $objResponse->assign('count_docs_' . $doc_section_id, 'innerHTML', $cnt); if ($cnt == 0) { $objResponse->script('$("del_block_sec_' . $doc_section_id . '").setStyle("display", "inline");'); } } else { $objResponse->script('document.location.href = "/service/docs/admin/"'); } } else { $objResponse->assign('admin_docs', 'innerHTML', $error); } } return $objResponse; }
$error = true; } if ($error !== false) { $docs = docs::getDocs(); $sections = docs_sections::getSections(); } else { docs::Update(intval($_POST['dosc_id_f']), $_POST['name'], $_POST['desc'], intval($_POST['section'])); foreach ($files_attache as $file) { docs_files::Add(intval($_POST['dosc_id_f']), $file->id, $file->original_name); } header('Location: ' . $_SERVER['REQUEST_URI']); } break; } } else { $docs = docs::getDocs(); $sections = docs_sections::getSections(); } if (!$docs) { $docs = array(); } if (!$sections) { $section = array(); } break; default: include $rpath . '404.php'; exit; break; } //===========Доступные страницы===============