Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class jadwalokbackup extends CI_Controller {
- public function __construct() {
- parent::__construct();
- $this->load->model('jadwalRO_model');
- }
- private function _render($view,$data = array())
- {
- $this->load->view('header',$data);
- $this->load->view('body_header');
- $this->load->view('sidebar');
- $this->load->view($view,$data);
- $this->load->view('footer');
- }
- public function index()
- {
- //load library
- $uri =& load_class('URI', 'core');
- redirect('index.php/jadwalokbackup/jadwalokview', $data);
- }
- public function jadwalokview()
- {
- $uri =& load_class('URI', 'core');
- $this->load->library('session');
- $this->_render('jadwalok_view');
- }
- public function getdata()
- {
- $uri =& load_class('URI', 'core');
- $tanggal = $this->input->get('tanggal');
- $data = $this->jadwalRO_model->getdata($tanggal);
- $ruang = $this->jadwalRO_model->ruangOk();
- $text = '';
- $res = array();
- $time1 = strtotime('00:00');
- $time2 = strtotime('10:00');
- $difference = round(abs($time2 - $time1) / 3600,2);
- // var_dump($difference);die();
- // var_dump($data->result());die();
- foreach($ruang->result() as $ruang){
- $text_jadwal = '';
- $countTd = 48;
- $rowTd = 0;
- foreach($data->result() as $datas){
- // print_r($data->result());exit();
- if($ruang->kode == $datas->kdruang){
- // print_r($ruang->kode);exit();
- $jamSelesaiTerakhir = $datas->jam_selesai;
- $rowTd = $rowTd+1;
- $tdkosong = "";
- $tdIsi = "";
- $difference = 0;
- if($rowTd == 1){
- $difference = round(abs(strtotime($datas->jam_mulai) - strtotime('00:00')) / 1800,2);
- }else{
- $difference = round(abs(strtotime($datas->jam_mulai) - strtotime($jamSelesaiTerakhir)) / 1800,2)-2;
- }
- $jamSelesaiTerakhir = $datas->jam_selesai;
- for($a = 0; $a <$difference; $a++){
- $tdkosong .= "<td></td>";
- }
- $countTd = $countTd - ($difference + $datas->minutes);
- for($a = 0; $a <$datas->minutes; $a++){
- $tdIsi .= "<td style='background: #09ff09;'>".$datas->nmDok."</td>";
- }
- // $text_jadwal .= $tdkosong."<td colspan='".$datas->minutes."' style='background: #09ff09;'>".$datas->nmDok."</td>";
- $text_jadwal .= $tdkosong.$tdIsi;
- }
- }
- $sisaTd = '';
- for($a = 0; $a <$countTd; $a++){
- $sisaTd .= "<td></td>";
- }
- $text .= "<tr><td style='text-align: center;background: #101ee5;color: white;min-width:150px'>".$ruang->ruang."</td>".$text_jadwal.$sisaTd."</tr>";
- }
- echo json_encode($text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement