ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilInternalLink Class Reference

Class ilInternalLink. More...

+ Collaboration diagram for ilInternalLink:

Public Member Functions

 _deleteAllLinksOfSource ($a_source_type, $a_source_id)
 delete all links of a given source
 _deleteAllLinksToTarget ($a_target_type, $a_target_id, $a_target_inst=0)
 delete all links to a given target
 _saveLink ($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0)
 save internal link information
 _getSourcesOfTarget ($a_target_type, $a_target_id, $a_target_inst)
 get all sources of a link target
 _getTargetsOfSource ($a_source_type, $a_source_id)
 get all targets of a source object (e.g., a page)
 _getIdForImportId ($a_type, $a_target)
 get current id for an import id
 _exists ($a_type, $a_target)
 check if internal link refers to a valid target
 _extractInstOfTarget ($a_target)
 extract installation id out of target
 _removeInstFromTarget ($a_target)
 removes installation id from target string
 _extractObjIdOfTarget ($a_target)
 extract object id out of target
 _extractTypeOfTarget ($a_target)
 extract type out of target

Detailed Description

Class ilInternalLink.

Some methods to handle internal links

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilInternalLink.php 20152 2009-06-08 18:41:37Z akill

Definition at line 14 of file class.ilInternalLink.php.

Member Function Documentation

ilInternalLink::_deleteAllLinksOfSource (   $a_source_type,
  $a_source_id 
)

delete all links of a given source

Parameters
string$a_source_typesource type
int$a_source_ifsource id

Definition at line 22 of file class.ilInternalLink.php.

References $ilDB, and $q.

Referenced by SurveyQuestion\_resolveIntLinks(), assQuestion\_resolveIntLinks(), SurveyQuestion\delete(), assQuestion\deleteSuggestedSolutions(), ilPageObject\saveInternalLinks(), SurveyQuestion\saveMaterial(), SurveyQuestion\syncWithOriginal(), and assQuestion\updateSuggestedSolutions().

{
global $ilias, $ilDB;
$q = "DELETE FROM int_link WHERE source_type = ".
$ilDB->quote($a_source_type, "text")." AND source_id=".
$ilDB->quote((int) $a_source_id, "integer");
$ilDB->manipulate($q);
}

+ Here is the caller graph for this function:

ilInternalLink::_deleteAllLinksToTarget (   $a_target_type,
  $a_target_id,
  $a_target_inst = 0 
)

delete all links to a given target

Parameters
string$a_target_typetarget type
int$a_target_idtarget id
int$a_target_insttarget installation id

Definition at line 39 of file class.ilInternalLink.php.

References $ilDB.

Referenced by ilWikiPage\delete().

{
global $ilias, $ilDB;
$ilDB->manipulateF("DELETE FROM int_link WHERE target_type = %s ".
" AND target_id = %s AND target_inst = %s ",
array("text", "integer", "integer"),
array($a_target_type, (int) $a_target_id, (int) $a_target_inst));
}

+ Here is the caller graph for this function:

ilInternalLink::_exists (   $a_type,
  $a_target 
)

check if internal link refers to a valid target

Parameters
string$a_typetarget type ("PageObject" | "StructureObject" | "GlossaryItem" | "MediaObject")
string$a_targettarget id, e.g. "il__pg_244")
Returns
boolean true/false

Definition at line 207 of file class.ilInternalLink.php.

References $ref_id, and _extractObjIdOfTarget().

Referenced by ilPageObject\resolveIntLinks().

{
global $tree;
switch($a_type)
{
case "PageObject":
case "StructureObject":
return ilLMObject::_exists($a_target);
break;
case "GlossaryItem":
return ilGlossaryTerm::_exists($a_target);
break;
case "MediaObject":
return ilObjMediaObject::_exists($a_target);
break;
case "RepositoryItem":
if (is_int(strpos($a_target, "_")))
{
return $tree->isInTree($ref_id);
}
break;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLink::_extractInstOfTarget (   $a_target)

extract installation id out of target

Parameters
string$a_targetimport target id (e.g. "il_2_pg_22")

Definition at line 243 of file class.ilInternalLink.php.

Referenced by ilPageObject\_handleImportRepositoryLinks(), ilPCQuestionGUI\edit(), ilQuestionExporter\exportQuestion(), ilPCQuestionGUI\feedback(), ilPageObject\getQuestionIds(), ilPageObject\newQuestionCopies(), ilPageObject\resolveIntLinks(), ilSCORM2004Page\saveInternalLinks(), ilPCQuestionGUI\setTabs(), and ilLMObject\updateInternalLinks().

{
if (!is_int(strpos($a_target, "__")))
{
$target = explode("_", $a_target);
if ($target[1] > 0)
{
return $target[1];
}
}
return false;
}

+ Here is the caller graph for this function:

ilInternalLink::_extractObjIdOfTarget (   $a_target)
ilInternalLink::_extractTypeOfTarget (   $a_target)

extract type out of target

Parameters
string$a_targetimport target id (e.g. "il_2_pg_22")

Definition at line 290 of file class.ilInternalLink.php.

Referenced by ilLMObject\updateInternalLinks().

{
$target = explode("_", $a_target);
return $target[count($target) - 2];
}

+ Here is the caller graph for this function:

ilInternalLink::_getIdForImportId (   $a_type,
  $a_target 
)

get current id for an import id

Parameters
string$a_typetarget type ("PageObject" | "StructureObject" | "GlossaryItem" | "MediaObject")
string$a_targetimport target id (e.g. "il_2_pg_22")
Returns
string current target id (e.g. "il__pg_244")

Definition at line 142 of file class.ilInternalLink.php.

References ilObject\_getAllReferences().

Referenced by SurveyQuestion\_resolveInternalLink(), assQuestion\_resolveInternalLink(), ilMapArea\_resolveIntLinks(), and ilPageObject\resolveIntLinks().

{
switch($a_type)
{
case "PageObject":
if($id > 0)
{
return "il__pg_".$id;
}
break;
case "StructureObject":
if($id > 0)
{
return "il__st_".$id;
}
break;
case "GlossaryItem":
if($id > 0)
{
return "il__git_".$id;
}
break;
case "MediaObject":
if($id > 0)
{
return "il__mob_".$id;
}
break;
case "RepositoryItem":
$id = ilObject::_getIdForImportId($a_target);
//echo "-$a_target-$id-";
// get ref id for object id
// (see ilPageObject::insertInstIntoIDs for the export procedure)
if($id > 0)
{
//var_dump($refs);
foreach ($refs as $ref)
{
return "il__obj_".$ref;
}
}
break;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLink::_getSourcesOfTarget (   $a_target_type,
  $a_target_id,
  $a_target_inst 
)

get all sources of a link target

Parameters
string$a_target_typetarget type
int$a_target_idtarget id
int$a_target_insttarget installation id
Returns
array sources (array of array("type", "id"))

Definition at line 86 of file class.ilInternalLink.php.

References $ilDB, and $q.

Referenced by ilPageObject\_handleImportRepositoryLinks(), ilWikiPage\getLinksToPage(), ilWikiPage\getOrphanedPages(), ilGlossaryPresentationGUI\listDefinitions(), ilContObjParser\processPagesToParse(), and ilLMObject\updateInternalLinks().

{
global $ilias, $ilDB;
$q = "SELECT * FROM int_link WHERE ".
"target_type = ".$ilDB->quote($a_target_type, "text")." AND ".
"target_id = ".$ilDB->quote((int) $a_target_id, "integer")." AND ".
"target_inst = ".$ilDB->quote((int) $a_target_inst, "integer");
$source_set = $ilDB->query($q);
$sources = array();
while ($source_rec = $ilDB->fetchAssoc($source_set))
{
$sources[$source_rec["source_type"].":".$source_rec["source_id"]] =
array("type" => $source_rec["source_type"], "id" => $source_rec["source_id"]);
}
return $sources;
}

+ Here is the caller graph for this function:

ilInternalLink::_getTargetsOfSource (   $a_source_type,
  $a_source_id 
)

get all targets of a source object (e.g., a page)

Parameters
string$a_source_typesource type (e.g. "lm:pg" | "dbk:pg")
int$a_source_idsource id
Returns
array targets (array of array("type", "id", "inst"))

Definition at line 113 of file class.ilInternalLink.php.

References $ilDB, and $q.

Referenced by ilObjContentObject\exportHTMLPages(), ilPageObjectGUI\showPage(), and ilLMPresentationGUI\showPrintView().

{
global $ilDB;
$q = "SELECT * FROM int_link WHERE ".
"source_type = ".$ilDB->quote($a_source_type, "text")." AND ".
"source_id = ".$ilDB->quote((int) $a_source_id, "integer");
$target_set = $ilDB->query($q);
$targets = array();
while ($target_rec = $ilDB->fetchAssoc($target_set))
{
$targets[$target_rec["target_type"].":".$target_rec["target_id"].":".$target_rec["target_inst"]] =
array("type" => $target_rec["target_type"], "id" => $target_rec["target_id"],
"inst" => $target_rec["target_inst"]);
}
return $targets;
}

+ Here is the caller graph for this function:

ilInternalLink::_removeInstFromTarget (   $a_target)

removes installation id from target string

Parameters
string$a_targetimport target id (e.g. "il_2_pg_22")

Definition at line 261 of file class.ilInternalLink.php.

Referenced by ilPageObject\resolveIntLinks().

{
if (!is_int(strpos($a_target, "__")))
{
$target = explode("_", $a_target);
if ($target[1] > 0)
{
return "il__".$target[2]."_".$target[3];
}
}
return false;
}

+ Here is the caller graph for this function:

ilInternalLink::_saveLink (   $a_source_type,
  $a_source_id,
  $a_target_type,
  $a_target_id,
  $a_target_inst = 0 
)

save internal link information

Parameters
string$a_source_typesource type
int$a_source_ifsource id
string$a_target_typetarget type
int$a_target_idtarget id
int$a_target_insttarget installation id

Definition at line 58 of file class.ilInternalLink.php.

References $ilDB.

Referenced by SurveyQuestion\_resolveIntLinks(), assQuestion\_resolveIntLinks(), ilWikiPage\saveInternalLinks(), ilPageObject\saveInternalLinks(), SurveyQuestion\saveMaterial(), SurveyQuestion\syncWithOriginal(), and assQuestion\updateSuggestedSolutions().

{
global $ilias, $ilDB;
$ilDB->manipulate("DELETE FROM int_link WHERE ".
"source_type = ".$ilDB->quote($a_source_type, "text")." AND ".
"source_id = ".$ilDB->quote((int) $a_source_id, "integer")." AND ".
"target_type = ".$ilDB->quote($a_target_type, "text")." AND ".
"target_id = ".$ilDB->quote((int) $a_target_id, "integer")." AND ".
"target_inst = ".$ilDB->quote((int) $a_target_inst, "integer"));
$ilDB->manipulate("INSERT INTO int_link ".
"(source_type, source_id, target_type, target_id, target_inst) VALUES (".
$ilDB->quote($a_source_type, "text").",".
$ilDB->quote((int) $a_source_id, "integer").",".
$ilDB->quote($a_target_type, "text").",".
$ilDB->quote((int) $a_target_id, "integer").",".
$ilDB->quote((int) $a_target_inst, "integer").")");
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: