<?php
    if (empty($_GET[id])) {
        $k = $katgaleri->katgaleritag($_GET[tag]);
    }else{
        $katgaleri->id = $_GET[id];
        $k = $katgaleri->katgaleri();
    }
    
?>
<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="page-header">
                <h1>
                    Data Galeri
                </h1>
            </div><!-- /.page-header -->
            <a href="index.php?module=galeri">
                <button class="btn" type="button">
                    <i class="ace-icon fa fa-undo bigger-110"></i>
                    Kembali
                </button>
            </a>
        </div>
        <form class="form-horizontal" role="form" action="view/view/modul/mod_galeri/aksi_galeri.php?aksi=edit" method="post" >
            <input type="hidden" name="id" value="<?php echo $k[id]; ?>">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Nama Album </label>
                    <div class="col-sm-9">
                        <input type="text" id="form-field-1" placeholder="Nama" name="nama" class="col-xs-10 col-sm-5" value="<?php echo $k[nama]; ?>" />
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Keterangan </label>
                <div class="col-sm-9">
                    <textarea id="form-field-1" placeholder="Keterangan" name="keterangan" class="col-xs-10 col-sm-5"><?php echo $k[keterangan]; ?></textarea>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit">
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            Edit
                        </button>
                    </div>
                </div>
            </div>                           
        </form>
        <form class="form-horizontal" role="form" action="view/view/modul/mod_galeri/aksi_galeri.php?aksi=tambah_gambar" method="post" enctype="multipart/form-data" >
            <div class="col-xs-12">
                <div class="row">
                    <div class="col-xs-12">
                        <h3 class="header smaller lighter blue">Gambar</h3>
                        <div class="clearfix">
                            <div class="form-group">
                                <div class="col-sm-9">
                                    <input type="file" id="id-input-file-2" name="gambar" class="col-xs-4" />
                                    <button class="btn btn-info btn-xs" type="submit">
                                        <i class="ace-icon fa fa-plus  bigger-110 icon-only"></i>
                                    </button>
                                </div>
                            </div>
                            <div class="pull-right tableTools-container"></div>
                        </div>
                        <div>
                            <table id="simple-table" class="table table-striped table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>Gambar</th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                        $p = $galeri->listgalerikat($k[id]);
                                        while($i<count($p)){
                                            ?>
                                                <tr>
                                                    <td><img src="<?php echo $db->link(); ?>view/assets/img/galeri/<?php echo"".$p[$i][nama].""; ?>" width=200></td>
                                                    <td>
                                                        <div class="hidden-sm hidden-xs action-buttons">
                                                            <a class="red" href="view/view/modul/mod_galeri/aksi_galeri.php?aksi=delete_gambar&idk=<?php echo $p[$i][id]; ?>&id=<?php echo $k[id]; ?>">
                                                                <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                            </a>
                                                        </div>
                                                    </td>
                                                </tr>
                                            <?php
                                            $i++;
                                        }
                                        unset($i);
                                    ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div><!-- /.col -->
        </form>    
    </div><!-- /.row -->
</div><!-- /.page-content -->