<?php
session_start();
include "../../inc/config.php";

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


$requestData= $_REQUEST;

$sSearch = $requestData['search']['value'];

$iStart = $requestData['start'];
$iLength = $requestData['length'];

$temp_limit = $iLength;
$temp_offset = $iStart?$iStart : 0;

$id_matkul = $_POST['id_matkul'];

		//and id_matkul not in(select id_kls from komponen_evaluasi)
		$temp_data_kelas = [
			'act' => 'GetListRencanaPembelajaran',
		    'token' => $token,
		    'filter' => "id_matkul='".$id_matkul."'",
		    'order' => ''
		];
		$temp_rec = json_decode($db->run($temp_data_kelas,$url));

		$jumlah = count($temp_rec->data);

		$totalData = $jumlah;
		$totalFiltered = $totalData;


			$temp_data = array();
			$i=0;
		foreach ($temp_rec->data as $key) {

				$temps = array();
				$checkbox = "";
				$temps[] = ++$i;
				$temps[] = $key->pertemuan;
				$temps[] = $key->materi_indonesia;
				$temps[] = $key->materi_inggris;
				$button = "<span data-id='".$key->id_rencana_ajar."' data-toggle='tooltip' data-title='Edit Matakuliah' class='btn btn-sm btn-primary edit-pembelajaran btn-flat'><i class='fa fa-pencil'></i></span> <span data-id='".$key->id_rencana_ajar."' data-jenis='pembelajaran' data-toggle='tooltip' data-title='Hapus Data' data-uri='".base_admin()."modul/manage_matakuliah/hapus.php' class='btn btn-sm btn-danger hapus btn-flat'><i class='fa fa-trash'></i></span>";
				$temps[] = $button;
				
				$temp_data[] = $temps;
			}
			$temp_output = array(
									'draw' => intval($requestData['draw']),
									'recordsTotal' => intval( $totalData ),
									'recordsFiltered' => intval( $totalFiltered ),
									'data' => $temp_data
				);
			echo json_encode($temp_output);

