📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
projetakipscripti.demodesign.com.tr
/
application
/
controllers
📝
Musteri.php
← Geri Dön
<?php /* * Generated by CRUDigniter v3.2 * www.crudigniter.com */ class Musteri extends CI_Controller{ function __construct() { parent::__construct(); $this->load->model('Musteri_model'); // CI viewden controlleri calıstırmak için gerekli $CI = NULL; $this->CI = & get_instance(); // Giris Yapılmamış ise logine gönderiyoruz.. $userid = $this->session->userdata('userid'); if(empty($userid)) { redirect('login'); } // Yetkili Degil ise Anasayfa gönderiyoruz.. // Calisanlar Giremez $userid = $this->session->userdata('useryetki'); if($userid!=1) { redirect('anasayfa'); } } /* * Listing of musteri */ function index() { $data['musteri'] = $this->db->query("SELECT * FROM musteri WHERE aktif=1 ORDER BY id DESC")->result_array(); //anlık kontrol aktifleştirme $data['sayfaad'] = 'admin_musteri'; $data['anlikkontrol'] = 1; $data['_view'] = 'musteri/index'; $this->load->view('layouts/main',$data); } /* * Adding a new musteri */ function add() { if(isset($_POST) && count($_POST) > 0) { ///logoyu alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('logo')) { $dosyaurl = site_url('/resources/varsayilanprofil/musteri.png'); $yenidosyaad = md5(date("d.m.Y H:i")) . '.png'; copy($dosyaurl , './uploads/' . $yenidosyaad); $logo=$yenidosyaad; } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, 'width' => 250, 'height' => 250, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $logo=$data['file_name']; } ///Reçete alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'pdf|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('recete')) { $recete=""; } else { $data=$this->upload->data(); $recete=$data['file_name']; } $params = array( 'logo' => $logo, 'ad' => $this->input->post('ad'), 'adres' => $this->input->post('adres'), 'ucret' => $this->input->post('ucret'), 'odemetarih' => $this->input->post('odemetarih'), 'kayittarih' => $this->input->post('kayittarih'), 'aktif' => 1, ); if (isset($recete)) { $params['recete'] = $recete; }; $calisan_id = $this->Musteri_model->add_musteri($params); redirect('musteri/index'); // echo site_url('musteri/index'); }else { $data['_view'] = 'musteri/add'; $this->load->view('layouts/main',$data); } } /* * Editing a musteri */ function edit($id) { // check if the musteri exists before trying to edit it $data['musteri'] = $this->Musteri_model->get_musteri($id); if(isset($data['musteri']['id'])) { if(isset($_POST) && count($_POST) > 0) { ///logoyu alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('logo')) { $error = array('error' => $this->upload->display_errors()); // print_r ($error); } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, 'width' => 250, 'height' => 250, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $logo=$data['file_name']; } ///Reçete alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'pdf|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); if ( ! $this->upload->do_upload('recete')) { $error = array('error' => $this->upload->display_errors()); // print_r ($error); } else { $data=$this->upload->data(); $recete=$data['file_name']; } ///Arkafotoyu alıyoruz $this->load->library('upload', $config); if ( ! $this->upload->do_upload('arkafoto')) { } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, 'width' => 872, 'height' => 270, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $arkafoto=$data['file_name']; } //verileri $params = array( 'ad' => $this->input->post('ad'), 'adres' => $this->input->post('adres'), 'ucret' => $this->input->post('ucret'), 'odemetarih' => $this->input->post('odemetarih'), 'kayittarih' => $this->input->post('kayittarih'), ); if(isset($logo)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('musteri')->row_array(); $eskidosyaadi= $query['logo']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); } $params['logo']=$logo; } if(isset($recete)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('musteri')->row_array(); $eskidosyaadi= $query['recete']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); }; $params['recete']=$recete; } if(isset($arkafoto)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('musteri')->row_array(); $eskidosyaadi= $query['recete']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); } $params['arkafoto']=$arkafoto; } $this->Musteri_model->update_musteri($id,$params); redirect('musteri/index'); // echo site_url('musteri/index'); } else { $data['_view'] = 'musteri/edit'; $this->load->view('layouts/main',$data); } } else show_error('The musteri you are trying to edit does not exist.'); } /* * Deleting musteri */ function remove($id) { $musteri = $this->Musteri_model->get_musteri($id); // check if the musteri exists before trying to delete it if(isset($musteri['id'])) { $params['aktif']=0; $this->Musteri_model->update_musteri($id,$params); redirect('musteri/index'); } else show_error('The musteri you are trying to delete does not exist.'); } }
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula