<?php



defined('BASEPATH') OR exit('No direct script access allowed');







class Prioritas_kegiatan extends CI_Controller {



	



    public function __construct(){



        parent::__construct();		



        $this->load->model('M_prioritas_kegiatan');



    }



	public function data_Prioritas_kegiatan(){



        $result = $this->M_prioritas_kegiatan->data_Prioritas_kegiatan()->result_array();



        /*for($i=0; $i<count($result);$i++){



            $data['id_penerima'] = $result[$i]['id_penerima'];



            $donasi = $this->m_penerima->data_donasi($data)->result_array();



            $a=0;



            for($o=0; $o<count($donasi);$o++){



                $a+=$donasi[$o]['donasi'];



            }



            $result[$i]['hasil_donasi']=$a;



        }*/



        echo json_encode($result);



    }



    public function simpan_prioritas_kegiatan(){



        $data["nama"] = $this->input->post('nama',TRUE);



        $data["keterangan"]         = $this->input->post('keterangan',TRUE);



        $respon = $this->M_prioritas_kegiatan->simpan_prioritas_kegiatan($data);



        echo json_encode($respon);



        // echo json_encode("jhgjgfhfytft6yfty");



    }



    public function ambil_prioritas_kegiatan(){



        $data["id_prioritas_kegiatan"] = $this->input->post('id_prioritas_kegiatan',TRUE);



        $respon = $this->M_prioritas_kegiatan->ambil_prioritas_kegiatan($data)->row_array();



        echo json_encode($respon);



        // echo json_encode($data["id_unit_misioner"]);



    }



    public function update_prioritas_kegiatan(){



        $data["id_prioritas_kegiatan"]         = $this->input->post('id_prioritas_kegiatan',TRUE);



        $data["nama"] = $this->input->post('nama',TRUE);



        $data["keterangan"]         = $this->input->post('keterangan',TRUE);



        $respon = $this->M_prioritas_kegiatan->update_prioritas_kegiatan($data);



        echo json_encode($respon);



        // echo json_encode("jhgjgfhfytft6yfty");



    }



    public function hapus_prioritas_kegiatan(){



        $data["id_prioritas_kegiatan"]         = $this->input->post('id_prioritas_kegiatan',TRUE);



        $respon = $this->M_prioritas_kegiatan->hapus_prioritas_kegiatan($data);



        echo json_encode($respon);



    }



}



