當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SearchResult::setTanggal方法代碼示例

本文整理匯總了PHP中SearchResult::setTanggal方法的典型用法代碼示例。如果您正苦於以下問題:PHP SearchResult::setTanggal方法的具體用法?PHP SearchResult::setTanggal怎麽用?PHP SearchResult::setTanggal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SearchResult的用法示例。


在下文中一共展示了SearchResult::setTanggal方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findByAlamat

 public function findByAlamat()
 {
     if ($this->before != null and $this->after == null) {
         $sql = "SELECT id_lamp as id, tanggal as tgl, nomor as nomor, hal as hal, asal as alamat, file as file, 'lampiran' as tipe FROM lampiran WHERE asal LIKE '%{$this->keyword}%' AND tanggal>='" . $this->before . "'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratmasuk as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_masuk' as tipe FROM suratmasuk a LEFT JOIN alamat b ON a.asal_surat = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%' AND a.tgl_surat>='" . $this->before . "'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratkeluar as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_keluar' as tipe FROM suratkeluar a LEFT JOIN alamat b ON a.tujuan = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%' AND a.tgl_surat>='" . $this->before . "'";
     } elseif ($this->before == null and $this->after != null) {
         $sql = "SELECT id_lamp as id, tanggal as tgl, nomor as nomor, hal as hal, asal as alamat, file as file, 'lampiran' as tipe FROM lampiran WHERE asal LIKE '%{$this->keyword}%' AND tanggal<='" . $this->after . "'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratmasuk as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_masuk' as tipe FROM suratmasuk a LEFT JOIN alamat b ON a.asal_surat = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%' AND a.tgl_surat<='" . $this->after . "'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratkeluar as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_keluar' as tipe FROM suratkeluar a LEFT JOIN alamat b ON a.tujuan = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%' AND a.tgl_surat<='" . $this->after . "'";
     } elseif ($this->before != null and $this->after != null) {
         $sql = "SELECT id_lamp as id, tanggal as tgl, nomor as nomor, hal as hal, asal as alamat, file as file, 'lampiran' as tipe FROM lampiran WHERE asal LIKE '%{$this->keyword}%'  AND tanggal>='" . $this->before . "' AND tanggal<='" . $this->after . "'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratmasuk as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_masuk' as tipe FROM suratmasuk a LEFT JOIN alamat b ON a.asal_surat = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%' AND a.tgl_surat>='" . $this->before . "' AND a.tgl_surat<='" . $this->after . "'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratkeluar as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_keluar' as tipe FROM suratkeluar a LEFT JOIN alamat b ON a.tujuan = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%' AND a.tgl_surat>='" . $this->before . "' AND a.tgl_surat<='" . $this->after . "'";
     } else {
         $sql = "SELECT id_lamp as id, tanggal as tgl, nomor as nomor, hal as hal, asal as alamat, file as file, 'lampiran' as tipe FROM lampiran WHERE asal LIKE '%{$this->keyword}%'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratmasuk as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_masuk' as tipe FROM suratmasuk a LEFT JOIN alamat b ON a.asal_surat = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%'";
         $sql .= " UNION ";
         $sql .= "SELECT a.id_suratkeluar as id, a.tgl_surat as tgl, a.no_surat as nomor, a.perihal as hal, b.nama_satker as alamat, a.file as file, 'surat_keluar' as tipe FROM suratkeluar a LEFT JOIN alamat b ON a.tujuan = b.kode_satker WHERE b.nama_satker LIKE '%{$this->keyword}%'";
     }
     $sql .= " ORDER BY tgl DESC";
     //        var_dump($sql);
     $data = $this->select($sql);
     $result = array();
     foreach ($data as $val) {
         $cari = new SearchResult();
         $cari->setId($val['id']);
         $cari->setTanggal($val['tgl']);
         $cari->setNomor($val['nomor']);
         $cari->setPerihal($val['hal']);
         $cari->setTipe($val['tipe']);
         $cari->setFile($val['file']);
         $result[] = $cari;
     }
     return $result;
 }
開發者ID:ryderonil,項目名稱:sisurip,代碼行數:43,代碼來源:cari_model.php


注:本文中的SearchResult::setTanggal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。