Welcome Guest, Not a member yet? Register   Sign In
What the meaning of this word?
#7

[eluser]Freakniube[/eluser]
for mr.fx sry the code in above is for folder model (modeltamu.php) this for folder controller(tamu.php)
Code:
class Tamu extends Controller {
    /**
     * Constructor
     */
    function Tamu()
    {
        parent::Controller();
        $this->load->model('Modeltamu', '', TRUE);
        $this->load->model('Modelbulan', '', TRUE);
        $this->load->model('Modelguest', '', TRUE);
    }
    
    /**
     * Inisialisasi variabel untuk $limit dan $title(untuk id element <body>)
     */
    var $limit = 10;
    var $title = 'tamu';
    
    /**
     * Memeriksa user state, jika dalam keadaan login akan menampilkan halaman tamu,
     * jika tidak akan meredirect ke halaman login
     */
    function index()
    {
        // Hapus data session yang digunakan pada proses update data tamu
        $this->session->unset_userdata('id_tamu');
        $this->session->unset_userdata('tanggal');
            
        if ($this->session->userdata('login') == TRUE)
        {
            $this->get_last_ten_tamu();
        }
        else
        {
            redirect('login');
        }
    }


and this is also wrong?

Code:
foreach ($tamus as $tamu)
            {
                // Konversi hari dan tanggal ke dalam format Indonesia
                $hari_array = array('Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu');
                $hr = date('w', strtotime($absen->tanggal));
                $hari = $hari_array[$hr];
                $tgl = date('d-m-Y', strtotime($tamu->tanggal));
                $hr_tgl = "$hari, $tgl";
                
                // Penyusunan data baris per baris, perhatikan pembuatan link untuk updat dan delete
                $this->table->add_row(++$i, $hr_tgl, $tamu->bill, $tamu->nama, $tamu->kamar, $tamu->tamu,
                                        anchor('tamu/update/'.$tamu->id_tamu,'update',array('class' => 'update')).' '.
                                        anchor('tamu/delete/'.$tamu->id_tamu,'hapus',array('class'=> 'delete','onclick'=>"return confirm('Anda yakin akan menghapus data ini?')"))
                                    );
            }
            $data['table'] = $this->table->generate();
        }
        else
        {
            $data['message'] = 'Tidak ditemukan satupun data tamu!';
        }

that means this alsi wrong right??
Code:
function valid_entry()
    {
        $bill         = $this->input->post('bill');
        $tanggal    = date('Y-m-d', strtotime($this->input->post('tanggal')));
        
        if($this->Modeltamu->valid_entry($bill, $tanggal) == FALSE)
        {
            $this->form_validation->set_message('valid_entry', 'Guest ini sudah tercatat tamu pada tanggal ' . $this->input->post('tanggal'));
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
    
    /**
     * Cek agar tidak terjadi guest dengan BILL yang sama ditambah 2 kali ke tamu, hanya untuk proses update
     */
    function valid_entry2()
    {
        $current_date     = $this->session->userdata('tanggal');
        $new_date        = date('Y-m-d', strtotime($this->input->post('tanggal')));
        $bill             = $this->input->post('bill');
        
        if ($new_date === $current_date)
        {
            return TRUE;
        }
        else
        {
            if($this->Modeltamu->valid_entry($bill, $new_date) === FALSE) // cek database untuk entry yang sama memakai valid_entry()
            {
                $this->form_validation->set_message('valid_entry2', 'Guest ini sudah tercatat tamu pada tanggal ' . $this->input->post('tanggal'));
                return FALSE;
            }
            else
            {
                return TRUE;
            }
        }
    }    
}
// END Tamu Class

/* End of file tamu.php */
/* Location: ./system/application/controllers/tamu.php */


Messages In This Thread
What the meaning of this word? - by El Forum - 02-13-2011, 11:56 PM
What the meaning of this word? - by El Forum - 02-14-2011, 12:07 AM
What the meaning of this word? - by El Forum - 02-14-2011, 12:27 AM
What the meaning of this word? - by El Forum - 02-14-2011, 08:55 AM
What the meaning of this word? - by El Forum - 02-15-2011, 12:16 AM
What the meaning of this word? - by El Forum - 02-15-2011, 12:55 AM
What the meaning of this word? - by El Forum - 02-15-2011, 01:19 AM
What the meaning of this word? - by El Forum - 02-15-2011, 01:40 AM
What the meaning of this word? - by El Forum - 02-16-2011, 07:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB