32 include_once
"./Services/Tree/classes/class.ilTree.php";
55 define(
"TABLE_SEARCH_TREE",
"search_tree");
56 define(
"TABLE_SEARCH_DATA",
"search_data");
60 $this->user_id = $a_user_id;
90 $this->root_id = $a_root_id;
94 $this->folder_id = $a_folder_id;
102 $this->user_id = $a_user_id;
111 $this->title = $a_title;
120 return $this->s_tree->getChilds($this->
getFolderId(),
"type",
"DESC");
126 return $childs[0][
"type"] ==
"seaf" ?
true :
false;
132 return $childs[count($childs)-1][
"type"] ==
"sea" ?
true :
false;
136 $childs = $this->s_tree->getChilds($this->
getRootId(),
"type",
"DESC");
141 if($childs[$counter][
"type"] !=
"seaf")
157 $this->parent_id = $a_parent_id;
165 function delete($a_folder_id)
167 $subtree = $this->s_tree->getSubTree($this->s_tree->getNodeData($a_folder_id));
169 foreach($subtree as $node)
172 $query =
"DELETE FROM ".TABLE_SEARCH_DATA.
" ".
173 "WHERE user_id = '".$this->getUserId().
"' ".
174 "AND obj_id = '".$node[
"obj_id"].
"'";
176 $res = $this->ilias->db->query($query);
179 $this->s_tree->deleteTree($this->s_tree->getNodeData($a_folder_id));
191 $query =
"INSERT INTO ".TABLE_SEARCH_DATA .
" ".
192 "SET user_id = '".$this->getUserId().
"', ".
193 "title = '".$search_result->getTitle().
"', ".
194 "target = '".$search_result->getTarget().
"', ".
197 $res = $this->ilias->db->query($query);
199 $this->s_tree->insertNode($this->ilias->db->getLastInsertId(),$this->
getFolderId());
206 $query =
"UPDATE ".TABLE_SEARCH_DATA.
" ".
207 "SET title = '".addslashes($a_title).
"' ".
208 "WHERE obj_id = '".$this->getFolderId().
"' ".
209 "AND user_id = '".$this->getUserId().
"'";
211 $res = $this->ilias->db->query($query);
219 $query =
"INSERT INTO ".TABLE_SEARCH_DATA .
" ".
220 "SET user_id = '".$this->getUserId().
"', ".
221 "title = '".addslashes($a_title).
"', ".
224 $res = $this->ilias->db->query($query);
226 $this->s_tree->insertNode($this->ilias->db->getLastInsertId(),$this->
getFolderId());
229 $new_obj->setTitle($a_title);
247 $subtree = $this->s_tree->getSubtree($this->s_tree->getNodeData($this->getFolderId()));
250 foreach($subtree as $node)
252 if($node[
"type"] ==
"seaf")
257 return count($filtered) ? $filtered : array();
262 $query =
"SELECT * FROM ".TABLE_SEARCH_TREE.
", ".TABLE_SEARCH_DATA.
" ".
263 "WHERE child = obj_id ".
264 "AND child = '".$this->getFolderId().
"' ".
265 "AND tree = '".$this->getUserId().
"'";
267 $res = $this->ilias->db->query($query);
279 $this->s_tree->setTableNames(TABLE_SEARCH_TREE,TABLE_SEARCH_DATA);
286 $query =
"SELECT tree FROM ".TABLE_SEARCH_TREE.
" ".
287 "WHERE tree = ".$this->getUserId();
289 $res = $this->ilias->db->query($query);
291 return $res->numRows() ?
true :
false;
297 $query =
"INSERT INTO ".TABLE_SEARCH_DATA.
" ".
298 "SET user_id = '".$this->getUserId().
"', ".
301 $res = $this->ilias->db->query($query);
315 $query =
"SELECT child FROM ".TABLE_SEARCH_TREE.
" ".
316 "WHERE tree = '".$this->getUserId().
"' ".
319 $res = $this->ilias->db->query($query);
329 return $this->ilias->db->getLastInsertId();