コード例 #1
0
ファイル: point-of-contact.php プロジェクト: hughnguy/php
    $poc->updatePointOfContactTopics($_POST['point_of_contact_id'], $_POST['point_of_contact_topics']);
} elseif ($_GET['page'] === "fetch") {
    $point_of_contact = $poc->fetchPointOfContact($_POST["id"]);
    $point_of_contact["selected"] = $poc->checkPreviouslySelectedThings($_POST["id"]);
    $point_of_contact["files"] = $poc->fetchAllPointOfContactFiles($_POST["id"]);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($point_of_contact);
    exit;
} elseif ($_GET['page'] === "fetch-incident-report") {
    $incident_report = $ir->fetchIncidentReport($_POST["id"]);
    $incident_report["files"] = $ir->fetchAllIncidentReportFiles($_POST["id"]);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($incident_report);
    exit;
} elseif ($_GET['page'] === "get-attachment") {
    $file = $poc->fetchPointOfContactFile($_GET['file_id']);
    header("Content-Type: {$file['type']}");
    header("Content-Disposition:attachment; filename=" . str_replace(',', '', $file['name']));
    echo $file['attachment'];
    exit;
} elseif ($_GET['page'] === "get-incident-report-attachment") {
    $file = $ir->fetchIncidentReportFile($_GET['file_id']);
    header("Content-Type: " . $file[0]['type']);
    header("Content-Disposition:attachment; filename=" . str_replace(',', '', $file[0]['name']) . "");
    echo $file[0]['attachment'];
} elseif ($_GET['page'] === "batch-print") {
    $all_points_of_contact = $poc->listPointsOfContact($_GET['student_num'], $_GET['pocs']);
    foreach ($all_points_of_contact as $p) {
        echo '<div>' . $p['point_of_contact'] . '</div><hr>';
    }
} elseif ($_GET['page'] === "delete") {