72 $this->usr_id = $a_usr_id;
87 if(is_object(self::$instance) and self::$instance)
104 $this->search_type = $a_type;
117 return $this->search_result ? $this->search_result : array();
129 $this->search_result = $a_results;
141 $this->search_result[$a_result_item[
'ref_id']][
'ref_id'] = $a_result_item[
'ref_id'];
142 $this->search_result[$a_result_item[
'ref_id']][
'obj_id'] = $a_result_item[
'obj_id'];
143 $this->search_result[$a_result_item[
'ref_id']][
'type'] = $a_result_item[
'type'];
156 $this->failed[$a_ref_id] = $a_ref_id;
168 return in_array($a_ref_id,$this->failed) ?
true :
false;
181 $this->checked[$a_ref_id] = $a_obj_id;
193 return array_key_exists($a_ref_id,$this->checked) and $this->checked[$a_ref_id];
205 return $this->checked ? $this->checked : array();
218 $this->page_number = $a_number;
230 return $this->page_number ? $this->page_number : 1;
240 $this->query = $a_query;
260 $this->root = $a_root;
270 return $this->root ? $this->root : ROOT_FOLDER_ID;
275 $this->item_filter = $a_filter;
292 $query =
"SELECT COUNT(*) num FROM usr_search ".
293 "WHERE usr_id = ".$ilDB->quote($this->usr_id,
'integer').
" ".
294 "AND search_type = ".$ilDB->quote($this->search_type,
'integer');
300 $ilDB->update(
'usr_search',
302 'search_result' => array(
'clob',serialize(array(0))),
303 'checked' => array(
'clob',serialize(array(0))),
304 'failed' => array(
'clob',serialize(array(0))),
305 'page' => array(
'integer',0)),
307 'usr_id' => array(
'integer',(
int) $this->usr_id),
308 'search_type' => array(
'integer',(
int) $this->search_type)
313 $ilDB->insert(
'usr_search',
315 'search_result' => array(
'clob',serialize(array(0))),
316 'checked' => array(
'clob',serialize(array(0))),
317 'failed' => array(
'clob',serialize(array(0))),
318 'page' => array(
'integer',0),
319 'usr_id' => array(
'integer',(
int) $this->usr_id),
320 'search_type' => array(
'integer',(
int) $this->search_type)
325 $this->search_result = array();
326 $this->checked = array();
327 $this->failed = array();
337 public function delete()
341 $query =
"DELETE FROM usr_search ".
342 "WHERE usr_id = ".$this->db->quote($this->usr_id ,
'integer').
" ".
343 "AND search_type = ".$this->db->quote($this->search_type ,
'integer');
360 if($this->usr_id == ANONYMOUS_USER_ID)
364 if(!$this->usr_id) $this->usr_id = 0;
365 if(!$this->page_number) $this->page_number = 0;
366 if(!$this->search_type) $this->search_type = 0;
368 $query =
"DELETE FROM usr_search ".
369 "WHERE usr_id = ".$ilDB->quote($this->usr_id ,
'integer').
" ".
370 "AND search_type = ".$ilDB->quote($this->search_type ,
'integer');
373 $ilDB->insert(
'usr_search',array(
374 'usr_id' => array(
'integer',$this->usr_id),
375 'search_result' => array(
'clob',serialize($this->search_result)),
376 'checked' => array(
'clob',serialize($this->checked)),
377 'failed' => array(
'clob',serialize($this->failed)),
378 'page' => array(
'integer',$this->page_number),
379 'search_type' => array(
'integer',$this->search_type),
380 'query' => array(
'clob',serialize($this->
getQuery())),
381 'root' => array(
'integer',$this->
getRoot())));
383 #if($this->getItemFilter())
399 $this->failed = array();
400 $this->checked = array();
401 $this->search_result = array();
402 $this->page_number = 0;
404 if($this->usr_id == ANONYMOUS_USER_ID)
409 $query =
"SELECT * FROM usr_search ".
410 "WHERE usr_id = ".$this->db->quote($this->usr_id ,
'integer').
" ".
411 "AND search_type = ".$this->db->quote($this->search_type ,
'integer');
416 $this->search_result = unserialize(stripslashes(
$row->search_result));
417 if(strlen(
$row->checked))
419 $this->checked = unserialize(stripslashes(
$row->checked));
421 if(strlen(
$row->failed))
423 $this->failed = unserialize(stripslashes(
$row->failed));
425 $this->page_number =
$row->page;