<?php
header('Access-Control-Allow-Origin: *');
include "../../../inc/config.php";
$url = get_service_url('url_rest');
$token = get_token();;
$json_response = array();
$filter_sms = "";
$filter_status = "";
$jumlah = 0;
$array_status = array();
        $semester = "id_semester='".$_POST['id_semester']."'";

        if ($_POST['jurusan']!='all') {
          $filter_sms = "and id_prodi='".$_POST['jurusan']."' ";
        }

       $filter_kelas = "$semester $filter_sms";
        $temp_count_mk = [
              'act' => 'GetCountPeriodePerkuliahan',
                'token' => $token,
                'filter' => $filter_kelas
            ];

          //  dump($temp_count_mk);
        $temp_count = json_decode($db->run($temp_count_mk,$url));
        // dump($temp_count);
       // dump($temp_count);
        if(!empty($temp_count->data)) {
          $jumlah = $temp_count->data;
        }

        
        if ($jumlah>0) {
           $json_response['jumlah'] = $jumlah;
        } else {
          $json_response['jumlah'] = 0;
        }

        echo json_encode($json_response);
?>