Detail Buku

Buat controller Buku.php dengan kode sebagai berikut :

	foreach ($buku as $fields) {
			$data['judul'] = $fields->judul_buku;
			$data['pengarang'] = $fields->pengarang;
			$data['penerbit'] = $fields->penerbit;
			$data['kategori'] = $fields->nama_kategori;
			$data['tahun'] = $fields->thn_terbit;
			$data['isbn'] = $fields->isbn;
			$data['jumlah'] = $fields->jumlah_buku;
			$data['gambar'] = $fields->gambar;
			$data['id'] = $id;
		}
		$this->load->view('desain');
		$this->load->view('toplayout');
		$this->load->view('detail_buku', $data);
	}

Buat file dengan desain.php di view dengan kode sebagai berikut :

<head>
		<title>Perpustakaan |</title>
		<link rel="stylesheet" href="<?php echo base_url()?>assets/css/bootstrap.min.css" />
		<script src="<?php echo base_url()?>assets/js/jquery.min.js"></script>
		<script src="<?php echo base_url()?>assets/js/bootstrap.min.js"></script>
	</head>

<nav class="navbar navbar-default">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">

      <div class="navbar-brand">
          <a href="<?php echo base_url('anggota') ?>">Perpustakaan</a>
      </div>

    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

      <ul class="nav navbar-nav navbar-right">
        <li>
          <a href="<?php echo base_url('anggota') ?>">HOme</a>
        </li>
        <li>
            <?php
                //$text_cart_url  = '<span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>';

                //$text_cart_url .= ' Booking Cart: '. $this->M_perpus->edit_data(array('id_anggota'=>$this->session->userdata('id_agt')),'transaksi')->num_rows() .' Buku';
            ?>
            <?//=anchor('peminjaman/lihat_keranjang', $text_cart_url)?>
        </li>
        <?php if($this->session->userdata('id_anggota')) { ?>
            <li><div style="line-height:50px;">Hai <b><?=$this->session->userdata('nama_anggota')?></b></div></li>
            <li><?php // echo anchor('admin/logout', 'Logout');?></li>
        <?php } else { ?>
            <li><?php// echo anchor('welcome', 'Login');?></li>
        <?php } ?>
      </ul>

    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>


<div class="x_panel" align="center">
  <div class="x_title">
      <h2><i class="fa fa-book"></i> Detail Buku</h2>
        <div class="clearfix"></div>
  </div>

  <div class="x_content">
    <div class="row" >
      <div class="col-sm-3 col-md-3">
        <div class="thumbnail" style="height: auto; position: relative; left: 165%; width: auto;">
          <img src="<?php echo base_url();?>assets/upload/<?=$gambar;?>" style="max-width:100%; max-height: 100%; height: 150px; width: 120px">

          <div class="caption">
            <h4 style="min-height:40px;" align="center"><?=$pengarang?></h4>
            <table class="table table-triped">
              <tr>
                <td>Judul Buku: </td><td><?=substr($judul,0,30).'..'?></td>
              </tr>
              <tr>
                <td>Penerbit: </td><td><?=$penerbit?></td>
              </tr>
              <tr>
                <td>Tahun Terbit: </td><td><?=substr($tahun,0,4)?></td>
              </tr>
              <tr>
                <td>Buku Tersedia: </td><td><?=$jumlah?> buah</td>
              </tr>
              <tr>
                <td>ISBN: </td><td><?=$isbn?></td>
              </tr>
              <tr>
                <td>Kategori: </td><td><?=$kategori?></td>
              </tr>
            </table>
            <p>
              <a href="#" class="btn btn-primary" onclick="window.history.go(-1)"> Kembali</a>
              <?php if($jumlah>0){ ?>
              <?=anchor('peminjaman/tambah_pinjam/' . $id, ' Booking' , [
                'class' => 'btn btn-success',
                'role'  => 'button'
              ])?>
            <?php }else{ ?>
              <?=anchor('member', ' Tidak Bisa Dipinjamm' , [
                'class' => 'btn btn-danger',
                'role'  => 'button'
              ])?>
            <?php } ?>
            </p>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Leave a Reply