<?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_matkul = '';
$filter_status = "";
$jumlah = 0;
$array_status = array();
        $semester = "id_semester='".$_POST['sem_filter']."'";

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

       $filter_kelas = "$semester $filter_sms $filter_matkul";

        //echo $filter_mahasiswa;


        $temp_count_mk = [
              'act' => 'GetListKelasKuliah',
                'token' => $token,
                'filter' => $filter_kelas
            ];
        $temp_count = json_decode($db->run($temp_count_mk,$url));
       // dump($temp_count);
        if(!empty($temp_count->data)) {
          $jumlah = count($temp_count->data);
        }

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

        echo json_encode($json_response);
?>