/** * Creates output * recursive method * @access private * @param integer * @param array * @return string */ function formatObject($a_node_id, $a_option, $jsApi) { global $lng, $ilBench; //echo "scorm: ".$a_option["title"]." >> ".implode(", ",$a_option["tab"])."<br>"; if (!isset($a_node_id) or !is_array($a_option)) { $this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING); } $tpl = new ilTemplate("tpl.sahs_tree.html", true, true, "Modules/ScormAicc"); if ($a_option["c_type"] == "sos") { return; } if ($a_option["c_type"] == "srs") { return; } $ilBench->start("SCORMExplorer", "renderIcons"); if (is_array($a_option["tab"])) { //test if there are any tabs foreach ($a_option["tab"] as $picture) { if ($picture == 'plus') { $target = $this->createTarget('+', $a_node_id); $tpl->setCurrentBlock("expander"); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/plus.png")); $tpl->parseCurrentBlock(); } if ($picture == 'minus' && $this->show_minus) { $target = $this->createTarget('-', $a_node_id); $tpl->setCurrentBlock("expander"); $tpl->setVariable("LINK_TARGET_EXPANDER", $target); $tpl->setVariable("IMGPATH", ilUtil::getImagePath("browser/minus.png")); $tpl->parseCurrentBlock(); } if ($picture == 'blank' or $picture == 'winkel' or $picture == 'hoch' or $picture == 'quer' or $picture == 'ecke') { $picture = 'blank'; $tpl->setCurrentBlock("lines"); $tpl->setVariable("IMGPATH_LINES", ilUtil::getImagePath("browser/" . $picture . ".png")); $tpl->parseCurrentBlock(); } } } $ilBench->stop("SCORMExplorer", "renderIcons"); $ilBench->start("SCORMExplorer", "initSCORMItem"); $sc_object =& new ilSCORMItem($a_node_id); $id_ref = $sc_object->getIdentifierRef(); $ilBench->stop("SCORMExplorer", "initSCORMItem"); $ilBench->start("SCORMExplorer", "initResource"); //$sc_res =& new ilSCORMResource(); $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId()); $ilBench->stop("SCORMExplorer", "initResource"); $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id)); $ilBench->start("SCORMExplorer", "renderLink"); $ilBench->start("SCORMExplorer", "renderLink_OutputIcons"); if ($this->output_icons) { if ($this->isClickable($a_option["c_type"], $a_node_id, $sc_object)) { $this->getOutputIcons($tpl, $a_option, $a_node_id, $scormtype); } } $ilBench->stop("SCORMExplorer", "renderLink_OutputIcons"); if ($this->isClickable($a_option["c_type"], $a_node_id, $sc_object)) { $ilBench->start("SCORMExplorer", "renderLink_parseLinkBlock"); $tpl->setCurrentBlock("link"); $frame_target = $this->buildFrameTarget($a_option["c_type"], $a_node_id, $a_option["obj_id"]); if ($frame_target != "") { $tpl->setVariable("TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $tpl->setVariable("LINK_TARGET", "javascript:void(0);"); if ($jsApi == true) { $tpl->setVariable("ONCLICK", " onclick=\"parent.API.IliasLaunch('" . $a_node_id . "');return false;\""); } else { $tpl->setVariable("ONCLICK", " onclick=\"parent.APIFRAME.setupApi();parent.APIFRAME.API." . ($scormtype == 'asset' ? 'IliasLaunchAsset' : 'IliasLaunchSahs') . "('" . $a_node_id . "');return false;\""); } } $tpl->parseCurrentBlock(); $ilBench->stop("SCORMExplorer", "renderLink_parseLinkBlock"); } else { $tpl->setCurrentBlock("text"); $tpl->setVariable("OBJ_TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true)); $tpl->parseCurrentBlock(); } $ilBench->stop("SCORMExplorer", "renderLink"); $ilBench->start("SCORMExplorer", "formatItemTable"); $this->formatItemTable($tpl, $a_node_id, $a_option["c_type"]); $ilBench->stop("SCORMExplorer", "formatItemTable"); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); $this->output[] = $tpl->get(); }
function api() { global $ilias; $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]); $this->tpl = new ilTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc"); // for scorm modules with only one presentable item: launch item if ($_GET["autolaunch"] != "") { $this->tpl->setCurrentBlock("auto_launch"); include_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php"; include_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php"; $sc_object =& new ilSCORMItem($_GET["autolaunch"]); $id_ref = $sc_object->getIdentifierRef(); $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId()); $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id)); if ($scormtype == "asset") { $item_command = "IliasLaunchAsset"; } else { $item_command = "IliasLaunchSahs"; } $this->tpl->setVariable("AUTO_LAUNCH_ID", $_GET["autolaunch"]); $this->tpl->setVariable("AUTO_LAUNCH_CMD", "this.autoLaunch();"); $this->tpl->setVariable("AUTO_LAUNCH_ITEM_CMD", $item_command); $this->tpl->parseCurrentBlock(); } //unlimited sessions if ($slm_obj->getSession()) { $session_timeout = (int) $ilias->ini->readVariable("session", "expire") / 2; } else { $session_timeout = 0; } $this->tpl->setVariable("PING_SESSION", $session_timeout); $this->tpl->setVariable("USER_ID", $ilias->account->getId()); $this->tpl->setVariable("USER_FIRSTNAME", $ilias->account->getFirstname()); $this->tpl->setVariable("USER_LASTNAME", $ilias->account->getLastname()); $this->tpl->setVariable("USER_LOGIN", $ilias->account->getLogin()); $this->tpl->setVariable("USER_OU", $ilias->account->getDepartment()); $this->tpl->setVariable("REF_ID", $_GET["ref_id"]); $this->tpl->setVariable("SESSION_ID", session_id()); $this->tpl->setVariable("CODE_BASE", "http://" . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "/ilias.php"))); $this->tpl->parseCurrentBlock(); $this->tpl->show(false); exit; }