Public Member Functions | Data Fields

ilInternalLinkGUI Class Reference

Public Member Functions

 ilInternalLinkGUI ($a_default_type, $a_default_obj)
 determineLinkType ()
 setMode ($a_mode="text")
 setSetLinkTargetScript ($a_script)
 setReturn ($a_return)
 getSetLinkTargetScript ()
 filterLinkType ($a_link_type)
executeCommand ()
 resetSessionVars ()
 resetLinkList ()
 closeLinkHelp ()
 prepareJavascriptOutput ($str)
 showLinkHelp ()
 show link help list
 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

Detailed Description

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


Member Function Documentation

ilInternalLinkGUI::changeLinkType (  ) 

change link type

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

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

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

Here is the call graph for this function:

ilInternalLinkGUI::changeTargetObject ( a_type = ""  ) 

cange target object

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

References $_GET, $_SESSION, $exp, $expanded, $output, $tpl, ilUtil::appendUrlParameterString(), exit, ilUtil::getStyleSheetLocation(), 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, true);
                $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>";
                $exp = new ilExplorer(ilUtil::appendUrlParameterString(
                        $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();
                exit;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilInternalLinkGUI::closeLinkHelp (  ) 

Definition at line 175 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 (  ) 

Definition at line 108 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 146 of file class.ilInternalLinkGUI.php.

References $cmd.

        {
                $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 141 of file class.ilInternalLinkGUI.php.

        {
                $this->filter_link_types[] = $a_link_type;
        }

ilInternalLinkGUI::getSetLinkTargetScript (  ) 

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

Referenced by selectRepositoryItem(), and showLinkHelp().

        {
                return $this->set_link_script;
        }

Here is the caller graph for this function:

ilInternalLinkGUI::ilInternalLinkGUI ( a_default_type,
a_default_obj 
)

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

References $_SESSION, $ilCtrl, $ilias, $lng, $tree, ilObject::_lookupType(), determineLinkType(), and resetSessionVars().

        {
                global $lng, $ilias, $ilCtrl, $tree;
                
                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
                $this->determineLinkType();

                $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::isEnabledJavaScript (  ) 

determine, wether js is used

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

References $ilias, and ilPageEditorGUI::_doJSEditing().

Referenced by outputThumbnail(), and showLinkHelp().

        {
                global $ilias;
                
                include_once("content/classes/Pages/class.ilPageEditorGUI.php");
                if($ilias->getSetting("enable_js_edit"))
                {
                        if (ilPageEditorGUI::_doJSEditing())
                        {
                                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 737 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  ) 

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

References ilPageEditorGUI::_doJSEditing().

Referenced by showLinkHelp().

        {
                global $ilUser;
                
                include_once("content/classes/Pages/class.ilPageEditorGUI.php");
                if (ilPageEditorGUI::_doJSEditing())
                {
                        $str = htmlspecialchars($str);
                }
                return($str);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilInternalLinkGUI::resetLinkList (  ) 

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

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

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

Here is the call graph for this function:

ilInternalLinkGUI::resetSessionVars (  ) 

Definition at line 161 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::selectRepositoryItem (  ) 

select repository item explorer

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

References $_GET, $_SESSION, $exp, $expanded, $output, $tpl, ilUtil::appendUrlParameterString(), getSetLinkTargetScript(), and ilUtil::getStyleSheetLocation().

Referenced by showLinkHelp().

        {
                $_SESSION["il_link_mep_obj"] = "";

                if(empty($a_type))
                {
                        $a_type = $_GET["target_type"];
                }

                $tpl =& new ilTemplate("tpl.link_help_explorer.html", true, true, true);
                $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());

                include_once "content/classes/class.ilIntLinkRepItemExplorer.php";
                $exp = new ilIntLinkRepItemExplorer(ilUtil::appendUrlParameterString(
                        $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");

                $sel_types = array('lm','dbk','htlm','glo','frm','exc','tst','svy','webr','chat',
                        'cat','crs','grp','file','fold','sahs');
                $exp->setSelectableTypes($sel_types);

                /*
                $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");
                $tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_repository_item_links"));
                $tpl->setVariable("EXPLORER",$output);
                $tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
                $tpl->setVariable("BTN_REFRESH", "showLinkHelp");
                $tpl->setVariable("TXT_REFRESH", $this->lng->txt("refresh"));
                $tpl->setVariable("BTN_RESET", "resetLinkList");
                $tpl->setVariable("TXT_RESET", $this->lng->txt("reset"));

                /*
                $tpl->setVariable("BTN_STRUCTURE", "resetLinkList");
                $tpl->setVariable("TXT_STRUCTURE", $this->lng->txt("reset"));*/
                $tpl->parseCurrentBlock();

                return $tpl->get();
                //$tpl->show();
                //exit;
        }

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 796 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"  ) 

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

        {
                $this->mode = $a_mode;
        }

ilInternalLinkGUI::setReturn ( a_return  ) 

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

        {
                $this->return = $a_return;
        }

ilInternalLinkGUI::setSetLinkTargetScript ( a_script  ) 

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

        {
                $this->set_link_script = $a_script;
        }

ilInternalLinkGUI::showLinkHelp (  ) 

show link help list

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

References $_SESSION, $link_type, $tpl, ilObjMediaObjectGUI::_recoverParameters(), ilUtil::appendUrlParameterString(), changeTargetObject(), exit, ilUtil::formSelect(), ilUtil::getImagePath(), ilLMPageObject::getPageList(), getSetLinkTargetScript(), ilUtil::getStyleSheetLocation(), isEnabledJavaScript(), outputThumbnail(), prepareJavascriptOutput(), and selectRepositoryItem().

Referenced by changeLinkType(), changeTargetObject(), resetLinkList(), 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, true);
                $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"));
                $ltypes = array("StructureObject" => $this->lng->txt("cont_lk_chapter"),
                        "StructureObject_New" => $this->lng->txt("cont_lk_chapter_new"),
                        "PageObject" => $this->lng->txt("cont_lk_page"),
                        "PageObject_FAQ" => $this->lng->txt("cont_lk_page_faq"),
                        "PageObject_New" => $this->lng->txt("cont_lk_page_new"),
                        "GlossaryItem" => $this->lng->txt("cont_lk_term"),
                        "GlossaryItem_New" => $this->lng->txt("cont_lk_term_new"),
                        "Media" => $this->lng->txt("cont_lk_media_inline"),
                        "Media_Media" => $this->lng->txt("cont_lk_media_media"),
                        "Media_FAQ" => $this->lng->txt("cont_lk_media_faq"),
                        "Media_New" => $this->lng->txt("cont_lk_media_new"),
                        "RepositoryItem" => $this->lng->txt("cont_repository_item")
                        );

                // filter link types
                foreach($this->filter_link_types as $link_type)
                {
                        unset($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", $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";
                if ($this->isEnabledJavaScript())
                {
                        $chapterRowBlock .= "_js";
                }
                
                switch($this->link_type)
                {
                        // page link
                        case "PageObject":
                                require_once("./content/classes/class.ilObjContentObject.php");
                                $cont_obj =& new ilObjContentObject($_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("content/classes/Media/class.ilObjMediaObjectGUI.php");
                                                                ilObjMediaObjectGUI::_recoverParameters();
                                                                $tpl->setCurrentBlock("link_row");
                                                                $tpl->setVariable("ROWCLASS", "tblrow2");
                                                                $tpl->setVariable("TXT_CHAPTER", $node["title"]);
                                                                $tpl->setVariable("LINK_TARGET", "content");
                                                                $tpl->setVariable("LINK",
                                                                        ilUtil::appendUrlParameterString($this->getSetLinkTargetScript(),
                                                                        "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"]);
                                                                $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("content/classes/Media/class.ilObjMediaObjectGUI.php");
                                                                ilObjMediaObjectGUI::_recoverParameters();
                                                                $tpl->setCurrentBlock("link_row");
                                                                $tpl->setVariable("ROWCLASS", "tblrow2");
                                                                $tpl->setVariable("TXT_CHAPTER", $node["title"]);
                                                                $tpl->setVariable("LINK_TARGET", "content");
                                                                $tpl->setVariable("LINK",
                                                                        ilUtil::appendUrlParameterString($this->getSetLinkTargetScript(),
                                                                        "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"]);
                                                                $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":
                                require_once("./content/classes/class.ilObjContentObject.php");
                                $cont_obj =& new ilObjContentObject($_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("content/classes/Media/class.ilObjMediaObjectGUI.php");
                                                                ilObjMediaObjectGUI::_recoverParameters();
                                                                $tpl->setCurrentBlock("link_row");
                                                                $tpl->setVariable("ROWCLASS", $css_row);
                                                                $tpl->setVariable("TXT_CHAPTER", $node["title"]);
                                                                $tpl->setVariable("LINK_TARGET", "content");
                                                                $tpl->setVariable("LINK",
                                                                        ilUtil::appendUrlParameterString($this->getSetLinkTargetScript(),
                                                                        "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"]);
                                                                $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("./content/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("content/classes/Media/class.ilObjMediaObjectGUI.php");
                                                        ilObjMediaObjectGUI::_recoverParameters();
                                                        $tpl->setCurrentBlock("link_row");
                                                        $tpl->setVariable("ROWCLASS", "tblrow2");
                                                        $tpl->setVariable("TXT_CHAPTER", $term["term"]);
                                                        $tpl->setVariable("LINK_TARGET", "content");
                                                        $tpl->setVariable("LINK",
                                                                ilUtil::appendUrlParameterString($this->getSetLinkTargetScript(),
                                                                        "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"]);
                                                        $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":
                                //$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("content/classes/Media/class.ilObjMediaObjectGUI.php");
                                                                ilObjMediaObjectGUI::_recoverParameters();
                                                                $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",
                                                                        ilUtil::appendUrlParameterString($this->getSetLinkTargetScript(),
                                                                        "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"]);
                                                                $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("./content/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["id"]] = $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["id"]] = $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["obj_id"]);
                                                        $tpl->setVariable("LINK",
                                                                $this->ctrl->getLinkTarget($this, "setMedPoolFolder"));
                                                        $tpl->parseCurrentBlock();
                                                }
                                                else
                                                {
                                                        $css_row = ($css_row == "tblrow2")
                                                                ? "tblrow1"
                                                                : "tblrow2";
                                                        switch ($this->mode)
                                                        {
                                                                case "link":
                                                                        require_once("content/classes/Media/class.ilObjMediaObjectGUI.php");
                                                                        ilObjMediaObjectGUI::_recoverParameters();
                                                                        $tpl->setCurrentBlock("link_row");
                                                                        $this->outputThumbnail($tpl, $obj["obj_id"], "link");
                                                                        $tpl->setCurrentBlock("link_row");
                                                                        $tpl->setVariable("ROWCLASS", $css_row);
                                                                        $tpl->setVariable("TXT_CHAPTER", $obj["title"]);
                                                                        $tpl->setVariable("LINK_TARGET", "content");
                                                                        $tpl->setVariable("LINK",
                                                                                ilUtil::appendUrlParameterString($this->getSetLinkTargetScript(),
                                                                                "linktype=MediaObject".
                                                                                "&linktarget=il__mob_".$obj["obj_id"].
                                                                                "&linktargetframe=".$this->link_target));
                                                                        $tpl->parseCurrentBlock();
                                                                        break;

                                                                default:
                                                                        $tpl->setCurrentBlock($chapterRowBlock);
                                                                        $this->outputThumbnail($tpl, $obj["obj_id"]);
                                                                        $tpl->setCurrentBlock($chapterRowBlock);
                                                                        $tpl->setVariable("ROWCLASS", $css_row);
                                                                        $tpl->setVariable("TXT_CHAPTER", $obj["title"]);
                                                                        if ($target_str != "")
                                                                        {
                                                                                $tpl->setVariable("LINK_CHAPTER",
                                                                                        $this->prepareJavascriptOutput("[iln media=\"".$obj["obj_id"]."\"".$target_str."] [/iln]"));
                                                                        }
                                                                        else
                                                                        {
                                                                                $tpl->setVariable("LINK_CHAPTER",
                                                                                        $this->prepareJavascriptOutput("[iln media=\"".$obj["obj_id"]."\"/]"));
                                                                        }
                                                                        $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;

                }

                
                $tpl->show();
                exit;
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilInternalLinkGUI::$ctrl

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

ilInternalLinkGUI::$default_obj

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

ilInternalLinkGUI::$default_type

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

ilInternalLinkGUI::$link_target

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

ilInternalLinkGUI::$link_type

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

Referenced by showLinkHelp().

ilInternalLinkGUI::$lng

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

Referenced by ilInternalLinkGUI().

ilInternalLinkGUI::$mode

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

ilInternalLinkGUI::$set_link_script

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

ilInternalLinkGUI::$tree

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

Referenced by ilInternalLinkGUI().


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