ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORMExplorer Class Reference
+ Inheritance diagram for ilSCORMExplorer:
+ Collaboration diagram for ilSCORMExplorer:

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 ($jsApi=false)
 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, $jsApi)
 Creates output recursive method private.
 getOutputIcons (&$tpl, $a_option, $a_node_id, $scormtype="sco")
- Public Member Functions inherited from ilExplorer
 ilExplorer ($a_target)
 Constructor public.
 initItemCounter ($a_number)
 Init item counter.
 setTitle ($a_val)
 Set title.
 setTitleLength ($a_length)
 Set max title length.
 getTitleLength ()
 Get max title length.
 getTitle ()
 Get title.
 setRoot ($a_root_id)
 Set root node.
 getRoot ()
 get root id
 setOrderColumn ($a_column)
 set the order column public
 setOrderDirection ($a_direction)
 set the order direction public
 setTargetGet ($a_target_get)
 set the varname in Get-string public
 setParamsGet ($a_params_get)
 set additional params to be passed in Get-string public
 setExpandTarget ($a_exp_target)
 target script for expand icons
 setFrameUpdater ($a_up_frame, $a_up_script, $a_params="")
 Set Explorer Updater.
 highlightNode ($a_id)
 set highlighted node
 checkPermissions ($a_check)
 check permissions via rbac
 setSessionExpandVariable ($a_var_name="expand")
 set name of expand session variable
 outputIcons ($a_icons)
 output icons
 setClickable ($a_type, $a_clickable)
 (de-)activates links for a certain object type
 setTreeLead ($a_val)
 Set tree leading content.
 getTreeLead ()
 Get tree leading content.
 isClickable ($a_type, $a_ref_id=0)
 check if links for certain object type are activated
 setPostSort ($a_sort)
 process post sorting
 setFilterMode ($a_mode=IL_FM_NEGATIVE)
 set filter mode
 getFilterMode ()
 get filter mode
 setUseStandardFrame ($a_val)
 Set use standard frame.
 getUseStandardFrame ()
 Get use standard explorer frame.
 setOutput ($a_parent_id, $a_depth=1, $a_obj_id=0, $a_highlighted_subtree=false)
 Creates output for explorer view in admin menue recursive method public.
 modifyChilds ($a_parent_id, $a_objects)
 showChilds ($a_parent_id)
 determines wether the childs of an object should be shown or not note: this standard implementation always returns true but it could be overwritten by derived classes (e.g.
 forceExpanded ($a_obj_id)
 force expansion of node
 getOutput ()
 Creates output recursive method public.
 handleListEndTags (&$a_tpl_tree, $a_cur_depth, $a_item_depth)
 handle list end tags ( and )
 handleListStartTags (&$a_tpl_tree, $a_cur_depth, $a_item_depth)
 handle list start tags (
 formatHeader (&$tpl, $a_obj_id, $a_option)
 Creates output for header (is empty here but can be overwritten in derived classes)
 formatObject (&$tpl, $a_node_id, $a_option, $a_obj_id=0)
 Creates output recursive method private.
 getImage ($a_name, $a_type="", $a_obj_id="")
 get image path (may be overwritten by derived classes)
 getImageAlt ($a_default_text, $a_type="", $a_obj_id="")
 get image alt text
 getNodeStyleClass ($a_id, $a_type)
 get style class for node
 buildLinkTarget ($a_node_id, $a_type)
 get link target (may be overwritten by derived classes)
 buildOnClick ($a_node_id, $a_type, $a_title)
 get onclick event handling (may be overwritten by derived classes)
 buildTitle ($a_title, $a_id, $a_type)
 standard implementation for title, may be overwritten by derived classes
 buildDescription ($a_desc, $a_id, $a_type)
 standard implementation for description, may be overwritten by derived classes
 buildSelect ($a_node_id, $a_type)
 standard implementation for adding an option select box between image and title
 buildFrameTarget ($a_type, $a_child=0, $a_obj_id=0)
 get frame target (may be overwritten by derived classes)
 createTarget ($a_type, $a_node_id, $a_highlighted_subtree=false)
 Creates Get Parameter private.
 setFrameTarget ($a_target)
 set target frame or not frame?
 createLines ($a_depth)
 Creates lines for explorer view private.
 is_in_array ($a_start, $a_depth)
 DESCRIPTION MISSING private.
 getIndex ($a_data)
 get index of format_options array from specific ref_id,parent_id private
 addFilter ($a_item)
 adds item to the filter public
 delFilter ($a_item)
 removes item from the filter public
 setExpand ($a_node_id)
 set the expand option this value is stored in a SESSION variable to save it different view private
 forceExpandAll ($a_mode, $a_show_minus=true)
 force expandAll.
 setFiltered ($a_bool)
 active/deactivate the filter public
 checkFilter ($a_item)
 check if item is in filter private
 sortNodes ($a_nodes, $a_parent_obj_id)
 sort nodes and put adm object to the end of sorted array private

Data Fields

 $slm_obj
- Data Fields inherited from ilExplorer
 $ilias
 $output
 $format_options
 $tree
 $target
 $target_get
 $params_get
 $expanded
 $order_column
 $order_direction = "asc"
 $expand_target
 $rbac_check
 $output_icons
 $expand_variable
 $is_clickable
 $post_sort
 $filtered = false
 $filter_mode
 $expand_all = false
 $root_id = null
 $use_standard_frame = false

Detailed Description

Definition at line 36 of file class.ilSCORMExplorer.php.

Member Function Documentation

ilSCORMExplorer::createTarget (   $a_type,
  $a_child 
)

Creates Get Parameter private.

Parameters
string
integer
Returns
string

Definition at line 107 of file class.ilSCORMExplorer.php.

Referenced by ilHACPExplorer\formatObject(), ilAICCExplorer\formatObject(), and 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;
}

+ Here is the caller graph for this function:

ilSCORMExplorer::formatHeader (   $a_obj_id,
  $a_option 
)

overwritten method from base class public

Parameters
integerobj_id
integerarray 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["c_type"]);
//$tpl->setVariable("ICON_IMAGE" ,ilUtil::getImagePath("icon_".$a_option["c_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;
}

+ Here is the caller graph for this function:

ilSCORMExplorer::formatObject (   $a_node_id,
  $a_option,
  $jsApi 
)

Creates output recursive method private.

Parameters
integer
array
Returns
string

Definition at line 315 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, "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.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["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)) // output link
{
$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 // 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["c_type"]);
$ilBench->stop("SCORMExplorer", "formatItemTable");
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
$this->output[] = $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORMExplorer::getIconImagePathPrefix ( )

Reimplemented in ilAICCExplorer.

Definition at line 67 of file class.ilSCORMExplorer.php.

Referenced by getOutputIcons().

{
return "scorm/";
}

+ Here is the caller graph for this function:

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;
}

+ Here is the caller graph for this function:

ilSCORMExplorer::getOutput (   $jsApi = false)

Creates output recursive method public.

Returns
string

Definition at line 250 of file class.ilSCORMExplorer.php.

References $ilBench, 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,$jsApi);
$ilBench->stop("SCORMExplorer", "formatObject");
}
}
return implode('',$this->output);
}

+ Here is the call graph for this function:

ilSCORMExplorer::getOutputIcons ( $tpl,
  $a_option,
  $a_node_id,
  $scormtype = "sco" 
)

Definition at line 430 of file class.ilSCORMExplorer.php.

References $lng, $tpl, ilSCORMItem\_lookupTrackingDataOfUser(), getIconImagePathPrefix(), and ilUtil\getImagePath().

Referenced by ilHACPExplorer\formatObject(), ilAICCExplorer\formatObject(), and 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;
}
$trdata = ilSCORMItem::_lookupTrackingDataOfUser($a_node_id, 0,
$this->slm_obj->getId());
// 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();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORMExplorer::ilSCORMExplorer (   $a_target,
$a_slm_obj 
)

Constructor public.

Parameters
stringscriptname
intuser_id

Definition at line 52 of file class.ilSCORMExplorer.php.

References ilExplorer\checkPermissions(), ilExplorer\ilExplorer(), ilExplorer\outputIcons(), ilTree\readRootId(), 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("");
}

+ Here is the call graph for this function:

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;
}

+ Here is the caller graph for this function:

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;
}
}

+ Here is the caller graph for this function:

ilSCORMExplorer::setOutput (   $a_parent_id,
  $a_depth = 0 
)

Definition at line 119 of file class.ilSCORMExplorer.php.

References $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["c_type"]) == false)
{
if ($this->isVisible($object["obj_id"], $object["c_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"]["c_type"] = $object["c_type"];
$this->format_options["$counter"]["obj_id"] = $object["obj_id"];
$this->format_options["$counter"]["desc"] = "obj_".$object["c_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["c_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

+ Here is the call graph for this function:

Field Documentation

ilSCORMExplorer::$slm_obj

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


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