public function getJadwalMPSelector() { $mp_id = isset($_GET['mp_id']) ? addslashes($_GET['mp_id']) : die('mp_id empty'); $mp_type = isset($_GET['mp_type']) ? addslashes($_GET['mp_type']) : die('mp_type empty'); $mp = new Matapelajaran(); $arrMP = $mp->getWhere("mp_id>0"); $mptr = new MatapelajaranTidakResmi(); $arrMPTR = $mptr->getWhere("mptr_id>0"); //pr($_GET); $t = time(); // untuk query langsung $kls_id = isset($_GET['kls_id']) ? addslashes($_GET['kls_id']) : die('kls_id empty'); $slotID = isset($_GET['slotID']) ? addslashes($_GET['slotID']) : die('slotID empty'); $day = isset($_GET['day']) ? addslashes($_GET['day']) : die('day empty'); $ta = TahunAjaran::ta(); //elroy : ini di query langsung... $id = $day . "_" . $slotID . "_" . $kls_id . "_" . $ta; //elroy : ini di query langsung... $id = $day . "_" . $slotID . "_" . $kls_id . "_" . $ta; global $db; $q = "SELECT * FROM ry_sekolah__jadwalmp WHERE jw_id = '{$id}'"; $jd = $db->query($q, 1); ?> <span id="spanselectmp<?php echo $t; ?> "> <select id="selectmp<?php echo $t; ?> "> <?php foreach ($arrMP as $mp) { $selected = ""; if ($jd->jw_type == "mp") { if ($mp->mp_id == $jd->jw_mp_id) { $selected = "selected"; } } ?> <option value="mp_<?php echo $mp->mp_id; ?> " <?php echo $selected; ?> ><?php echo $mp->mp_name; ?> </option> <?php } ?> <?php foreach ($arrMPTR as $mptr) { $selected = ""; if ($jd->jw_type == "mptr") { if ($mptr->mptr_id == $jd->jw_mp_id) { $selected = "selected"; } } ?> <option value="mptr_<?php echo $mptr->mptr_id; ?> " <?php echo $selected; ?> ><?php echo $mptr->mptr_desr; ?> </option> <?php } ?> </select> </span> <script> $("#selectmp<?php echo $t; ?> ").change(function () { var ctr = $("#selectmp<?php echo $t; ?> ").val(); $.get('<?php echo _SPPATH; ?> StudentSetup/setJadwalMP?mp=' + ctr + '&kls_id=<?php echo $_GET['kls_id']; ?> &slotID=<?php echo $_GET['slotID']; ?> &day=<?php echo $_GET['day']; ?> ', function (data) { //alert( data ); }); $("#spanselectmp<?php echo $t; ?> ").html($("#selectmp<?php echo $t; ?> option:selected").text()); }); </script> <?php //exit(); }
public function getMatapelajaran($arrOfJadwalMP) { foreach ($arrOfJadwalMP as $obj) { if (Matapelajaran::istMPResmi($obj->jw_type)) { $mp_singkatan = MatapelajaranResmi::getMatapelajaranSingkatan($obj->jw_mp_id); } else { $mp_singkatan = MatapelajaranTidakResmi::getMatapelajaranname($obj->jw_mp_id); } //echo $mp_singkatan . "<br>"; } return $arrOfJadwalMP; }