public function hapus($id = "") { if ($id == "") { show_404(); } model_grup::delete(array('grup_id' => $id)); model_crud::$tabel = "pbk_relasi"; model_crud::$tabel_join = array(); model_crud::delete(array('grup_id' => $id)); redirect(site_url('/grup'), 'refresh'); }
public function ubah($id) { if ($id == "") { show_404(); } $form_isi = model_kontak::read(array('pbk_id' => $id))[$id]; // jika kontak tidak ditemukan if ($form_isi === false) { show_404(); } $data = array('url' => '/kontak/ubah_proses', 'isi_form' => array('pbk_id' => $form_isi->get_id(), 'nama' => $form_isi->get_nama(), 'nomor' => $form_isi->get_nomor(), 'keterangan' => $form_isi->get_keterangan(), 'grup_id' => $form_isi->get_anggota()), 'grup_array' => model_grup::read()); $this->load->view('theme/theme_kepala'); $this->load->view('kontak/kontak_formulir', $data); $this->load->view('theme/theme_kaki'); }
public function kirim_grup_proses() { $data['TextDecoded'] = $this->input->post('TextDecoded'); $kontak_array = model_grup::read_anggota($this->input->post('id')); foreach ($kontak_array as $kontak) { if ($kontak->get_nomor() !== "") { $nomor[] = $kontak->get_nomor(); } } // menghindari duplikasi nomor $nomor = array_unique($nomor); $data['DestinationNumber'] = implode(',', $nomor); $pesan = new model_pesan($data); $pesan->kirim(); $data['sms_jumlah'] = count($pesan->get_penerima()) * count($pesan->get_pesan_isi()); $this->load->view('theme/theme_kepala'); $this->load->view('utama', $data); $this->load->view('theme/theme_kaki'); }
private function ekstrak($filename) { // membuat data grup $grup_array = model_grup::read(); $grup_huruf_id = array(); foreach ($grup_array as $grup) { $grup_huruf_id[$grup->get_keterangan()] = $grup->get_id(); } // membaca file pdf set_time_limit(1200); system('chmod 0777 ' . $filename); $content = shell_exec('pdftotext -fixed 2000 ' . $filename . ' - '); system('rm -rf ' . $filename); $separator = "\r\n"; // inisialisasi $tz = " "; $line = strtok($content, $separator); $i = 0; while ($line !== false) { $char_1 = ord($line[0]); // jika karakter pertama adalah angka if ($char_1 >= 48 && $char_1 <= 57 && strlen($line) == 5) { $i++; $data = new stdClass(); // kalau angka berarti nomor AIMS $data->pbk_id = $line; // baris selanjutnya adalah nama $data->nama = strtok($separator); $nomor = array(); // beberapa baris selanjutnya adalah nomor telepon while (($line = strtok($separator)) && ($char_1 = ord($line[0])) && ($char_1 >= 48 && $char_1 <= 57 || $char_1 == 43 || $char_1 == 39)) { // membersihkan $line = str_replace(" ", "", $line); $line = str_replace("'", "", $line); $line = str_replace("-", "", $line); $line = str_replace("+", "", $line); $nomor[] = $line; } if (strlen($line) <= 3) { $rel = $line; } else { $rel = strtok($separator); } $tz = strtok($separator); if (strlen($tz) > 0 && $tz[strlen($tz) - 1] == 'M') { $nomor_wasiyat = strtok($separator); } $data->nomor = implode(', ', $nomor); $debug .= "\n{$i} -----------------------------------\n"; $debug .= var_export($data, true); $debug .= "\n-----------------------------------\n"; debug_ekstrak || model_kontak::create($data); // menambahkan relasi kontak-grup model_crud::$tabel = "pbk_relasi"; model_crud::$tabel_join = array(); $relasi = array('pbk_id' => $data->pbk_id); $relasi['grup_id'] = 1; debug_ekstrak || model_crud::create($relasi); $relasi['grup_id'] = $grup_huruf_id[$tz[0]]; debug_ekstrak || model_crud::create($relasi); } else { $line = strtok($separator); } } return $debug; }