<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
include '../../../../config/index.php';
$data = file_get_contents('php://input');

$obj = json_decode($data, true);

$sql_we = 'INSERT INTO LessonAssignmentChecklist VALUES (NULL,
        "",
        "' . $obj["course"]["SelfPacedCourses_id"] . '",
        "' . $obj["course"]["course_id"] . '",
        "' . $obj["lesson"]["course_lesson_plan_id"] . '",
        "' . $obj["ChecklistName"] . '",
        "true",
        "false",
        "false",
        "false",
        now())';

if (mysqli_query($conn, $sql_we)) {
    $LessonAssignmentChecklist_id = mysqli_insert_id($conn);
    $curl_post_data = array(
        'Success' => 'true',
        'Reason' => 'You have succesfully Updated the Asssignment Checklist'
    );
    echo json_encode($curl_post_data);
} else {
    $curl_post_data = array(
        'Success' => 'false',
        'Reason' => 'Unable to succesfully Update the Asssignment Checklist, Contact Admin for help'
    );
    echo json_encode($curl_post_data);
}
