Exemplo n.º 1
0
 public function view()
 {
     if ($_POST) {
         if (empty($_POST['username'])) {
             parent::alert('error', 'Error', 'Kolom username kosong !');
         } else {
             if (empty($_POST['password'])) {
                 parent::alert('error', 'Error', 'Kolom password kosong !');
             } else {
                 $username = esc_string($_POST['username']);
                 $password = esc_string(md5($_POST['password']));
                 $login = $this->login->user_login('admin', $username, $password);
                 switch ($login) {
                     case 0:
                         parent::alert('error', 'Error', 'User tidak ditemukan !');
                         break;
                     case 1:
                         redirect('index.php?page=home');
                         break;
                     case 2:
                         parent::alert('error', 'Error', 'Terjadi kesalahan ! <br />' . mysql_errno());
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     $this->view->display('login.tpl');
 }
Exemplo n.º 2
0
 public function theme_list()
 {
     $data = $this->themes->get_rows();
     $total_data = $this->themes->get_count();
     $thead = array('<th style="width:20px">ID</th>', '<th>Nama tema</th>', '<th>Status</th>');
     parent::table_config('themes', 'daftar tema', 'tambah', 'hapus', $thead, $data, $total_data);
 }
Exemplo n.º 3
0
 /**
  * Inisialisasi controller
  * @param String $access = 'site' atau 'admin'
  * @param Boolean $debug, $cache = smarty config
  * @param Integer $cache_lifetime = smarty config
  * @access protected  
  */
 protected function init($access, $link = '', $debug = false, $cache = false, $cache_lifetime = 120)
 {
     self::$instance = $this;
     $this->load = new Z_Loader();
     $this->base_link = base_link_format($link);
     load_file(ENGINE_PATH . 'smarty' . DS . 'libs' . DS, 'Smarty.class.php');
     if (!class_exists('Smarty')) {
         die('Smarty class not found !');
     }
     $this->view = new Smarty();
     if ($access == 'site') {
         $name = $this->theme_dir('site_theme_name', 'site');
         $this->view->template_dir = $this->theme_dir('site_theme_path', 'site');
     } else {
         if ($access == 'admin') {
             $name = $this->theme_dir('site_theme_name', 'admin');
             $this->view->template_dir = $this->theme_dir('site_theme_path', 'admin');
         } else {
             die('Wrong access !');
         }
     }
     $this->view->compile_dir = TEMP_PATH . 'smarty' . DS . 'templates_c' . DS;
     $this->view->config_dir = TEMP_PATH . 'smarty' . DS . 'configs' . DS;
     $this->view->cache_dir = TEMP_PATH . 'smarty' . DS . 'cache' . DS;
     $this->view->plugins_dir = ENGINE_PATH . 'plugin' . DS . 'smarty' . DS . 'plugins' . DS;
     $this->view->debugging = $debug;
     $this->view->caching = $cache;
     $this->view->cache_lifetime = $cache_lifetime;
     $this->require_files($access);
     $this->view->assign('THEME_DIR', $name);
 }
Exemplo n.º 4
0
 private function messages_list()
 {
     $messages = array();
     $total_messages = 0;
     $this->delete_messages();
     $thead = array('<th>Judul</th>', '<th>Tanggal</th>');
     parent::table_config('messages', 'daftar pesan', 'Buat pesan baru', 'Hapus', $thead, $messages, $total_messages);
 }
Exemplo n.º 5
0
 public function review_list()
 {
     $review = $this->review->get_all_review('all_records');
     $total_review = $this->review->get_all_review('total_data');
     $this->delete_review();
     $thead = array('<th>Komentar dari</th>', '<th>Tgl komentar</th>');
     parent::table_config('comments', 'daftar komentar', '', 'hapus', $thead, $review, $total_review);
 }
Exemplo n.º 6
0
 public function view()
 {
     $this->view->assign('img_dir', $this->img_dir);
     $this->product_featured();
     $this->home_banner();
     $this->product_latest();
     parent::fetch('home', 'module');
 }
Exemplo n.º 7
0
 public function __construct()
 {
     parent::init('site');
     $this->load->model('home_slider', 'hs');
     $this->load->model('site_profile', 'profile');
     $this->load->model('product_category', 'pcategory');
     $this->load->model('modules');
     $this->load->model('order');
 }
Exemplo n.º 8
0
 public function view()
 {
     $pcategory = $this->pcategory->get_pcategory($_GET['id']);
     $total_product = $this->product->get_all_product('related', 'published', 'total_data', $pcategory['id']);
     $product = $this->product->get_all_product('related', 'published', 'all_records', $pcategory['id']);
     $this->view->assign('product_img_src', $this->img_dir);
     $this->view->assign('product_header', $pcategory['name']);
     $this->view->assign('total_product', $total_product);
     $this->view->assign('product_list', $product);
     parent::fetch('product/product_list', 'module');
 }
Exemplo n.º 9
0
 public function header_config()
 {
     switch ($_GET['act']) {
         case 'detail':
             $product = $this->product->get_product($_GET['id']);
             $title = $product['name'];
             $meta_key = $product['meta_key'];
             $meta_desc = $product['meta_desc'];
             break;
         default:
             $title = 'semua produk';
             $meta_key = 'meta keyword for semua produk';
             $meta_desc = 'meta description for semua produk';
             break;
     }
     parent::site_head_config($title, $meta_key, $meta_desc);
 }
Exemplo n.º 10
0
 private function saving($mode, $id = '')
 {
     if (!empty($_POST['username']) && !empty($_POST['password'])) {
         if ($_POST['re_password'] == $_POST['password']) {
             if ($mode == 'new') {
                 $query = $this->user->save_user();
             } else {
                 if ($mode == 'update') {
                     $query = $this->user->update_user($id);
                 }
             }
             if ($query) {
                 parent::alert('success', 'Berhasil !', 'Data user berhasil disimpan ! 
                                <a href=' . $this->base_link . '>Klik disini</a> untuk kembali');
             } else {
                 parent::alert('error', 'Gagal !', 'Data user gagal disimpan !');
             }
         }
     }
 }
Exemplo n.º 11
0
 private function site_profile()
 {
     if ($_POST) {
         if (!empty($_POST['site_name'])) {
             $site = $this->profile->update_profile($_POST['id']);
             if ($site) {
                 parent::alert('success', 'Berhasil !', 'Data konfigurasi website berhasil disimpan !');
             } else {
                 parent::alert('error', 'Gagal !', 'Data konfigurasi website gagal disimpan !');
             }
         }
     }
     $profile = $this->profile->base_profile();
     if ($profile['site_status'] == 'online') {
         $site_status = $this->radio_config('site_status', 'checked');
     } else {
         $site_status = $this->radio_config('site_status', '', 'checked');
     }
     $site_data = $this->site_data($profile['id'], $profile['date_updated'], $profile['site_name'], $profile['site_author'], $profile['site_slogan'], $profile['site_footer'], $site_status, $profile['offline_message'], $profile['site_meta_desc'], $profile['site_meta_key']);
     $this->form_data('Konfigurasi website', $site_data);
 }
Exemplo n.º 12
0
 private function view_customer()
 {
     $id = $_GET['id'];
     if ($_POST) {
         $update = $this->customer->update_blocked_status_customer($id);
         if ($update) {
             redirect($this->base_link);
         } else {
             parent::alert('error', 'Gagal !', 'Gagal merubah status pelanggan !');
         }
     }
     $customer = $this->customer->get_customer('', $id);
     $detail = $this->customer->get_customer('detail', $id);
     if ($customer['blocked'] == 'N') {
         $status = $this->radio_config('blocked', 'checked', '');
     } else {
         $status = $this->radio_config('blocked', '', 'checked');
     }
     $customer_data = array(array('label' => '<img src="' . $this->img_dir . 'no_image.jpg" />', 'input' => ''), array('label' => 'Tgl registrasi', 'input' => html_input('text', array('value="' . $customer['reg_date'] . '"', 'class="span3"', 'disabled'))), array('label' => 'Nama lengkap', 'input' => html_input('text', array('value="' . $detail['fullname'] . '"', 'class="span3"', 'disabled'))), array('label' => 'Status', 'input' => $status), array('label' => 'Jenis kelamin', 'input' => html_input('text', array('value="' . $detail['sex'] . '"', 'class="span3"', 'disabled'))), array('label' => 'Alamat', 'input' => html_textarea(array('class="span6"', 'disabled'), $detail['address'])), array('label' => 'Provinsi', 'input' => html_input('text', array('value="' . $detail['state'] . '"', 'class="span3"', 'disabled'))), array('label' => 'Kota', 'input' => html_input('text', array('value="' . $detail['city'] . '"', 'class="span3"', 'disabled'))), array('label' => 'Kode pos', 'input' => html_input('text', array('value="' . $detail['postal_code'] . '"', 'class="span3"', 'disabled'))), array('label' => 'No.Telp', 'input' => html_input('text', array('value="' . $detail['phone_number'] . '"', 'class="span3"', 'disabled'))), array('label' => 'Email', 'input' => html_input('text', array('value="' . $detail['email'] . '"', 'class="span3"', 'disabled'))));
     $button = array(html_input('submit', array('value="Simpan"', 'class="btn btn-success"')), html_input('button', array('value="Kirim Pesan"', 'onClick="window.location.go(-1)"', 'class="btn btn-success"')));
     parent::form_config('', '', $customer_data, 'Data pelanggan', $button);
 }
Exemplo n.º 13
0
 public function header_config()
 {
     switch ($_GET['view']) {
         case 'about-us':
             $title = 'Tentang Kami';
             $meta_key = '';
             $meta_desc = '';
             break;
         case 'contact-us':
             $title = 'Hubungi Kami';
             $meta_key = '';
             $meta_desc = '';
             break;
         case 'privacy-policy':
             $title = 'Syarat & Ketentuan';
             $meta_key = '';
             $meta_desc = '';
             break;
         default:
             break;
     }
     parent::site_head_config($title, $meta_key, $meta_desc);
 }
Exemplo n.º 14
0
 private function site_config()
 {
     if ($_POST) {
         if (!empty($_POST['site_name'])) {
             $site = $this->site_config->update($_POST['id']);
             if ($site) {
                 parent::alert('success', 'Berhasil !', 'Data konfigurasi website berhasil disimpan !');
             } else {
                 parent::alert('error', 'Gagal !', 'Data konfigurasi website gagal disimpan !');
             }
         }
     }
     $row = $this->site_config->get_row();
     if ($row['site_status'] == 'online') {
         $site_status = $this->radio_config('site_status', 'checked');
     } else {
         $site_status = $this->radio_config('site_status', '', 'checked');
     }
     $values_site_conf = array($row['date_updated'], $row['id'], $row['site_name'], $row['site_author'], $row['site_slogan'], $row['site_footer'], $site_status, $row['offline_message'], $row['site_meta_desc'], $row['site_meta_key']);
     $values_other_conf = array();
     $site_data = $this->site_data($values_site_conf);
     $other_conf = $this->other_conf($values_other_conf);
     $this->form('Konfigurasi website', array($site_data, $other_conf));
 }
Exemplo n.º 15
0
 public function module_list()
 {
     $module = $this->mod->get_rows();
     $thead = array('<th>Nama module</th>', '<th>Ukuran</th>', '<th>Tgl Install</th>');
     parent::table_config('modules', 'daftar modul', 'tambah', 'hapus', $thead, $module);
 }
Exemplo n.º 16
0
function &get_instance()
{
    return Z_Controller::get_instance();
}
Exemplo n.º 17
0
 public function header_config()
 {
     switch ($_GET['act']) {
         case 'login':
             $title = '- login';
             break;
         case 'register':
             $title = '- register';
             break;
         case 'cart':
             $title = '- cart';
             break;
         case 'checkout':
             $title = '- checkout';
             break;
         default:
             break;
     }
     parent::site_head_config('customer ' . $title, 'meta keyword for customer ' . $title, 'meta description for customer ' . $title);
 }
Exemplo n.º 18
0
 public function comment_list()
 {
     $comments = array();
     $thead = array('<th>Komentar dari</th>', '<th>Tgl komentar</th>');
     parent::table_config('comments', 'daftar komentar', '', '', 'hapus', '', $thead, $comments);
 }
Exemplo n.º 19
0
 private function saving($mode = '', $id = '', $image_name = '')
 {
     $img_src = $_FILES['image']['tmp_name'];
     $img_name = $_FILES['image']['name'];
     $img_type = $_FILES['image']['type'];
     $img_size = $_FILES['image']['size'];
     $rand = rand(00, 999999);
     $uniq_file_name = $rand . $img_name;
     if (empty($img_src)) {
         $image = $image_name;
     } else {
         $image = $uniq_file_name;
     }
     if ($mode == 'new') {
         $query = $this->product->save_product($image);
     } else {
         if ($mode == 'update') {
             $query = $this->product->update_product($id, $image);
         }
     }
     if ($query) {
         if (!empty($img_src)) {
             img_upload($img_src, $this->img_dir, $image, 'thumb');
         }
         parent::alert('success', 'Berhasil !', 'Data produk berhasil disimpan ! 
                         <a href=' . $this->base_link . '>Klik disini</a> untuk kembali');
     } else {
         parent::alert('error', 'Gagal !', 'Data produk gagal disimpan !');
     }
 }
Exemplo n.º 20
0
 private function order_list()
 {
     $order = $this->order->get_all_order();
     $thead = array('<th>Kode transaksi</th>', '<th>Tgl pembelian</th>', '<th>Status</th>');
     parent::table_config('order', 'daftar penjualan', '', 'Hapus', $thead, $order);
 }
Exemplo n.º 21
0
 public function header_config()
 {
     parent::site_head_config('Keranjang belanja', '', '');
 }
Exemplo n.º 22
0
 private function saving($mode = '', $id = '', $image_name = '')
 {
     $img_src = $_FILES['image']['tmp_name'];
     $img_name = $_FILES['image']['name'];
     $img_type = $_FILES['image']['type'];
     $img_size = $_FILES['image']['size'];
     $rand = rand(00, 999999);
     $uniq_file_name = $rand . $img_name;
     if (empty($img_src)) {
         $image = $image_name;
     } else {
         $image = $uniq_file_name;
     }
     if ($mode == 'new') {
         $query = $this->hs->save_home_slider($image);
     } else {
         if ($mode == 'update') {
             $query = $this->hs->update_home_slider($id, $image);
         }
     }
     if ($query) {
         if (!empty($img_src)) {
             img_upload($img_src, $this->img_dir, $image, 'slider', 962, 356);
             unlink($this->img_dir . $image);
         }
         parent::alert('success', 'Berhasil !', 'Data home slider berhasil disimpan ! 
                         Silahkan tambah data lagi atau <a href=' . $this->base_link . '>Klik disini</a> 
                         untuk kembali');
     } else {
         parent::alert('error', 'Gagal !', 'Data home slider gagal disimpan !');
     }
 }
Exemplo n.º 23
0
 private function edit_brand()
 {
     $brand = $this->brand->get_brand($_GET['id']);
     if ($_POST) {
         $img_src = $_FILES['image']['tmp_name'];
         $img_name = $_FILES['image']['name'];
         $img_type = $_FILES['image']['type'];
         $img_size = $_FILES['image']['size'];
         $dir = $this->img_dir;
         $rand = rand(00, 999999);
         $uniq_file_name = $rand . $img_name;
         if (empty($img_src)) {
             $image = $brand['image'];
         } else {
             $image = $uniq_file_name;
         }
         $query = $this->brand->update_brand($_GET['id'], $image);
         if ($query) {
             if (!empty($img_src)) {
                 img_upload($img_src, $dir, $image, 'thumb');
             }
             parent::alert('success', 'Berhasil !', 'Data brand berhasil diubah !');
         } else {
             parent::alert('error', 'Gagal !', 'Data brand gagal diubah !');
         }
     }
     if ($brand['publish'] == 'Y') {
         $publish = $this->radio_config('publish', 'checked', '');
     } else {
         $publish = $this->radio_config('publish', '', 'checked');
     }
     $brand_data = $this->brand_data($_GET['id'], $brand['name'], $brand['image'], $brand['description']);
     $brand_config = $this->brand_config($publish, $brand['meta_desc'], $brand['meta_key']);
     $this->form_data('Ubah data brand', $brand_data, $brand_config);
 }
Exemplo n.º 24
0
 public function view()
 {
     $this->view->assign('username', ucfirst(strtolower($_SESSION['username'])));
     parent::fetch('home/home', 'module');
 }
Exemplo n.º 25
0
 public function __construct()
 {
     parent::init('site');
 }
Exemplo n.º 26
0
 /**
  * Konstruktor
  * @access public
  **/
 public function __construct()
 {
     parent::init('site');
     $this->load->model('modules');
 }
Exemplo n.º 27
0
 public function __construct()
 {
     parent::init('admin');
 }
Exemplo n.º 28
0
 private function edit_pcategory()
 {
     $pcategory = $this->pcategory->get_pcategory($_GET['id']);
     if ($_POST) {
         $img_src = $_FILES['image']['tmp_name'];
         $img_name = $_FILES['image']['name'];
         $img_type = $_FILES['image']['type'];
         $img_size = $_FILES['image']['size'];
         $dir = $this->img_dir;
         $rand = rand(00, 999999);
         $uniq_file_name = $rand . $img_name;
         if (empty($img_src)) {
             $image = $pcategory['image'];
         } else {
             $image = $uniq_file_name;
         }
         $query = $this->pcategory->update_pcategory($_GET['id'], $image);
         if ($query) {
             if (!empty($img_src)) {
                 img_upload($img_src, $dir, $image, 'thumb');
             }
             parent::alert('success', 'Berhasil !', 'Data kategori produk berhasil disimpan ! 
                              Silahkan tambah data lagi atau <a href=' . $this->base_link . '>Klik disini</a> 
                              untuk kembali');
         } else {
             parent::alert('error', 'Gagal !', 'Data kategori produk gagal disimpan !');
         }
     }
     if ($pcategory['publish'] == 'Y') {
         $publish = $this->radio_config('publish', 'checked', '');
     } else {
         $publish = $this->radio_config('publish', '', 'checked');
     }
     $pcategory_data = $this->pcategory_data($_GET['id'], $_GET['id'], $pcategory['name'], $pcategory['image'], $pcategory['description']);
     $pcategory_config = $this->pcategory_config($publish, $pcategory['meta_desc'], $pcategory['meta_key']);
     $this->form_data('Ubah data kategori produk', $pcategory_data, $pcategory_config);
 }