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


    $token = $db->get_token();
    $url = $db->get_service_url('rest');
    $jml=0;

    $id_sms = '';
            $semester = "where id_smt='".$_POST['sem_filter']."'";
           if ($_POST['matkul']=='all') {
              $matkul = '';
            } else {
              $matkul = "and id_mk='".$_POST['matkul']."'";
            }
           if ($_POST['jurusan']=='all') {
              $id_sms = '';
            } else {
              $id_sms = "and id_sms='".$_POST['jurusan']."' ";
            }
            
            $filter_kelas = "id_kelas_kuliah in(select id_kls from kelas_kuliah $semester $id_sms $matkul)";
            $temp_count_mk = [
                  'act' => 'GetCountDosenPengajarKelasKuliah',
                    'token' => $token,
                    'filter' => $filter_kelas
                ];
               //dump($temp_count_mk);
            $temp_count = json_decode($db->run($temp_count_mk,$url));
            // dump($temp_count);
            if(!empty($temp_count->data)) {
                $jml = $temp_count->data;
            }

          
       

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

echo json_encode($json_response);
?>