db = $db; } function view($uuid) { $sql = "SELECT * FROM ".$this->tbl_metadata." WHERE uuid='$uuid'"; $rs = $this->db->query($sql); return $rs->fetch(); } function DatasFilter($options) { $wheresql = array(); if(isset($options['east'])) { $wheresql[] = " md.east < ".$options['east']; } if(isset($options['west'])) { $wheresql[] = " md.west > ".$options['west']; } if(isset($options['north'])) { $wheresql[] = " md.north < ".$options['north']; } if(isset($options['south'])) { $wheresql[] = " md.south > ".$options['south']; } if(isset($options['q'])) { if(preg_match("/\'/",$options['q'])) { $q = preg_replace("/\'/","''",$options['q']); }else{ $q = $options['q']; } $wheresql[] = " md.title LIKE '%$q%' "; } if(count($wheresql)>0) { $wheresql = " WHERE ".join(" AND ",$wheresql); }else{ $wheresql = ""; } $sql = "SELECT md.* FROM ".$this->tbl_metadata." md $wheresql"; $rs = $this->db->query($sql); return $rs->fetchAll(); } }