Esempio n. 1
0
 public function index()
 {
     model_crud::$tabel = 'phones';
     model_crud::$tabel_join = array();
     $data = (array) model_crud::read()[0];
     $data['modem_status'] = $this->lib_daemon->modem_status();
     $this->load->view('theme/theme_kepala');
     $this->load->view('status', $data);
     $this->load->view('theme/theme_kaki');
 }
Esempio n. 2
0
 public static function read_anggota($array_grup)
 {
     model_crud::$tabel = 'pbk';
     model_crud::$tabel_join = array('pbk_relasi' => 'pbk.pbk_id = pbk_relasi.pbk_id');
     $anggota_grup = model_crud::read(array('grup_id' => $array_grup), array(), 'pbk.*', true);
     $objek = array();
     foreach ($anggota_grup as $anggota) {
         $objek[] = new model_kontak($anggota);
     }
     return $objek;
 }
Esempio n. 3
0
 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');
 }
Esempio n. 4
0
 public function __construct($data)
 {
     $this->id = $data->pbk_id;
     $this->nama = $data->nama;
     $this->nomor = $data->nomor;
     $this->keterangan = $data->keterangan;
     model_crud::$tabel = 'pbk_relasi';
     model_crud::$tabel_join = array();
     $relasi_array = model_crud::read(array('pbk_id' => $data->pbk_id));
     if ($relasi_array !== false) {
         foreach ($relasi_array as $relasi) {
             $this->anggota[] = $relasi->grup_id;
         }
     }
 }
Esempio n. 5
0
 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;
 }