Files
itflow/admin/modals/document_template/document_template_export.php
johnnyq 5a3f4ba6f5 Document templates stage 4, export, import, starter pack and report: Admin > Document Templates gets a menu beside New with Import, Export, the report and the starter pack, and each template page gets an Export link; the file carries each template's summary, its text with images embedded, its fill-ins and review interval, leaving who should have one to each install; importing a template already there by name can leave it, add the file's copy alongside or replace it (keeping its documents and who should have one), new ones come in required of no one, content goes through the HTML purifier, and images that only point at the other install's uploads are left out with the message saying how many; the MSP starter pack is rebuilt as 14 templates (Asset Inventory and Vendors and Escalation new) that fill in from the client, pull in its sites, networks, equipment, servers, domains, licenses, vendors and contacts as tables, ask for the rest with typed fill-ins, set 6 or 12 month reviews on the ones that go stale, and are required of no one out of the box; Update on Starter Content now covers document templates, bringing older starter templates up to the new versions while keeping their documents and who should have one; new Document Templates report under Clients & Documentation by template (documents made in the period against the period before, current documents, clients with one, coverage of the clients it is required of, documents due a review) and by client (what each should have, has and is missing, and documents due), filtered by client or by the agent who made them, each table exportable as CSV, and client-restricted users seeing only their clients; no database change; changelog updated
2026-10-18 19:50:42 -04:00

56 lines
2.7 KiB
PHP

<?php
/*
* Export document templates to a file - every current one, or the ones
* picked, and the archived ones if asked - to import into another ITFlow
* (export_document_templates, functions/document_template_transfer.php).
*/
require_once '../../includes/modal_header.php';
$sql = mysqli_query($mysqli, "SELECT document_template_id, document_template_name, document_template_archived_at FROM document_templates
ORDER BY document_template_archived_at IS NOT NULL, document_template_name ASC");
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title"><i class="fa fa-fw fa-file-download me-2"></i>Export document templates</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="modal-body">
<p class="small text-secondary">A file to import into another ITFlow, or keep. Each template goes with its summary, what it says and its images (each up to <?= intval(DOCUMENT_TEMPLATE_TRANSFER_IMAGE_MAX / 1048576) ?> MB), the fill-ins set up on it and how often its documents are reviewed. Who should have one stays here.</p>
<div class="mb-3">
<label class="form-label">Document templates</label>
<div class="input-group">
<span class="input-group-text"><i class="fa fa-fw fa-file-alt"></i></span>
<select class="form-select select2" name="document_template_ids[]" multiple data-placeholder="Every current one">
<?php while ($row = mysqli_fetch_assoc($sql)) { ?>
<option value="<?= intval($row['document_template_id']) ?>"><?= escapeHtml($row['document_template_name']) ?><?= $row['document_template_archived_at'] ? ' (archived)' : '' ?></option>
<?php } ?>
</select>
</div>
<div class="form-text">Leave it empty for every current one.</div>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" name="archived" value="1" id="exportDocumentTemplatesArchived">
<label class="form-check-label" for="exportDocumentTemplatesArchived">With the archived ones too</label>
</div>
</div>
<div class="modal-footer">
<button type="submit" name="export_document_templates" class="btn btn-primary text-bold"><i class="fa fa-download me-2"></i>Download</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
</div>
</form>
<?php
require_once '../../../includes/modal_footer.php';