📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
projetakipscripti.demodesign.com.tr
/
application
/
controllers
📝
Calisan.php
← Geri Dön
<?php /* * Generated by CRUDigniter v3.2 * www.crudigniter.com */ class Calisan extends CI_Controller{ function __construct() { parent::__construct(); $this->load->model('Calisan_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 calisan */ function index() { //sayfalama yapılmışsa ve istek sayfa varsa o sayfayı cekiyoruz eger yoksa ilk sayfayı cekiyoruz. $ks=$this->uri->segment(3); $this->load->model('Sayfalama_model'); if(empty($ks)) { $data['calisan'] = $this->Sayfalama_model->sayfalama_getir_calisanlar_admin(0); $data['aktifsayfa']=0; }else{ $data['calisan'] = $this->Sayfalama_model->sayfalama_getir_calisanlar_admin($ks); $data['aktifsayfa']=$ks; } //kayıt sayısını alıyoruz $data['kayitsayi'] = $this->Sayfalama_model->calisanlar_toplam_kayit_sayi(); //anlık kontrol aktifleştirme $data['sayfaad'] = 'admin_calisan'; $data['anlikkontrol'] = 1; $data['_view'] = 'calisan/index'; $this->load->view('layouts/main',$data); } function add() { if(isset($_POST) && count($_POST) > 0) { $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('profil')) { $dosyaurl = site_url('/resources/varsayilanprofil/calisan.png'); $yenidosyaad = md5(date("d.m.Y H:i")) . '.png'; copy($dosyaurl , './uploads/' . $yenidosyaad); $dosya=$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(); $dosya=$data['file_name']; } $params = array( 'tur' => $this->input->post('tur'), 'ad' => $this->input->post('ad'), 'kulad' => $this->input->post('kulad'), 'sifre' => $this->input->post('sifre'), 'profil' => $dosya, 'telefon' => $this->input->post('telefon'), 'mail' => $this->input->post('mail'), 'iban' => $this->input->post('iban'), 'aktif' => 1, ); $calisan_id = $this->Calisan_model->add_calisan($params); redirect('calisan/index'); //echo site_url('calisan/index'); } else { $this->load->model('Calisantur_model'); $data['all_calisantur'] = $this->Calisantur_model->get_all_calisantur(); $data['_view'] = 'calisan/add'; $this->load->view('layouts/main',$data); } } /* * Editing a calisan */ function edit($id) { // check if the calisan exists before trying to edit it $data['calisan'] = $this->Calisan_model->get_calisan($id); if(isset($data['calisan']['id'])) { if(isset($_POST) && count($_POST) > 0) { $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('profil')) { $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(); $dosya=$data['file_name']; } if(isset($dosya)) { //Eski Dosyayı Bulup Siliyoruz $this->load->model('Calisan_model'); $eskidosyaadi=$this->Calisan_model->get_calisan_profil($id); unlink('uploads/'.$eskidosyaadi); $params = array( 'tur' => $this->input->post('tur'), 'ad' => $this->input->post('ad'), 'kulad' => $this->input->post('kulad'), 'sifre' => $this->input->post('sifre'), 'profil' => $dosya, 'telefon' => $this->input->post('telefon'), 'mail' => $this->input->post('mail'), 'iban' => $this->input->post('iban'), ); }else{ $params = array( 'tur' => $this->input->post('tur'), 'ad' => $this->input->post('ad'), 'kulad' => $this->input->post('kulad'), 'sifre' => $this->input->post('sifre'), 'telefon' => $this->input->post('telefon'), 'mail' => $this->input->post('mail'), 'iban' => $this->input->post('iban'), ); } $this->Calisan_model->update_calisan($id,$params); redirect('calisan/index'); //echo site_url('calisan/index'); } else { $this->load->model('Calisantur_model'); $data['all_calisantur'] = $this->Calisantur_model->get_all_calisantur(); $data['_view'] = 'calisan/edit'; $this->load->view('layouts/main',$data); } } else show_error('The calisan you are trying to edit does not exist.'); } /* * Deleting calisan */ function remove($id) { $calisan = $this->Calisan_model->get_calisan($id); if($calisan['tur']==1) { redirect('calisan/index'); } // check if the calisan exists before trying to delete it if(isset($calisan['id'])) { $params = array( 'aktif' => 0, ); $this->Calisan_model->update_calisan($id,$params); redirect('calisan/index'); } else show_error('The calisan 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