26 $q =
"DELETE FROM int_link WHERE source_type = ".
27 $ilDB->quote($a_source_type,
"text").
" AND source_id=".
28 $ilDB->quote((
int) $a_source_id,
"integer");
29 $ilDB->manipulate($q);
43 $ilDB->manipulateF(
"DELETE FROM int_link WHERE target_type = %s ".
44 " AND target_id = %s AND target_inst = %s ",
45 array(
"text",
"integer",
"integer"),
46 array($a_target_type, (
int) $a_target_id, (
int) $a_target_inst));
58 function _saveLink($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst = 0)
62 $ilDB->manipulate(
"DELETE FROM int_link WHERE ".
63 "source_type = ".$ilDB->quote($a_source_type,
"text").
" AND ".
64 "source_id = ".$ilDB->quote((
int) $a_source_id,
"integer").
" AND ".
65 "target_type = ".$ilDB->quote($a_target_type,
"text").
" AND ".
66 "target_id = ".$ilDB->quote((
int) $a_target_id,
"integer").
" AND ".
67 "target_inst = ".$ilDB->quote((
int) $a_target_inst,
"integer"));
68 $ilDB->manipulate(
"INSERT INTO int_link ".
69 "(source_type, source_id, target_type, target_id, target_inst) VALUES (".
70 $ilDB->quote($a_source_type,
"text").
",".
71 $ilDB->quote((
int) $a_source_id,
"integer").
",".
72 $ilDB->quote($a_target_type,
"text").
",".
73 $ilDB->quote((
int) $a_target_id,
"integer").
",".
74 $ilDB->quote((
int) $a_target_inst,
"integer").
")");
90 $q =
"SELECT * FROM int_link WHERE ".
91 "target_type = ".$ilDB->quote($a_target_type,
"text").
" AND ".
92 "target_id = ".$ilDB->quote((
int) $a_target_id,
"integer").
" AND ".
93 "target_inst = ".$ilDB->quote((
int) $a_target_inst,
"integer");
94 $source_set = $ilDB->query($q);
96 while ($source_rec = $ilDB->fetchAssoc($source_set))
98 $sources[$source_rec[
"source_type"].
":".$source_rec[
"source_id"]] =
99 array(
"type" => $source_rec[
"source_type"],
"id" => $source_rec[
"source_id"]);
117 $q =
"SELECT * FROM int_link WHERE ".
118 "source_type = ".$ilDB->quote($a_source_type,
"text").
" AND ".
119 "source_id = ".$ilDB->quote((
int) $a_source_id,
"integer");
121 $target_set = $ilDB->query($q);
123 while ($target_rec = $ilDB->fetchAssoc($target_set))
125 $targets[$target_rec[
"target_type"].
":".$target_rec[
"target_id"].
":".$target_rec[
"target_inst"]] =
126 array(
"type" => $target_rec[
"target_type"],
"id" => $target_rec[
"target_id"],
127 "inst" => $target_rec[
"target_inst"]);
150 return "il__pg_".$id;
154 case "StructureObject":
158 return "il__st_".$id;
166 return "il__git_".$id;
174 return "il__mob_".$id;
178 case "RepositoryItem":
180 $tarr = explode(
"_", $a_target);
181 $import_id = $a_target;
187 $import_id = $tarr[0].
"_".$tarr[1].
"_".$tarr[2].
"_".$tarr[3];
195 return "il__obj_".$tarr[4];
207 foreach ($refs as $ref)
209 return "il__obj_".$ref;
234 case "StructureObject":
246 case "RepositoryItem":
247 if (is_int(strpos($a_target,
"_")))
250 return $tree->isInTree(
$ref_id);
265 if (!is_int(strpos($a_target,
"__")))
267 $target = explode(
"_", $a_target);
283 if (!is_int(strpos($a_target,
"__")))
285 $target = explode(
"_", $a_target);
288 return "il__".$target[2].
"_".$target[3];
301 $target = explode(
"_", $a_target);
302 return $target[count($target) - 1];
312 $target = explode(
"_", $a_target);
313 return $target[count($target) - 2];