<?php
include("../../db.php");
header("Access-Control-Allow-Origin: * ");

$status = 0;
$msg = "Unable to execute operation at this time..! Please retry later";

if (isset($_POST['json'])){

    $json_data = json_decode($_POST['json'], true);

    $teacher_id   = $json_data['teacher_id'];
    $date         = $json_data['date'];
    $period       = $json_data['period'];
    $class        = $json_data['class'];
    $subject      = $json_data['subject'];
    $classwork    = $json_data['classwork'];
    $homework     = $json_data['homework'];
    $comment      = $json_data['comment'];
    $hw_defaulter = $json_data['hw_defaulter'];

    $session      = $json_data['session'];
    $section      = $json_data['section'];

    $aryData = array("teacher_id" => $teacher_id, "date" => $date, "period" => $period, "class" => $class, "subject" => $subject, "classwork" => $classwork,
                     "homework" => $homework, "comment" => $comment, "hw_defaulter" => $hw_defaulter, "session" => $session, "section" => $section);

    $insert_activity = $db->insertAry("teacher_daily_activity", $aryData);

    if ($insert_activity > 0) {
        $status = 1;
        $msg = "Record added successfully";
    } else {
        $msg = "Failed to add record..! Please try again later";
    }

}

echo json_encode(array('status' => $status, 'msg' => $msg));