Public Member Functions | |
ilSCORMExplorer ($a_target, &$a_slm_obj) | |
Constructor public. | |
getItem ($a_node_id) | |
getIconImagePathPrefix () | |
getNodesToSkip () | |
formatHeader ($a_obj_id, $a_option) | |
overwritten method from base class public | |
createTarget ($a_type, $a_child) | |
Creates Get Parameter private. | |
setOutput ($a_parent_id, $a_depth=0) | |
isVisible ($a_id, $a_type) | |
getOutput () | |
Creates output recursive method public. | |
isClickable ($a_type, $a_id=0, $a_obj=0) | |
formatItemTable (&$tpl, $a_id, $a_type) | |
formatObject ($a_node_id, $a_option) | |
Creates output recursive method private. | |
getOutputIcons (&$tpl, $a_option, $a_node_id, $scormtype="sco") | |
Data Fields | |
$slm_obj |
Definition at line 36 of file class.ilSCORMExplorer.php.
ilSCORMExplorer::createTarget | ( | $ | a_type, | |
$ | a_child | |||
) |
Creates Get Parameter private.
string | ||
integer |
Reimplemented from ilExplorer.
Definition at line 107 of file class.ilSCORMExplorer.php.
Referenced by formatObject(), ilHACPExplorer::formatObject(), and ilAICCExplorer::formatObject().
{ // SET expand parameter: // positive if object is expanded // negative if object is compressed $a_child = ($a_type == '+') ? $a_child : -(int) $a_child; return $_SERVER["PATH_INFO"]."?cmd=explorer&ref_id=".$this->slm_obj->getRefId()."&scexpand=".$a_child; }
ilSCORMExplorer::formatHeader | ( | $ | a_obj_id, | |
$ | a_option | |||
) |
overwritten method from base class public
integer | obj_id | |
integer | array options |
Definition at line 82 of file class.ilSCORMExplorer.php.
References ilExplorer::$ilias, $lng, and $tpl.
{ global $lng, $ilias; $tpl = new ilTemplate("tpl.tree.html", true, true); $tpl->setCurrentBlock("row"); //$tpl->setVariable("TYPE", $a_option["type"]); //$tpl->setVariable("ICON_IMAGE" ,ilUtil::getImagePath("icon_".$a_option["type"].".gif")); $tpl->setVariable("TITLE", $lng->txt("cont_manifest")); $tpl->setVariable("LINK_TARGET", $this->target."&".$this->target_get."=".$a_obj_id); $tpl->setVariable("TARGET", " target=\"".$this->frame_target."\""); $tpl->parseCurrentBlock(); $this->output[] = $tpl->get(); }
ilSCORMExplorer::formatItemTable | ( | &$ | tpl, | |
$ | a_id, | |||
$ | a_type | |||
) |
Reimplemented in ilAICCExplorer.
Definition at line 301 of file class.ilSCORMExplorer.php.
References $lng.
Referenced by formatObject().
{ global $lng; /* if ($a_type != "sit") { return; } else { $sc_object =& new ilSCORMItem($a_id); if ($sc_object->getIdentifierRef() != "") { $trdata = $sc_object->getTrackingDataOfUser(); // credits if ($trdata["mastery_score"] != "") { $tpl->setCurrentBlock("item_row"); $tpl->setVariable("TXT_KEY", $lng->txt("cont_credits")); $tpl->setVariable("TXT_VALUE", $trdata["mastery_score"]); $tpl->parseCurrentBlock(); } // total time if ($trdata["total_time"] != "") { $tpl->setCurrentBlock("item_row"); $tpl->setVariable("TXT_KEY", $lng->txt("cont_total_time")); $tpl->setVariable("TXT_VALUE", $trdata["total_time"]); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("item_table"); $tpl->parseCurrentBlock(); } }*/ }
ilSCORMExplorer::formatObject | ( | $ | a_node_id, | |
$ | a_option | |||
) |
Creates output recursive method private.
integer | ||
array |
Reimplemented in ilAICCExplorer, and ilHACPExplorer.
Definition at line 351 of file class.ilSCORMExplorer.php.
References $ilBench, $lng, ilExplorer::$target, $tpl, ilSCORMResource::_lookupIdByIdRef(), ilSCORMResource::_lookupScormType(), ilExplorer::buildFrameTarget(), createTarget(), formatItemTable(), ilUtil::getImagePath(), getOutputIcons(), isClickable(), and ilUtil::shortenText().
Referenced by getOutput().
{ 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, true); if ($a_option["type"]=="sos") return; if ($a_option["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.gif")); $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.gif")); $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.".gif")); $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["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["type"], $a_node_id, $sc_object)) // output link { $ilBench->start("SCORMExplorer", "renderLink_parseLinkBlock"); $tpl->setCurrentBlock("link"); $frame_target = $this->buildFrameTarget($a_option["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);"); $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 // output text only { $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["type"]); $ilBench->stop("SCORMExplorer", "formatItemTable"); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); $this->output[] = $tpl->get(); }
ilSCORMExplorer::getIconImagePathPrefix | ( | ) |
Reimplemented in ilAICCExplorer.
Definition at line 67 of file class.ilSCORMExplorer.php.
Referenced by getOutputIcons().
{ return "scorm/"; }
ilSCORMExplorer::getItem | ( | $ | a_node_id | ) |
Reimplemented in ilAICCExplorer.
Definition at line 63 of file class.ilSCORMExplorer.php.
{ return new ilSCORMItem($a_node_id); }
ilSCORMExplorer::getNodesToSkip | ( | ) |
Reimplemented in ilAICCExplorer.
Definition at line 71 of file class.ilSCORMExplorer.php.
Referenced by setOutput().
{
return 2;
}
ilSCORMExplorer::getOutput | ( | ) |
Creates output recursive method public.
Reimplemented from ilExplorer.
Definition at line 250 of file class.ilSCORMExplorer.php.
References $ilBench, $key, ilExplorer::createLines(), and formatObject().
{ global $ilBench; //echo "getOutput <br>"; $this->format_options[0]["tab"] = array(); $depth = $this->tree->getMaximumDepth(); for ($i=0;$i<$depth;++$i) { $this->createLines($i); } foreach ($this->format_options as $key => $options) { if ($options["visible"] and $key != 0) { $ilBench->start("SCORMExplorer", "formatObject"); $this->formatObject($options["child"],$options); $ilBench->stop("SCORMExplorer", "formatObject"); } } return implode('',$this->output); }
ilSCORMExplorer::getOutputIcons | ( | &$ | tpl, | |
$ | a_option, | |||
$ | a_node_id, | |||
$ | scormtype = "sco" | |||
) |
Definition at line 462 of file class.ilSCORMExplorer.php.
References $lng, $tpl, ilSCORMItem::_lookupTrackingDataOfUser(), getIconImagePathPrefix(), and ilUtil::getImagePath().
Referenced by formatObject(), ilHACPExplorer::formatObject(), and ilAICCExplorer::formatObject().
{ global $lng; $tpl->setCurrentBlock("icon"); if ($scormtype == 'asset') { $tpl->setVariable('ICON_IMAGE', ilUtil::getImagePath($this->getIconImagePathPrefix()."asset.gif")); $tpl->setVariable('TXT_ALT_IMG', ''); $tpl->parseCurrentBlock(); return; } //$sc_object = & $this->getItem($a_node_id); //$trdata = $sc_object->getTrackingDataOfUser(); $trdata = ilSCORMItem::_lookupTrackingDataOfUser($a_node_id); // status $status = ($trdata["cmi.core.lesson_status"] == "") ? "not attempted" : $trdata["cmi.core.lesson_status"]; $statusChar=strtolower(substr($status,0,1)); if ($statusChar=="f") $status="failed"; else if ($statusChar=="b") $status="browsed"; else if ($statusChar=="c") $status="completed"; else if ($statusChar=="n") $status="not_attempted"; else if ($statusChar=="p") $status="passed"; else if ($statusChar=="r") $status="running"; $alt = $lng->txt("cont_status").": ". $lng->txt("cont_sc_stat_".str_replace(" ", "_", $status)); // score if ($trdata["cmi.core.score.raw"] != "") { $alt.= ", ".$lng->txt("cont_credits"). ": ".$trdata["cmi.core.score.raw"]; } // total time if ($trdata["cmi.core.total_time"] != "" && $trdata["cmi.core.total_time"] != "0000:00:00.00") { $alt.= ", ".$lng->txt("cont_total_time"). ": ".$trdata["cmi.core.total_time"]; } $tpl->setVariable("ICON_NAME", 'scoIcon'.$a_node_id); $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath($this->getIconImagePathPrefix().str_replace(" ", "_", $status).".gif")); $tpl->setVariable("TXT_ALT_IMG", $alt); $tpl->parseCurrentBlock(); }
ilSCORMExplorer::ilSCORMExplorer | ( | $ | a_target, | |
&$ | a_slm_obj | |||
) |
Constructor public.
string | scriptname | |
int | user_id |
Definition at line 52 of file class.ilSCORMExplorer.php.
References ilExplorer::checkPermissions(), ilExplorer::ilExplorer(), ilExplorer::outputIcons(), and ilExplorer::setOrderColumn().
{ parent::ilExplorer($a_target); $this->slm_obj =& $a_slm_obj; $this->tree = new ilSCORMTree($a_slm_obj->getId()); $this->root_id = $this->tree->readRootId(); $this->checkPermissions(false); $this->outputIcons(true); $this->setOrderColumn(""); }
ilSCORMExplorer::isClickable | ( | $ | a_type, | |
$ | a_id = 0 , |
|||
$ | a_obj = 0 | |||
) |
Definition at line 277 of file class.ilSCORMExplorer.php.
Referenced by formatObject().
{ if ($a_type != "sit") { return false; } else { if (is_object($a_obj)) { $sc_object =& $a_obj; } else { $sc_object =& new ilSCORMItem($a_id); } if ($sc_object->getIdentifierRef() != "") { return true; } } return false; }
ilSCORMExplorer::isVisible | ( | $ | a_id, | |
$ | a_type | |||
) |
Reimplemented from ilExplorer.
Definition at line 232 of file class.ilSCORMExplorer.php.
Referenced by setOutput().
{ if ($a_type == "sre") { return false; } else { return true; } }
ilSCORMExplorer::setOutput | ( | $ | a_parent_id, | |
$ | a_depth = 0 | |||
) |
Definition at line 119 of file class.ilSCORMExplorer.php.
References $counter, $key, $rbacadmin, $rbacsystem, $tab, ilExplorer::checkFilter(), ilExplorer::getIndex(), getNodesToSkip(), isVisible(), ilExplorer::setExpand(), and ilExplorer::showChilds().
{ global $rbacadmin, $rbacsystem; static $counter = 0; //echo "setOutput <br>"; if (!isset($a_parent_id)) { $this->ilias->raiseError(get_class($this)."::setOutput(): No node_id given!",$this->ilias->error_obj->WARNING); } if ($this->showChilds($a_parent_id)) { $objects = $this->tree->getChilds($a_parent_id, $this->order_column); } else { $objects = array(); } if (count($objects) > 0) { //moved the scorm-only constant parameter to a function //to be able to reuse the code //$tab = ++$a_depth - 2; $tab = ++$a_depth - $this->getNodesToSkip(); // Maybe call a lexical sort function for the child objects //666if ($this->post_sort) //{ //$objects = $this->sortNodes($objects); //} foreach ($objects as $key => $object) { //ask for FILTER if ($this->filtered == false or $this->checkFilter($object["type"]) == false) { if ($this->isVisible($object["obj_id"], $object["type"])) { if ($object["child"] != $this->tree->getRootId()) { $parent_index = $this->getIndex($object); } $this->format_options["$counter"]["parent"] = $object["parent"]; $this->format_options["$counter"]["child"] = $object["child"]; $this->format_options["$counter"]["title"] = $object["title"]; $this->format_options["$counter"]["type"] = $object["type"]; $this->format_options["$counter"]["obj_id"] = $object["obj_id"]; $this->format_options["$counter"]["desc"] = "obj_".$object["type"]; $this->format_options["$counter"]["depth"] = $tab; $this->format_options["$counter"]["container"] = false; $this->format_options["$counter"]["visible"] = true; // Create prefix array for ($i = 0; $i < $tab; ++$i) { $this->format_options["$counter"]["tab"][] = 'blank'; } if ($object["type"]=="sos") $this->setExpand($object["obj_id"]); // fix explorer (sometimes explorer disappears) if ($parent_index == 0) { if (!$this->expand_all and !in_array($object["parent"],$this->expanded)) { $this->expanded[] = $object["parent"]; } //$this->format_options["$parent_index"]["visible"] = true; } if ($object["child"] != $this->tree->getRootId() and (!$this->expand_all and !in_array($object["parent"],$this->expanded) or !$this->format_options["$parent_index"]["visible"])) { $this->format_options["$counter"]["visible"] = false; } // if object exists parent is container if ($object["child"] != $this->tree->getRootId()) { $this->format_options["$parent_index"]["container"] = true; if ($this->expand_all or in_array($object["parent"],$this->expanded)) { $this->format_options["$parent_index"]["tab"][($tab-2)] = 'minus'; } else { $this->format_options["$parent_index"]["tab"][($tab-2)] = 'plus'; } } ++$counter; // stop recursion if 2. level beyond expanded nodes is reached if ($this->expand_all or in_array($object["parent"],$this->expanded) or ($object["parent"] == 0)) { // recursive $this->setOutput($object["child"],$a_depth); } } //if } //if FILTER } //foreach } //if } //function
ilSCORMExplorer::$slm_obj |
Definition at line 44 of file class.ilSCORMExplorer.php.