<?php
session_start();

include "../../inc/config.php";



$client = new nusoap_client(get_service_url('soap'), true);
$url_rest = get_service_url('rest');
$proxy = $client->getProxy();
$token = get_token();

echo "<pre>";

$url = $db->get_service_url('rest');


$data_dic = array(
  'act' => 'GetDictionary',
  'token' => $token,
  'fungsi' => 'GetListMataKuliah'
);
$temp_recs = json_decode($db->run($data_dic,$url));
print_r($temp_recs);



$filter = "";
    $temp_data_kelas = [
      'act' => 'GetListMataKuliah',
        'token' => $token,
        'filter' => $filter,
        'order' => '',
        'limit' => 100,
        'offset' => 0

    ];


$temp_rec = json_decode($db->run($temp_data_kelas,$url));

//print_r($temp_rec);

foreach ($temp_rec->data as $mk) {
	$array_data[$mk->id_matkul] = $mk->kode_mata_kuliah;
}


$counts = array_count_values($array_data);

foreach ($array_data as $key => $count) {
    if ($count > 1) {
        echo $count."<br>";
    }
}


exit();

                /*  


                    [id_matkul] => 9ec3e3a5-8c53-4f86-8845-ee60d37b191c
                    [kode_mata_kuliah] => KK21103
                    [nama_mata_kuliah] => Pengembangan Perangkat Pembelajaran
                    [sks_mata_kuliah] => 6.00
                    [id_prodi] => 2aa327be-4ff2-4b28-9412-35a9684c86f1
                    [nama_program_studi] => Profesi Pendidikan Profesi Guru Keagamaan
                    [id_jenis_mata_kuliah] => W
                    [id_kelompok_mata_kuliah] => 

                  [id_mk] => 24bc298b-2002-4bae-8798-d7be2910905b
                    [id_sms] => 649069b9-5f7c-4040-9aaa-7faf03bb1feb
                    [id_jenj_didik] => 30
                    [kode_mk] => IAT10300014
                    [nm_mk] => PENULISAN TAFSIR POPULER*/




    $kelas = json_decode($db->run($temp_data_kelas,$url));



foreach ($kelas->data as $data_kelas) {
    $array_kode_mk[$data_kelas->id_matkul] = $data_kelas->nama_mata_kuliah;
}
$kode_mk_group = array_unique($array_kode_mk);