コード例 #1
0
ファイル: sms.php プロジェクト: isandroid/gerbang-sms
 public function kirim_kontak_proses()
 {
     $data['TextDecoded'] = $this->input->post('TextDecoded');
     $kontak_array = model_kontak::read(array('pbk_id' => $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');
 }
コード例 #2
0
ファイル: kontak.php プロジェクト: isandroid/gerbang-sms
 public function hapus($id = "")
 {
     if ($id == "") {
         show_404();
     }
     model_kontak::delete(array('pbk_id' => $id));
     model_crud::$tabel = "pbk_relasi";
     model_crud::$tabel_join = array();
     model_crud::delete(array('pbk_id' => $id));
     redirect(site_url('/kontak/lihat'), 'refresh');
 }
コード例 #3
0
ファイル: pdf_tajnid.php プロジェクト: isandroid/gerbang-sms
 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;
 }