当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchResult::setFile方法代码示例

本文整理汇总了PHP中SearchResult::setFile方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchResult::setFile方法的具体用法?PHP SearchResult::setFile怎么用?PHP SearchResult::setFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchResult的用法示例。


在下文中一共展示了SearchResult::setFile方法的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::setFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。