Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class root_model extends ci_model {
- var $table = 'tbl_user';
- public function get_user_list()
- {
- $hasil = "";
- $w = $this->db->query("SELECT * FROM tbl_user ORDER BY id_user DESC ");
- $i = 1;
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-striped table-advance table-hover'>
- <thead>
- <tr>
- <th><i class='fa fa-us'></i> User Name</th>
- <th class='hidden-phone'><i class='fa fa-envelope'></i> Email</th>
- <th><i class='fa fa-book'></i> Alamat</th>
- <th><i class='fa fa-question-circle'></i> Status</th>
- <th><i class='fa fa-edit'></i> Action</th>
- </tr>
- </thead>";
- foreach ($w->result() as $h)
- {
- if ($h->aktif_user==1){
- $btnaktif = "<a href='".base_url()."root/user/activated/".$h->id_user."/0' onClick=\"return confirm('Jika user Anda non aktifkan maka tidak bisa login, apakah Anda yakin ?')\" class='btn btn-warning btn-xs' title='Not Aktivasi' type='button'><i class='fa fa-times-circle'></i></a>";
- $aktif_or_no = '<span class="label label-success label-mini">Aktif</span>';
- }else{
- $btnaktif = "<a href='".base_url()."root/user/activated/".$h->id_user."/1' onClick=\"return confirm('Apakah Anda yakin akan mengaktifkan user ?')\" class='btn btn-success btn-xs' title='Aktivasi' type='button'><i class='fa fa-check'></i></a>";
- $aktif_or_no = '<span class="label label-danger label-mini">Tidak Aktif</span>';
- }
- $hasil .= "<tr>
- <td>
- <a href='#'>
- ".$h->user_name."
- </a>
- </td>
- <td class='hidden-phone'>".$h->email_user."</td>
- <td>".$h->User_Address."</td>
- <td>$aktif_or_no</span></td>
- <td><div>
- <a class='btn btn-primary btn-xs' title='Edit' href='".base_url()."root/user/edit_profile/".$h->id_user."' type='button'><i class='fa fa-pencil'></i></a>
- $btnaktif";
- $hasil .= " <a href='".base_url()."root/user/delete/".$h->id_user."' onClick=\"return confirm('Apakah Anda yakin akan menghapus user ini ?')\" class='btn btn-danger btn-xs' title='Hapus' type='button'><i class='fa fa-trash-o'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- public function get()
- {
- $this->db->select('*');
- $this->db->order_by('tanggal','asc');
- return $this->db->get('tbl_pendapatan');
- }
- public function agent()
- {
- $this->db->select('*');
- $this->db->order_by('session_id','asc');
- return $this->db->get('tbl_log_activities');
- }
- public function generate_kategori($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_kat = $filter['cari_kategori'];
- $query_add = "WHERE judul_kat like '%".$data_kat."'";
- $tot_hal = $this->db->query("SELECT * FROM kategori ".$query_add."");
- $config['base_url'] = base_url() . 'admin/kategori/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = 'LAST=>';
- $config['prev_link'] = '<=FIRST';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT * FROM kategori ".$query_add." ORDER BY id ASC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>NAMA KATEGORI</th>
- <th><center style='color:#ff6c60'>TANGGAL PUBLIKASI</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td class='text-center'>".$h->judul_kat."</td>
- <td class='text-center'>".$h->tanggal_publish."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-primary btn-xs' title='Edit' href='".base_url()."admin/kategori/edit_kat/".$h->id."' type='button'><i class='fa fa-pencil'></i></a>
- <a class='btn btn-danger btn-xs' title='Delete' href='".base_url()."admin/kategori/delete_kat/".$h->id."' type='button'><i class='fa fa-trash-o'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- public function generate_produk($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_kat = $filter['cari_produk'];
- $query_add = "WHERE nama_produk like '%".$data_kat."'";
- $tot_hal = $this->db->query("SELECT a.id_prod, a.nama_produk,a.kategori_produk, a.elm1, a.harga_produk, a.gambar_produk, b.id, b.judul_kat FROM produk a LEFT OUTER JOIN kategori b ON a.kategori_produk = b.id ".$query_add."");
- $config['base_url'] = base_url() . 'admin/produk/index/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 4;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = 'LAST=>';
- $config['prev_link'] = '<=FIRST';
- $this->pagination->initialize($config);
- $w =
- $this->db->query("SELECT a.id_prod, a.nama_produk,a.kategori_produk, a.elm1, a.harga_produk, a.gambar_produk, b.id, b.judul_kat FROM produk a LEFT OUTER JOIN kategori b ON a.kategori_produk = b.id ".$query_add." ORDER BY a.id_prod DESC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>NAMA PRODUK</th>
- <th><center style='color:#ff6c60'>HARGA PRODUK</th>
- <th><center style='color:#ff6c60'>KETERANGAN PRODUK</th>
- <th><center style='color:#ff6c60'>GAMBAR PRODUK</th>
- <th><center style='color:#ff6c60'>KATEGORI</th>
- <th><center style='color:#ff6c60'>OPTIONS</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td class='text-center'>".$h->nama_produk."</td>
- <td class='text-center'>".$h->harga_produk."</td>
- <td class='text-center'>".$h->elm1."</td>
- <td class='text-center'><img src='".base_url()."assets/produk/thumb/".$h->gambar_produk."'/></td>
- <td class='text-center'>".$h->judul_kat."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-primary btn-xs' title='Edit' href='".base_url()."admin/produk/edit_produk/".$h->id_prod."' type='button'><i class='fa fa-pencil'></i></a>
- <a class='btn btn-danger btn-xs' title='Delete' href='".base_url()."admin/produk/delete_produk/".$h->id_prod."' type='button'><i class='fa fa-trash-o'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- public function generate_menu($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_menu = $filter['cari_menu'];
- $query_add = " WHERE judul_menu like '%".$data_menu."'";
- $tot_hal = $this->db->query("SELECT a.id_menu, a.judul_menu, a.id_author, a.isi_menu, a.tgl_publish, a.last_data_update, a.id_user_update, b.nama from tbl_menu as a join user as b on a.id_author = b.id_user".$query_add."");
- $config['base_url'] = base_url() . 'admin/menu/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = '»';
- $config['prev_link'] = '«';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT a.id_menu, a.judul_menu, a.id_author, a.isi_menu, a.tgl_publish, a.last_data_update, a.id_user_update, b.nama from tbl_menu as a join user as b on a.id_author = b.id_user".$query_add." ORDER BY id_menu ASC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>JUDUL MENU</th>
- <th><center style='color:#ff6c60'>AUTHOR</th>
- <th><center style='color:#ff6c60'>TANGGAL PUBLISH</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td>".$h->judul_menu."</td>
- <td class='text-center'>".$h->nama."</td>
- <td class='text-center'>".$h->tgl_publish."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-white btn-sm' title='Edit' href='".base_url()."admin/menu/edit-menu/".$h->id_menu."' type='button'><i class='fa fa-pencil'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- function count_where2($table, $where1)
- {
- $this->db->from($table);
- $this->db->where($where1);
- $count = $this->db->count_all_results();
- if ($count == 0)
- {
- return 0;
- }
- else
- {
- return $count;
- }
- }
- public function generate_page($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_page = $filter['cari_page'];
- $query_add = " WHERE judul_page like '%".$data_page."'";
- $tot_hal = $this->db->query("SELECT a.id_page, a.judul_page, a.id_author, a.isi_page, a.tgl_publish, a.last_data_update, a.id_user_update, b.nama from tbl_page as a join user as b on a.id_author = b.id_user".$query_add."");
- $config['base_url'] = base_url() . 'admin/page/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = '»';
- $config['prev_link'] = '«';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT a.id_page, a.judul_page, a.id_author, a.isi_page, a.tgl_publish, a.last_data_update, a.id_user_update, b.nama from tbl_page as a join user as b on a.id_author = b.id_user".$query_add." ORDER BY id_page ASC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>JUDUL PAGE</th>
- <th><center style='color:#ff6c60'>AUTHOR</th>
- <th><center style='color:#ff6c60'>TANGGAL PUBLISH</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td>".$h->judul_page."</td>
- <td class='text-center'>".$h->nama."</td>
- <td class='text-center'>".$h->tgl_publish."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-white btn-sm' title='Edit' href='".base_url()."admin/page/edit-page/".$h->id_page."' type='button'><i class='fa fa-pencil'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- public function generate_blog($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_blog = $filter['cari_blog'];
- $query_add = " WHERE a.judul_blog like '%".$data_blog."%' OR b.nama like '%".$data_blog."%'";
- $tot_hal = $this->db->query("SELECT a.id_blog, a.judul_blog, a.id_author, a.isi_blog, a.tgl_publish, a.last_data_update, a.id_user_update, b.nama from tbl_blog as a join user as b on a.id_author = b.id_user".$query_add."");
- $config['base_url'] = base_url() . 'admin/blog/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = '»';
- $config['prev_link'] = '«';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT a.id_blog, a.judul_blog, a.id_author, a.isi_blog, a.tgl_publish, a.last_data_update, a.id_user_update, b.nama from tbl_blog as a join user as b on a.id_author = b.id_user".$query_add." ORDER BY a.id_blog DESC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>JUDUL</th>
- <th><center style='color:#ff6c60'>AUTHOR</th>
- <th><center style='color:#ff6c60'>TANGGAL PUBLISH</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td>".$h->judul_blog."</td>
- <td class='text-center'>".$h->nama."</td>
- <td class='text-center'>".$h->tgl_publish."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-white btn-sm' title='Edit' href='".base_url()."admin/blog/edit-blog/".$h->id_blog."' type='button'><i class='fa fa-pencil'></i></a>
- <a class='btn btn-white btn-sm' title='Delete' href='".base_url()."admin/blog/delete-blog/".$h->id_blog."' type='button'><i class='fa fa-trash-o'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- function update_quote($id,$data)
- {
- $this->db->where('id_user',$id);
- $update = $this->db->update('tbl_user',$data);
- return $update;
- }
- public function generate_pesan($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_pesan = $filter['cari_pesan'];
- $query_add = "WHERE nama_pesan like '%".$data_pesan."'";
- $tot_hal = $this->db->query("SELECT * FROM pesan ".$query_add."");
- $config['base_url'] = base_url() . 'admin/pesan/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = '»';
- $config['prev_link'] = '«';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT * FROM pesan ".$query_add." ORDER BY id_pesan ASC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>NAMA</th>
- <th><center style='color:#ff6c60'>EMAIL</th>
- <th><center style='color:#ff6c60'>ISI pesan</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td>".$h->nama_pesan."</td>
- <td class='text-center'>".$h->email_pesan."</td>
- <td class='text-center'>".strip_tags(substr($h->isi_pesan,0,30))."....</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-primary btn-xs' title='Lihat Detail' href='".base_url()."admin/pesan/detail-pesan/".$h->id_pesan."' type='button'><i class='fa fa-eye'></i></a>
- <a class='btn btn-danger btn-xs' title='Delete' href='".base_url()."admin/pesan/delete-pesan/".$h->id_pesan."' type='button'><i class='fa fa-trash-o'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- public function generate_portofolio($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_portofolio = $filter['cari_portofolio'];
- $query_add = "WHERE nama_portofolio like '%".$data_portofolio."'";
- $tot_hal = $this->db->query("SELECT id_portofolio, nama_portofolio, alamat_portofolio, deskripsi_portofolio, publish_portofolio FROM tbl_portofolio ".$query_add."");
- $config['base_url'] = base_url() . 'admin/portofolio/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = '»';
- $config['prev_link'] = '«';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT id_portofolio, nama_portofolio, alamat_portofolio, deskripsi_portofolio, publish_portofolio FROM tbl_portofolio ".$query_add." ORDER BY id_portofolio ASC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>NAMA</th>
- <th><center style='color:#ff6c60'>ALAMAT</th>
- <th><center style='color:#ff6c60'>TANGGAL PUBLISH</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td>".$h->nama_portofolio."</td>
- <td class='text-center'><a href='".$h->alamat_portofolio."' taget='blank'>".$h->alamat_portofolio."</a></td>
- <td class='text-center'>".$h->publish_portofolio."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-white btn-sm' title='Edit' href='".base_url()."admin/portofolio/edit-portofolio/".$h->id_portofolio."' type='button'><i class='fa fa-pencil'></i></a>
- <a class='btn btn-white btn-sm' title='Delete' href='".base_url()."admin/portofolio/delete-portofolio/".$h->id_portofolio."' type='button'><i class='fa fa-trash-o'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- public function generate_sistem($limit,$offset,$filter=array())
- {
- $hasil = "";
- $data_sistem = $filter['cari_sistem'];
- $query_add = "WHERE title like '%".$data_sistem."'";
- $tot_hal = $this->db->query("SELECT id_setting, title, tipe, content_setting FROM tbl_setting ".$query_add."");
- $config['base_url'] = base_url() . 'admin/sistem/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] = $limit = 5;
- $config['uri_segment'] = 3;
- $config['first_link'] = 'Pertama';
- $config['last_link'] = 'Terakhir';
- $config['next_link'] = '»';
- $config['prev_link'] = '«';
- $this->pagination->initialize($config);
- $w = $this->db->query("SELECT id_setting, title, tipe, content_setting FROM tbl_setting ".$query_add." ORDER BY id_setting ASC LIMIT ".$offset.",".$limit."");
- if(($w->num_rows())<=0)
- {
- $hasil .="<div class='text-center font-11'>Tidak Ada Data Yang Ditemukan</div>";
- }else{
- $hasil .= "<table class='table table-bordered table-striped table-condensed'>
- <thead>
- <tr>
- <th><center style='color:#ff6c60'>NO</th>
- <th><center style='color:#ff6c60'>NAMA PENGATURAN</th>
- <th><center style='color:#ff6c60'>TIPE PENGATURAN</th>
- <th><center style='color:#ff6c60'>OPTION</th>
- </tr>
- </thead>";
- $no = $offset+1;
- foreach ($w->result() as $h) {
- $hasil .= "<tr>
- <td class='text-center'>".$no."</td>
- <td>".$h->title."</td>
- <td class='text-center'>".$h->tipe."</td>
- <td class='text-center'><div class='btn-group'>
- <a class='btn btn-white btn-sm' title='Edit' href='".base_url()."admin/sistem/edit-sistem/".$h->id_setting."' type='button'><i class='fa fa-pencil'></i></a>";
- $hasil .= "</div>
- </td></tr>";
- $no++;
- }
- $hasil .= '</table>';
- }
- return $hasil;
- }
- function simpan_user($user,$data)
- {
- $this->db->insert('user',$data);
- return $simpan_user;
- }
- function update_user($id,$data)
- {
- $this->db->where('id',$id);
- $update = $this->db->update('user',$data);
- return $update;
- }
- function getUserById($id_user) {
- $this->db->select('*');
- $this->db->where('id_user', $id_user);
- $query = $this->db->get($this->table, 1);
- if ($query->num_rows() == 1) {
- return $query->row_array();
- }
- }
- function tampil_detail_user($id_user)
- {
- $q = $this->db->query("SELECT * FROM tbl_user WHERE id_user = '$id_user'");
- return $q;
- }
- function delete_user($id) {
- $this->db->where('id', $id);
- $this->db->delete('user');
- }
- function simpan_produk($produk,$data)
- {
- $this->db->insert('produk',$data);
- return $simpan_produk;
- }
- function update_produk($id,$data)
- {
- $this->db->where('id',$id);
- $update = $this->db->update('produk',$data);
- return $update;
- }
- function tampil_detail_produk($id_prod)
- {
- $q = $this->db->query("SELECT a.id_prod, a.nama_produk,a.kategori_produk, a.elm1, a.harga_produk, a.gambar_produk, b.id, b.judul_kat FROM produk a LEFT JOIN kategori b ON a.kategori_produk = b.id WHERE a.id_prod='$id_prod'");
- return $q;
- }
- function delete_produk($id_prod) {
- $this->db->where('id_prod', $id_prod);
- $this->db->delete('produk');
- }
- function get_foto_produk($id_prod)
- {
- $q = $this->db->query("SELECT * FROM produk WHERE id_prod='$id_prod'");
- return $q;
- }
- function get_nama_kategori($id)
- {
- $q = $this->db->query("SELECT * FROM kategori WHERE id='$id'");
- return $q;
- }
- function get_kategori_web()
- {
- $this->db->order_by('judul_kat ASC');
- return $this->db->get('kategori');
- }
- function simpan_kat($judul_kat,$data)
- {
- $this->db->insert('kategori',$data);
- return $simpan_kat;
- }
- function update_kat($id,$data)
- {
- $this->db->where('id',$id);
- $update = $this->db->update('kategori',$data);
- return $update;
- }
- function tampil_detail_kat($id)
- {
- $q = $this->db->query("SELECT * FROM kategori WHERE id = '$id'");
- return $q;
- }
- function delete_kat($id) {
- $this->db->where('id', $id);
- $this->db->delete('kategori');
- }
- function tampil_detail_blog($id_blog)
- {
- $q = $this->db->query("SELECT * FROM tbl_blog WHERE id_blog = '$id_blog'");
- return $q;
- }
- function update_blog($id,$data)
- {
- $this->db->where("id_blog",$id);
- $this->db->update("tbl_blog",$data);
- return $update_blog;
- }
- function tampil_detail_sistem($id_setting)
- {
- $q = $this->db->query("SELECT * FROM tbl_setting WHERE id_setting = '$id_setting'");
- return $q;
- }
- function update_sistem($id_setting,$data)
- {
- $this->db->where("id_setting",$id_setting);
- $this->db->update("tbl_setting",$data);
- return $update_sistem;
- }
- function tampil_detail_testimoni($id_testimoni)
- {
- $q = $this->db->query("SELECT * FROM tbl_testimoni WHERE id_testimoni ='$id_testimoni'");
- return $q;
- }
- function simpan_portofolio($portofolio,$data)
- {
- $this->db->insert('tbl_portofolio',$data);
- return $simpan_portofolio;
- }
- function tampil_detail_portofolio($id_portofolio)
- {
- $q = $this->db->query("SELECT * FROM tbl_portofolio WHERE id_portofolio ='$id_portofolio'");
- return $q;
- }
- function update_portofolio($id_portofolio,$data)
- {
- $this->db->where("id_portofolio",$id_portofolio);
- $this->db->update("tbl_portofolio",$data);
- return $update_portofolio;
- }
- function get_status()
- {
- $this->db->order_by('id_status');
- return $this->db->get('tbl_status');
- }
- function tampil_detail_menu($id_menu)
- {
- $q = $this->db->query("SELECT * FROM tbl_menu WHERE id_menu ='$id_menu'");
- return $q;
- }
- function tampil_detail_page($id_page)
- {
- $q = $this->db->query("SELECT * FROM tbl_page WHERE id_page ='$id_page'");
- return $q;
- }
- function update_menu($id,$data)
- {
- $this->db->where("id_menu",$id);
- $this->db->update("tbl_menu",$data);
- return $update_menu;
- }
- function update_page($id,$data)
- {
- $this->db->where("id_page",$id);
- $this->db->update("tbl_page",$data);
- return $update_page;
- }
- function fpotongteks( $text, $limit ) //Fungsi Untuk Memotong Panjang
- {
- $text = $this->fstrip_html_tags($text);
- if( strlen($text)>$limit )
- {
- $text = substr( $text,0,$limit );
- $text = substr( $text,0,-(strlen(strrchr($text,' '))) ); $text="$text";
- }
- return $text;
- }
- function tgl_indo_lengkap($date=null){
- //buat array nama hari dalam bahasa Indonesia dengan urutan 1-7
- $array_hari = array(1=>'Senin','Selasa','Rabu','Kamis','Jumat', 'Sabtu','Minggu');
- //buat array nama bulan dalam bahasa Indonesia dengan urutan 1-12
- $array_bulan = array(1=>'Januari','Februari','Maret', 'April', 'Mei', 'Juni','Juli','Agustus',
- 'September','Oktober', 'November','Desember');
- if($date == null) {
- //jika $date kosong, makan tanggal yang diformat adalah tanggal hari ini
- $hari = $array_hari[date('N')];
- $tanggal = date ('d');
- $bulan = $array_bulan[date('n')];
- $tahun = date('Y');
- $jam = date('H:i:s');
- } else {
- //jika $date diisi, makan tanggal yang diformat adalah tanggal tersebut
- $date = strtotime($date);
- $hari = $array_hari[date('N',$date)];
- $tanggal = date ('d', $date);
- $bulan = $array_bulan[date('n',$date)];
- $tahun = date('Y',$date);
- $jam = date('H:i:s',$date);
- }
- $formatTanggal = $hari . ", " . $tanggal ." ". $bulan ." ". $tahun ." Jam ". $jam;
- return $formatTanggal;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment