66 $this->usr_id = $a_usr_id;
81 if(is_object(self::$instance) and self::$instance)
98 $this->search_type = $a_type;
111 return $this->search_result ? $this->search_result : array();
123 $this->search_result = $a_results;
135 $this->search_result[$a_result_item[
'ref_id']][
'ref_id'] = $a_result_item[
'ref_id'];
136 $this->search_result[$a_result_item[
'ref_id']][
'obj_id'] = $a_result_item[
'obj_id'];
137 $this->search_result[$a_result_item[
'ref_id']][
'type'] = $a_result_item[
'type'];
150 $this->failed[$a_ref_id] = $a_ref_id;
162 return in_array($a_ref_id,$this->failed) ?
true :
false;
175 $this->checked[$a_ref_id] = $a_obj_id;
187 return array_key_exists($a_ref_id,$this->checked) and $this->checked[$a_ref_id];
199 return $this->checked ? $this->checked : array();
212 $this->page_number = $a_number;
224 return $this->page_number ? $this->page_number : 1;
233 public function delete()
235 $query =
"DELETE FROM usr_search ".
236 "WHERE usr_id = ".$this->db->quote($this->usr_id).
" ".
237 "AND search_type = ".$this->db->quote($this->search_type);
239 $res = $this->db->query($query);
252 if($this->usr_id == ANONYMOUS_USER_ID)
257 $query =
"DELETE FROM usr_search ".
258 "WHERE usr_id = ".$this->db->quote($this->usr_id).
" ".
259 "AND search_type = ".$this->db->quote($this->search_type);
260 $res = $this->db->query($query);
262 $query =
"INSERT INTO usr_search ".
263 "SET usr_id = ".$this->db->quote($this->usr_id).
", ".
264 "search_result = '".addslashes(serialize($this->search_result)).
"', ".
265 "checked = '".addslashes(serialize($this->checked)).
"', ".
266 "failed = '".addslashes(serialize($this->failed)).
"', ".
267 "page = ".$this->db->quote($this->page_number).
", ".
268 "search_type = ".$this->db->quote($this->search_type);
269 $res = $this->db->query($query);
281 $this->failed = array();
282 $this->checked = array();
283 $this->search_result = array();
284 $this->page_number = 0;
286 if($this->usr_id == ANONYMOUS_USER_ID)
291 $query =
"SELECT * FROM usr_search ".
292 "WHERE usr_id = ".$this->db->quote($this->usr_id).
" ".
293 "AND search_type = ".$this->db->quote($this->search_type);
295 $res = $this->db->query($query);
298 $this->search_result = unserialize(stripslashes($row->search_result));
299 if(strlen($row->checked))
301 $this->checked = unserialize(stripslashes($row->checked));
303 if(strlen($row->failed))
305 $this->failed = unserialize(stripslashes($row->failed));
307 $this->page_number = $row->page;