ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilInternalLinkGUI Class Reference

Class ilInternalLinkGUI. More...

+ Collaboration diagram for ilInternalLinkGUI:

Public Member Functions

 ilInternalLinkGUI ($a_default_type, $a_default_obj)
 initLinkTypes ()
 Initialize link types.
 determineLinkType ()
 Determine current link type.
 setMode ($a_mode="text")
 Set mode.
 setSetLinkTargetScript ($a_script)
 setReturn ($a_return)
 getSetLinkTargetScript ()
 filterLinkType ($a_link_type)
executeCommand ()
 resetSessionVars ()
 resetLinkList ()
 closeLinkHelp ()
 prepareJavascriptOutput ($str)
 Prepare output for JS enabled editing.
 showLinkHelp ()
 Show link help list.
 getFileLinkHTML ()
 Get HTML for file link.
 saveFileLink ()
 Save file link.
 outputThumbnail (&$tpl, $a_id, $a_mode="")
 output thumbnail
 changeLinkType ()
 change link type
 setMedPoolFolder ()
 select media pool folder
 changeTargetObject ($a_type="")
 cange target object
 selectRepositoryItem ()
 select repository item explorer
 isEnabledJavaScript ()
 determine, wether js is used

Data Fields

 $default_type
 $default_obj
 $link_type
 $link_target
 $lng
 $mode
 $set_link_script
 $ctrl
 $tree
 $ltypes = array()

Detailed Description

Class ilInternalLinkGUI.

Some gui 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.ilInternalLinkGUI.php 25624 2010-09-09 10:52:01Z akill

Definition at line 17 of file class.ilInternalLinkGUI.php.

Member Function Documentation

ilInternalLinkGUI::changeLinkType ( )

change link type

Definition at line 939 of file class.ilInternalLinkGUI.php.

References $_POST, $_SESSION, determineLinkType(), and showLinkHelp().

{
$_SESSION["il_link_type"] = $_POST["ltype"];
$this->showLinkHelp();
}

+ Here is the call graph for this function:

ilInternalLinkGUI::changeTargetObject (   $a_type = "")

cange target object

Definition at line 958 of file class.ilInternalLinkGUI.php.

References $_GET, $_SESSION, $tpl, ilUtil\appendUrlParameterString(), exit, ilUtil\getStyleSheetLocation(), IL_FM_POSITIVE, and showLinkHelp().

Referenced by showLinkHelp().

{
$_SESSION["il_link_mep_obj"] = "";
if($_GET["do"] == "set")
{
switch ($_GET["target_type"])
{
case "glo":
$_SESSION["il_link_glossary"] = $_GET["sel_id"];
break;
case "mep":
$_SESSION["il_link_mep"] = $_GET["sel_id"];
break;
default:
$_SESSION["il_link_cont_obj"] = $_GET["sel_id"];
break;
}
$this->showLinkHelp();
return;
}
if(empty($a_type))
{
$a_type = $_GET["target_type"];
}
$tpl =& new ilTemplate("tpl.link_help_explorer.html", true, true, "Modules/LearningModule");
$tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
require_once "classes/class.ilExplorer.php";
//$tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
//echo "<br><br>:".$this->ctrl->getLinkTarget($this).":<br>";
$this->ctrl->getTargetScript(), "do=set"));
if ($_GET["expand"] == "")
{
$expanded = $this->tree->readRootId();
}
else
{
$expanded = $_GET["expand"];
}
$exp->setExpand($expanded);
//echo "<br><br>exp:$expanded:<br>";
$exp->setTargetGet("sel_id");
$this->ctrl->setParameter($this, "target_type", $a_type);
$exp->setParamsGet($this->ctrl->getParameterArray($this, "changeTargetObject"));
//echo "<br>"; var_dump($this->ctrl->getParameterArray($this, "changeTargetObject"));
/*$exp->setParamsGet(array("ref_id" => $_GET["ref_id"],
"cmd" => "changeTargetObject", "mode" => "page_edit", "obj_id" => $_GET["obj_id"],
"target_type" => $a_type, "linkmode" => $_GET["linkmode"]));*/
$exp->addFilter("root");
$exp->addFilter("cat");
$exp->addFilter("grp");
$exp->addFilter("fold");
$exp->addFilter("crs");
switch ($a_type)
{
case "glo":
$exp->addFilter("glo");
break;
case "mep":
$exp->addFilter("mep");
break;
default:
$exp->addFilter("lm");
$exp->addFilter("dbk");
break;
}
$exp->setFiltered(true);
$exp->setFilterMode(IL_FM_POSITIVE);
$exp->setClickable("cat", false);
$exp->setClickable("grp", false);
$exp->setClickable("fold", false);
$exp->setClickable("crs", false);
$exp->setFrameTarget("");
$exp->setOutput(0);
$output = $exp->getOutput();
//echo "<br><br><br>out:".$output.":<br>";
// $tpl->setCurrentBlock("content");
if ($a_type == "glo")
{
$tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_choose_glossary"));
}
else if ($a_type == "mep")
{
$tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_choose_media_source"));
}
else
{
$tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_choose_cont_obj"));
}
$tpl->setVariable("EXPLORER",$output);
$tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
$tpl->setVariable("BTN_REFRESH", "changeTargetObject");
$tpl->setVariable("TXT_REFRESH", $this->lng->txt("refresh"));
$tpl->setVariable("BTN_RESET", "resetLinkList");
$tpl->setVariable("TXT_RESET", $this->lng->txt("reset"));
if ($a_type == "mep")
{
$tpl->setCurrentBlock("sel_clipboard");
$this->ctrl->setParameter($this, "do", "set");
//$this->ctrl->setParameter($this, "sel_id", 0);
//$this->ctrl->setParameter($this, "target_type", "mep");
//$this->ctrl->setParameter($this, "linkmode", "");
//$this->ctrl->setParameter($this, "obj_id", "");
$tpl->setVariable("LINK_CLIPBOARD", $this->ctrl->getLinkTarget($this, "changeTargetObject"));
$tpl->setVariable("TXT_PERS_CLIPBOARD", $this->lng->txt("clipboard"));
$tpl->parseCurrentBlock();
}
/*
$tpl->setVariable("BTN_STRUCTURE", "resetLinkList");
$tpl->setVariable("TXT_STRUCTURE", $this->lng->txt("reset"));*/
$tpl->parseCurrentBlock();
$tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLinkGUI::closeLinkHelp ( )

Definition at line 188 of file class.ilInternalLinkGUI.php.

References ilUtil\redirect().

{
if ($this->return == "")
{
$this->ctrl->returnToParent($this);
}
else
{
ilUtil::redirect($this->return);
}
}

+ Here is the call graph for this function:

ilInternalLinkGUI::determineLinkType ( )

Determine current link type.

Definition at line 118 of file class.ilInternalLinkGUI.php.

References $_SESSION.

Referenced by changeLinkType(), ilInternalLinkGUI(), and resetLinkList().

{
// determine link type and target
$ltype = ($_SESSION["il_link_type"] == "")
? $this->default_type
: $_SESSION["il_link_type"];
$ltype_arr = explode("_", $ltype);
$this->link_type = ($ltype_arr[0] == "")
? $this->default_type
: $ltype_arr[0];
$this->link_target = $ltype_arr[1];
}

+ Here is the caller graph for this function:

& ilInternalLinkGUI::executeCommand ( )

Definition at line 159 of file class.ilInternalLinkGUI.php.

References $cmd, and $ret.

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd("showLinkHelp");
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}
ilInternalLinkGUI::filterLinkType (   $a_link_type)

Definition at line 154 of file class.ilInternalLinkGUI.php.

{
$this->filter_link_types[] = $a_link_type;
}
ilInternalLinkGUI::getFileLinkHTML ( )

Get HTML for file link.

Returns
string file link html

Definition at line 820 of file class.ilInternalLinkGUI.php.

References $ilCtrl, $lng, $tpl, and prepareJavascriptOutput().

Referenced by showLinkHelp().

{
global $ilCtrl, $lng;
if (!is_object($this->uploaded_file))
{
$tpl = new ilTemplate("tpl.link_file.html", true, true, "Modules/LearningModule");
$tpl->setCurrentBlock("form");
$tpl->setVariable("FORM_ACTION",
$ilCtrl->getFormAction($this));
$tpl->setVariable("TXT_SELECT_FILE", $lng->txt("cont_select_file"));
$tpl->setVariable("TXT_SAVE_LINK", $lng->txt("cont_create_link"));
$tpl->setVariable("CMD_SAVE_LINK", "saveFileLink");
include_once("./Services/Form/classes/class.ilFileInputGUI.php");
$fi = new ilFileInputGUI("", "link_file");
$fi->setSize(15);
$tpl->setVariable("INPUT", $fi->getToolbarHTML());
$tpl->parseCurrentBlock();
return $tpl->get();
}
else
{
$tpl = new ilTemplate("tpl.link_file.html", true, true, "Modules/LearningModule");
$tpl->setCurrentBlock("link_js");
$tpl->setVariable("LINK_FILE",
$this->prepareJavascriptOutput("[iln dfile=\"".$this->uploaded_file->getId()."\"] [/iln]")
);
$tpl->setVariable("LINK_FILE_SCR",
"[iln dfile=\"".$this->uploaded_file->getId()."\"] [/iln]");
$tpl->setVariable("TXT_FILE",
$this->uploaded_file->getTitle());
$tpl->parseCurrentBlock();
return $tpl->get();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLinkGUI::getSetLinkTargetScript ( )

Definition at line 149 of file class.ilInternalLinkGUI.php.

References $set_link_script.

Referenced by selectRepositoryItem(), and showLinkHelp().

+ Here is the caller graph for this function:

ilInternalLinkGUI::ilInternalLinkGUI (   $a_default_type,
  $a_default_obj 
)

Definition at line 30 of file class.ilInternalLinkGUI.php.

References $_SESSION, $default_obj, $ilCtrl, $lng, $tree, ilObject\_lookupType(), determineLinkType(), initLinkTypes(), and resetSessionVars().

{
global $lng, $ilias, $ilCtrl, $tree;
$this->initLinkTypes();
if (($_SESSION["il_link_cont_obj"] != "" && !$tree->isInTree($_SESSION["il_link_cont_obj"])) ||
($_SESSION["il_link_glossary"] != "" && !$tree->isInTree($_SESSION["il_link_glossary"])) ||
($_SESSION["il_link_mep"] != "" && !$tree->isInTree($_SESSION["il_link_mep"])))
{
$this->resetSessionVars();
}
$this->lng =& $lng;
$this->tree =& $tree;
$this->ilias =& $ilias;
$this->ctrl =& $ilCtrl;
$this->ctrl->saveParameter($this, array("linkmode", "target_type"));
$this->default_type = $a_default_type;
$this->default_obj = $a_default_obj;
$this->filter_link_types = array();
$this->mode = "text";
// determine link type and target
$def_type = ilObject::_lookupType($this->default_obj, true);
// determine content object id
switch($this->link_type)
{
case "PageObject":
case "StructureObject":
if (empty($_SESSION["il_link_cont_obj"]) &&
($def_type != "mep" && $def_type != "glo"))
{
$_SESSION["il_link_cont_obj"] = $this->default_obj;
}
break;
case "GlossaryItem":
if (empty($_SESSION["il_link_glossary"]) && $def_type == "glo")
{
$_SESSION["il_link_glossary"] = $this->default_obj;
}
break;
case "Media":
if (empty($_SESSION["il_link_mep"]) && $def_type == "mep")
{
$_SESSION["il_link_mep"] = $this->default_obj;
}
break;
}
/*
$target_str = ($link_target == "")
? ""
: " target=\"".$link_target."\" ";*/
}

+ Here is the call graph for this function:

ilInternalLinkGUI::initLinkTypes ( )

Initialize link types.

Definition at line 94 of file class.ilInternalLinkGUI.php.

References $lng.

Referenced by ilInternalLinkGUI().

{
global $lng;
$this->ltypes = array(
"StructureObject" => $lng->txt("cont_lk_chapter"),
"StructureObject_New" => $lng->txt("cont_lk_chapter_new"),
"PageObject" => $lng->txt("cont_lk_page"),
"PageObject_FAQ" => $lng->txt("cont_lk_page_faq"),
"PageObject_New" => $lng->txt("cont_lk_page_new"),
"GlossaryItem" => $lng->txt("cont_lk_term"),
"GlossaryItem_New" => $lng->txt("cont_lk_term_new"),
"Media" => $lng->txt("cont_lk_media_inline"),
"Media_Media" => $lng->txt("cont_lk_media_media"),
"Media_FAQ" => $lng->txt("cont_lk_media_faq"),
"Media_New" => $lng->txt("cont_lk_media_new"),
"File" => $lng->txt("cont_lk_file"),
"RepositoryItem" => $lng->txt("cont_repository_item")
);
}

+ Here is the caller graph for this function:

ilInternalLinkGUI::isEnabledJavaScript ( )

determine, wether js is used

Definition at line 1166 of file class.ilInternalLinkGUI.php.

References ilPageEditorGUI\_doJSEditing().

Referenced by outputThumbnail(), and showLinkHelp().

{
global $ilias;
include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
if($ilias->getSetting("enable_js_edit"))
{
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLinkGUI::outputThumbnail ( $tpl,
  $a_id,
  $a_mode = "" 
)

output thumbnail

Definition at line 890 of file class.ilInternalLinkGUI.php.

References $tpl, and isEnabledJavaScript().

Referenced by showLinkHelp().

{
// output thumbnail
$mob =& new ilObjMediaObject($a_id);
$med =& $mob->getMediaItem("Standard");
$target = $med->getThumbnailTarget("small");
if ($a_mode == "link")
{
$tpl->setCurrentBlock("thumbnail_link");
}
else if ($this->isEnabledJavaScript())
{
$tpl->setCurrentBlock("thumbnail_js");
}
else
{
$tpl->setCurrentBlock("thumbnail");
}
if ($target != "")
{
$tpl->setCurrentBlock("thumb");
$tpl->setVariable("SRC_THUMB", $target);
$tpl->parseCurrentBlock();
}
else
{
$tpl->setVariable("NO_THUMB", "&nbsp;");
}
if ($a_mode == "link")
{
$tpl->setCurrentBlock("thumbnail_link");
}
else if ($this->isEnabledJavaScript())
{
$tpl->setCurrentBlock("thumbnail_js");
}
else
{
$tpl->setCurrentBlock("thumbnail");
}
$tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLinkGUI::prepareJavascriptOutput (   $str)

Prepare output for JS enabled editing.

Definition at line 203 of file class.ilInternalLinkGUI.php.

References ilPageEditorGUI\_doJSEditing().

Referenced by getFileLinkHTML(), and showLinkHelp().

{
global $ilUser;
include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
{
$str = htmlspecialchars($str, ENT_QUOTES);
}
return($str);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLinkGUI::resetLinkList ( )

Definition at line 181 of file class.ilInternalLinkGUI.php.

References determineLinkType(), resetSessionVars(), and showLinkHelp().

{
$this->resetSessionVars();
$this->showLinkHelp();
}

+ Here is the call graph for this function:

ilInternalLinkGUI::resetSessionVars ( )

Definition at line 174 of file class.ilInternalLinkGUI.php.

References $_SESSION.

Referenced by ilInternalLinkGUI(), and resetLinkList().

{
$_SESSION["il_link_mep"] = "";
$_SESSION["il_link_mep_obj"] = "";
$_SESSION["il_link_type"] = "";
}

+ Here is the caller graph for this function:

ilInternalLinkGUI::saveFileLink ( )

Save file link.

Definition at line 859 of file class.ilInternalLinkGUI.php.

References ilUtil\getStyleSheetLocation(), and showLinkHelp().

{
$mtpl =& new ilTemplate("tpl.link_help.html", true, true, "Modules/LearningModule");
$mtpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
if ($_FILES["link_file"]["name"] != "")
{
include_once("./Modules/File/classes/class.ilObjFile.php");
$fileObj = new ilObjFile();
$fileObj->setType("file");
$fileObj->setTitle($_FILES["link_file"]["name"]);
$fileObj->setDescription("");
$fileObj->setFileName($_FILES["link_file"]["name"]);
$fileObj->setFileType($_FILES["link_file"]["type"]);
$fileObj->setFileSize($_FILES["link_file"]["size"]);
$fileObj->setMode("filelist");
$fileObj->create();
// upload file to filesystem
$fileObj->createDirectory();
$fileObj->raiseUploadError(false);
$fileObj->getUploadFile($_FILES["link_file"]["tmp_name"],
$_FILES["link_file"]["name"]);
$this->uploaded_file = $fileObj;
}
$this->showLinkHelp();
}

+ Here is the call graph for this function:

ilInternalLinkGUI::selectRepositoryItem ( )

select repository item explorer

Definition at line 1096 of file class.ilInternalLinkGUI.php.

References $_GET, $_SESSION, ilUtil\appendUrlParameterString(), getSetLinkTargetScript(), and IL_FM_POSITIVE.

Referenced by showLinkHelp().

{
$_SESSION["il_link_mep_obj"] = "";
if(empty($a_type))
{
$a_type = $_GET["target_type"];
}
include_once "./Modules/LearningModule/classes/class.ilIntLinkRepItemExplorer.php";
$this->ctrl->getTargetScript(), "do=set"));
if ($_GET["expand"] == "")
{
$expanded = $this->tree->readRootId();
}
else
{
$expanded = $_GET["expand"];
}
$exp->setMode($this->mode);
$exp->setSetLinkTargetScript($this->getSetLinkTargetScript());
$exp->setExpand($expanded);
$exp->setTargetGet("sel_id");
$this->ctrl->setParameter($this, "target_type", $a_type);
$exp->setParamsGet($this->ctrl->getParameterArray($this, "showLinkHelp"));
// filter
$exp->setFiltered(true);
$exp->setFilterMode(IL_FM_POSITIVE);
$exp->addFilter("root");
$exp->addFilter("cat");
$exp->addFilter("grp");
$exp->addFilter("fold");
$exp->addFilter("crs");
$exp->addFilter("lm");
$exp->addFilter("htlm");
$exp->addFilter("dbk");
$exp->addFilter("glo");
$exp->addFilter("frm");
$exp->addFilter("exc");
$exp->addFilter("tst");
$exp->addFilter("svy");
$exp->addFilter("webr");
$exp->addFilter("file");
$exp->addFilter("chat");
$exp->addFilter("sahs");
$exp->addFilter("mcst");
$exp->addFilter("wiki");
$exp->addFilter("mep");
$sel_types = array('lm','dbk','htlm','glo','frm','exc','tst','svy','webr','chat',
'cat','crs','grp','file','fold','sahs','mcst','wiki','mep');
$exp->setSelectableTypes($sel_types);
$exp->setFrameTarget("");
$exp->setOutput(0);
$output = $exp->getOutput();
return $output;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilInternalLinkGUI::setMedPoolFolder ( )

select media pool folder

Definition at line 949 of file class.ilInternalLinkGUI.php.

References $_GET, $_SESSION, and showLinkHelp().

{
$_SESSION["il_link_mep_obj"] = $_GET["mep_fold"];
$this->showLinkHelp();
}

+ Here is the call graph for this function:

ilInternalLinkGUI::setMode (   $a_mode = "text")

Set mode.

Definition at line 134 of file class.ilInternalLinkGUI.php.

{
$this->mode = $a_mode;
}
ilInternalLinkGUI::setReturn (   $a_return)

Definition at line 144 of file class.ilInternalLinkGUI.php.

{
$this->return = $a_return;
}
ilInternalLinkGUI::setSetLinkTargetScript (   $a_script)

Definition at line 139 of file class.ilInternalLinkGUI.php.

{
$this->set_link_script = $a_script;
}
ilInternalLinkGUI::showLinkHelp ( )

Show link help list.

Definition at line 219 of file class.ilInternalLinkGUI.php.

References $_SESSION, $link_type, $tpl, ilObject\_lookupObjId(), ilObject\_lookupType(), ilPageObject\_readAnchors(), ilImageMapEditorGUI\_recoverParameters(), ilUtil\appendUrlParameterString(), changeTargetObject(), exit, ilUtil\formSelect(), getFileLinkHTML(), ilUtil\getImagePath(), ilLMPageObject\getPageList(), getSetLinkTargetScript(), ilUtil\getStyleSheetLocation(), isEnabledJavaScript(), ilMediaPoolItem\lookupForeignId(), outputThumbnail(), prepareJavascriptOutput(), and selectRepositoryItem().

Referenced by changeLinkType(), changeTargetObject(), resetLinkList(), saveFileLink(), and setMedPoolFolder().

{
global $ilUser;
$target_str = ($this->link_target == "")
? ""
: " target=\"".$this->link_target."\"";
if(($this->link_type == "GlossaryItem") &&
empty($_SESSION["il_link_glossary"]))
{
$this->changeTargetObject("glo");
}
if(($this->link_type == "PageObject" || $this->link_type == "StructureObject") &&
empty($_SESSION["il_link_cont_obj"]))
{
$this->changeTargetObject("cont_obj");
}
$tpl =& new ilTemplate("tpl.link_help.html", true, true, "Modules/LearningModule");
$tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
switch($this->link_type)
{
case "GlossaryItem":
$this->ctrl->setParameter($this, "target_type", "glo");
break;
case "PageObject":
case "StructureObject":
$this->ctrl->setParameter($this, "target_type", "cont_obj");
break;
case "Media":
$this->ctrl->setParameter($this, "target_type", "mep");
break;
default:
break;
}
//echo "<br><br>:".$this->ctrl->getFormAction($this).":";
//echo "<br>link_type:".$this->link_type;
//echo "<br>cont_obj:".$_SESSION["il_link_cont_obj"];
//echo "<br>link_mep".$_SESSION["il_link_mep"];
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->setVariable("FORMACTION2", $this->ctrl->getFormAction($this));
$tpl->setVariable("TXT_HELP_HEADER", $this->lng->txt("cont_link_select"));
$tpl->setVariable("TXT_TYPE", $this->lng->txt("cont_link_type"));
// filter link types
foreach($this->filter_link_types as $link_type)
{
unset($this->ltypes[$link_type]);
}
$ltype = ($this->link_target != "")
? $this->link_type."_".$this->link_target
: $this->link_type;
//echo "<br><br>".$ltype;
$select_ltype = ilUtil::formSelect ($ltype,
"ltype", $this->ltypes, false, true);
$tpl->setVariable("SELECT_TYPE", $select_ltype);
$tpl->setVariable("CMD_CHANGETYPE", "changeLinkType");
$tpl->setVariable("BTN_CHANGETYPE", $this->lng->txt("cont_change_type"));
/* if ($this->isEnabledJavaScript())
{
$tpl->setVariable("BTN_CLOSE_JS", $this->lng->txt("close"));
}
else
{*/
$tpl->setVariable("CMD_CLOSE", "closeLinkHelp");
$tpl->setVariable("BTN_CLOSE", $this->lng->txt("close"));
// }
$chapterRowBlock = "chapter_row";
$anchor_row_block = "anchor_link";
if ($this->isEnabledJavaScript())
{
$chapterRowBlock .= "_js";
$anchor_row_block .= "_js";
}
$obj_id = ilObject::_lookupObjId($_SESSION["il_link_cont_obj"]);
$type = ilObject::_lookupType($obj_id);
// switch link type
switch($this->link_type)
{
// page link
case "PageObject":
if ($type == "lm")
{
require_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
$cont_obj =& new ilObjLearningModule($_SESSION["il_link_cont_obj"], true);
}
else if ($type == "dbk")
{
require_once("./Modules/LearningModule/classes/class.ilObjDlBook.php");
$cont_obj =& new ilObjDlBook($_SESSION["il_link_cont_obj"], true);
}
// get all chapters
$ctree =& $cont_obj->getLMTree();
$nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
$tpl->setCurrentBlock("chapter_list");
$tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj"));
$tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle());
$tpl->setCurrentBlock("change_cont_obj");
$tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
$tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
$tpl->parseCurrentBlock();
foreach($nodes as $node)
{
if($node["type"] == "st")
{
$tpl->setCurrentBlock("chapter_row");
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
$tpl->setVariable("ROWCLASS", "tblrow1");
//$tpl->setVariable("LINK_CHAPTER",
// "[iln chap=\"".$node["obj_id"]."\"".$target_str."] [/iln]");
$tpl->parseCurrentBlock();
}
if($node["type"] == "pg")
{
switch ($this->mode)
{
case "link":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", "tblrow2");
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
$tpl->setVariable("LINK_TARGET", "content");
$tpl->setVariable("LINK",
"linktype=PageObject".
"&linktarget=il__pg_".$node["obj_id"].
"&linktargetframe=".$this->link_target));
$tpl->parseCurrentBlock();
break;
default:
$anchors = ilPageObject::_readAnchors($type, $node["obj_id"]);
if (count($anchors) > 0)
{
foreach ($anchors as $anchor)
{
$tpl->setCurrentBlock($anchor_row_block);
$tpl->setVariable("TXT_LINK", "#".$anchor);
$tpl->setVariable("HREF_LINK",
$this->prepareJavascriptOutput("[iln page=\"".$node["obj_id"]."\"".$target_str." anchor=\"$anchor\"] [/iln]"));
$tpl->parseCurrentBlock();
}
}
$tpl->setCurrentBlock($chapterRowBlock);
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
if ($this->isEnabledJavaScript())
{
$tpl->setVariable("TXT_CHAPTER_JS", htmlspecialchars(str_replace("'", "\'", $node["title"])));
}
$tpl->setVariable("ROWCLASS", "tblrow2");
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln page=\"".$node["obj_id"]."\"".$target_str."] [/iln]"));
$tpl->parseCurrentBlock();
break;
}
}
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
}
// get all free pages
$pages = ilLMPageObject::getPageList($cont_obj->getId());
$free_pages = array();
foreach ($pages as $page)
{
if (!$ctree->isInTree($page["obj_id"]))
{
$free_pages[] = $page;
}
}
if(count($free_pages) > 0)
{
$tpl->setCurrentBlock(str_replace("_js","",$chapterRowBlock));
$tpl->setVariable("TXT_CHAPTER", $this->lng->txt("cont_free_pages"));
$tpl->setVariable("ROWCLASS", "tblrow1");
$tpl->parseCurrentBlock();
foreach ($free_pages as $node)
{
switch ($this->mode)
{
case "link":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", "tblrow2");
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
$tpl->setVariable("LINK_TARGET", "content");
$tpl->setVariable("LINK",
"linktype=PageObject".
"&linktarget=il__pg_".$node["obj_id"].
"&linktargetframe=".$this->link_target));
$tpl->parseCurrentBlock();
break;
default:
$tpl->setCurrentBlock($chapterRowBlock);
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
if ($this->isEnabledJavaScript())
{
$tpl->setVariable("TXT_CHAPTER_JS", htmlspecialchars(str_replace("'", "\'", $node["title"])));
}
$tpl->setVariable("ROWCLASS", "tblrow2");
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln page=\"".$node["obj_id"]."\"".$target_str."] [/iln]"));
$tpl->parseCurrentBlock();
break;
}
}
}
$tpl->setCurrentBlock("chapter_list");
$tpl->parseCurrentBlock();
break;
// chapter link
case "StructureObject":
// check whether current object matchs to type
if (!in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true),
array("lm", "dbk")))
{
$this->changeTargetObject("lm");
}
if ($type == "lm")
{
require_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
$cont_obj =& new ilObjLearningModule($_SESSION["il_link_cont_obj"], true);
}
else if ($type == "dbk")
{
require_once("./Modules/LearningModule/classes/class.ilObjDlBook.php");
$cont_obj =& new ilObjDlBook($_SESSION["il_link_cont_obj"], true);
}
// get all chapters
$ctree =& $cont_obj->getLMTree();
$nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
$tpl->setCurrentBlock("chapter_list");
$tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj"));
$tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle());
$tpl->setCurrentBlock("change_cont_obj");
$tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
$tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
$tpl->parseCurrentBlock();
foreach($nodes as $node)
{
if($node["type"] == "st")
{
$css_row = ($css_row == "tblrow1")
? "tblrow2"
: "tblrow1";
switch ($this->mode)
{
case "link":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
$tpl->setVariable("LINK_TARGET", "content");
$tpl->setVariable("LINK",
"linktype=StructureObject".
"&linktarget=il__st_".$node["obj_id"].
"&linktargetframe=".$this->link_target));
$tpl->parseCurrentBlock();
break;
default:
$tpl->setCurrentBlock($chapterRowBlock);
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", $node["title"]);
if ($this->isEnabledJavaScript())
{
$tpl->setVariable("TXT_CHAPTER_JS", htmlspecialchars(str_replace("'", "\'", $node["title"])));
}
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln chap=\"".$node["obj_id"]."\"".$target_str."] [/iln]"));
$tpl->parseCurrentBlock();
break;
}
}
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("chapter_list");
$tpl->parseCurrentBlock();
break;
// glossary item link
case "GlossaryItem":
require_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
$glossary =& new ilObjGlossary($_SESSION["il_link_glossary"], true);
// get all glossary items
$terms = $glossary->getTermList();
$tpl->setCurrentBlock("chapter_list");
$tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("glossary"));
$tpl->setVariable("TXT_CONT_TITLE", $glossary->getTitle());
$tpl->setCurrentBlock("change_cont_obj");
$tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
$tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
$tpl->parseCurrentBlock();
foreach($terms as $term)
{
$css_row = ($css_row =="tblrow1")
? "tblrow2"
: "tblrow1";
switch ($this->mode)
{
case "link":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", "tblrow2");
$tpl->setVariable("TXT_CHAPTER", $term["term"]);
$tpl->setVariable("LINK_TARGET", "content");
$tpl->setVariable("LINK",
"linktype=GlossaryItem".
"&linktarget=il__git_".$term["id"].
"&linktargetframe=".$this->link_target));
$tpl->parseCurrentBlock();
break;
default:
$tpl->setCurrentBlock($chapterRowBlock);
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", $term["term"]);
if ($this->isEnabledJavaScript())
{
$tpl->setVariable("TXT_CHAPTER_JS", htmlspecialchars(str_replace("'", "\'", $term["term"])));
}
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln term=\"".$term["id"]."\"".$target_str."]"." "."[/iln]"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
break;
}
}
$tpl->setCurrentBlock("chapter_list");
$tpl->parseCurrentBlock();
break;
// media object
case "Media":
include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
//$tpl->setVariable("TARGET2", " target=\"content\" ");
// content object id = 0 --> get clipboard objects
if ($_SESSION["il_link_mep"] == 0)
{
$tpl->setCurrentBlock("change_cont_obj");
$tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
$tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
$tpl->parseCurrentBlock();
$mobjs = $this->ilias->account->getClipboardObjects("mob");
// sort by name
$objs = array();
foreach ($mobjs as $obj)
{
$objs[$obj["title"].":".$obj["id"]] = $obj;
}
ksort($objs);
$tpl->setCurrentBlock("chapter_list");
$tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_media_source"));
$tpl->setVariable("TXT_CONT_TITLE", $this->lng->txt("cont_personal_clipboard"));
$tpl->setVariable("COLSPAN", "2");
foreach($objs as $obj)
{
switch ($this->mode)
{
case "link":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
$tpl->setCurrentBlock("link_row");
$this->outputThumbnail($tpl, $obj["id"], "link");
$tpl->setCurrentBlock("link_row");
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", "tblrow2");
$tpl->setVariable("TXT_CHAPTER", $obj["title"]);
$tpl->setVariable("LINK_TARGET", "content");
$tpl->setVariable("LINK",
"linktype=MediaObject".
"&linktarget=il__mob_".$obj["id"].
"&linktargetframe=".$this->link_target));
$tpl->parseCurrentBlock();
break;
default:
$tpl->setCurrentBlock($chapterRowBlock);
$this->outputThumbnail($tpl, $obj["id"]);
$tpl->setCurrentBlock($chapterRowBlock);
$tpl->setVariable("TXT_CHAPTER", $obj["title"]);
if ($this->isEnabledJavaScript())
{
$tpl->setVariable("TXT_CHAPTER_JS", htmlspecialchars(str_replace("'", "\'", $obj["title"])));
}
$tpl->setVariable("ROWCLASS", "tblrow1");
if (!empty($target_str))
{
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln media=\"".$obj["id"]."\"".$target_str."] [/iln]"));
}
else
{
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln media=\"".$obj["id"]."\"/]"));
}
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
break;
}
}
$tpl->setCurrentBlock("chapter_list");
$tpl->parseCurrentBlock();
}
else
{
require_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
$med_pool =& new ilObjMediaPool($_SESSION["il_link_mep"], true);
// get current folders
$fobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "fold");
$f2objs = array();
foreach ($fobjs as $obj)
{
$f2objs[$obj["title"].":".$obj["child"]] = $obj;
}
ksort($f2objs);
// get current media objects
$mobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "mob");
$m2objs = array();
foreach ($mobjs as $obj)
{
$m2objs[$obj["title"].":".$obj["child"]] = $obj;
}
ksort($m2objs);
// merge everything together
$objs = array_merge($f2objs, $m2objs);
$tpl->setCurrentBlock("chapter_list");
$tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("mep"));
$tpl->setVariable("TXT_CONT_TITLE", $med_pool->getTitle());
$tpl->setCurrentBlock("change_cont_obj");
$tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject");
$tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change"));
$tpl->setVariable("COLSPAN", "2");
$tpl->parseCurrentBlock();
if ($parent_id = $med_pool->getParentId($_SESSION["il_link_mep_obj"]))
{
$css_row = "tblrow1";
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.gif"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", "..");
$this->ctrl->setParameter($this, "mep_fold", $parent_id);
$tpl->setVariable("LINK",
$this->ctrl->getLinkTarget($this, "setMedPoolFolder"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
}
foreach($objs as $obj)
{
if($obj["type"] == "fold")
{
$css_row = ($css_row == "tblrow2")
? "tblrow1"
: "tblrow2";
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.gif"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", $obj["title"]);
$this->ctrl->setParameter($this, "mep_fold", $obj["child"]);
$tpl->setVariable("LINK",
$this->ctrl->getLinkTarget($this, "setMedPoolFolder"));
$tpl->parseCurrentBlock();
}
else
{
$fid = ilMediaPoolItem::lookupForeignId($obj["child"]);
if (ilObject::_lookupType($fid) == "mob")
{
$css_row = ($css_row == "tblrow2")
? "tblrow1"
: "tblrow2";
switch ($this->mode)
{
case "link":
require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
require_once("./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
$tpl->setCurrentBlock("link_row");
$this->outputThumbnail($tpl, $fid, "link");
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", $obj["title"]);
$tpl->setVariable("LINK_TARGET", "content");
$tpl->setVariable("LINK",
"linktype=MediaObject".
"&linktarget=il__mob_".$fid.
"&linktargetframe=".$this->link_target));
$tpl->parseCurrentBlock();
break;
default:
$tpl->setCurrentBlock($chapterRowBlock);
$this->outputThumbnail($tpl, $fid);
$tpl->setCurrentBlock($chapterRowBlock);
$tpl->setVariable("ROWCLASS", $css_row);
$tpl->setVariable("TXT_CHAPTER", $obj["title"]);
if ($this->isEnabledJavaScript())
{
$tpl->setVariable("TXT_CHAPTER_JS", htmlspecialchars(str_replace("'", "\'", $obj["title"])));
}
if ($target_str != "")
{
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln media=\"".$fid."\"".$target_str."] [/iln]"));
}
else
{
$tpl->setVariable("LINK_CHAPTER",
$this->prepareJavascriptOutput("[iln media=\"".$fid."\"/]"));
}
$tpl->parseCurrentBlock();
break;
}
}
}
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("chapter_list");
$tpl->parseCurrentBlock();
}
break;
// repository item
case "RepositoryItem":
$tpl->setVariable("LINK_HELP_CONTENT", $this->selectRepositoryItem());
break;
// file download link
case "File":
$tpl->setVariable("LINK_HELP_CONTENT", $this->getFileLinkHTML());
break;
}
$tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilInternalLinkGUI::$ctrl

Definition at line 26 of file class.ilInternalLinkGUI.php.

ilInternalLinkGUI::$default_obj

Definition at line 20 of file class.ilInternalLinkGUI.php.

Referenced by ilInternalLinkGUI().

ilInternalLinkGUI::$default_type

Definition at line 19 of file class.ilInternalLinkGUI.php.

ilInternalLinkGUI::$link_target

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

ilInternalLinkGUI::$link_type

Definition at line 21 of file class.ilInternalLinkGUI.php.

Referenced by showLinkHelp().

ilInternalLinkGUI::$lng

Definition at line 23 of file class.ilInternalLinkGUI.php.

Referenced by getFileLinkHTML(), ilInternalLinkGUI(), and initLinkTypes().

ilInternalLinkGUI::$ltypes = array()

Definition at line 28 of file class.ilInternalLinkGUI.php.

ilInternalLinkGUI::$mode

Definition at line 24 of file class.ilInternalLinkGUI.php.

ilInternalLinkGUI::$set_link_script

Definition at line 25 of file class.ilInternalLinkGUI.php.

Referenced by getSetLinkTargetScript().

ilInternalLinkGUI::$tree

Definition at line 27 of file class.ilInternalLinkGUI.php.

Referenced by ilInternalLinkGUI().


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