ILIAS  release_8 Revision v8.24
ilSCORMExplorer Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSCORMExplorer:
+ Collaboration diagram for ilSCORMExplorer:

Public Member Functions

 __construct (string $a_target, ilObjSCORMLearningModule &$a_slm_obj)
 
 getItem (int $a_node_id)
 
 getIconImagePathPrefix ()
 
 getNodesToSkip ()
 
 formatHeader (ilTemplate $tpl, $a_obj_id, array $a_option)
 overwritten method from base class More...
 
 createTarget (string $a_type, $a_node_id, bool $a_highlighted_subtree=false, bool $a_append_anch=true)
 Creates Get Parameter. More...
 
 setOutput ($a_parent_id, int $a_depth=1, int $a_obj_id=0, $a_highlighted_subtree=false)
 
 isVisible ($a_ref_id, string $a_type)
 
 getOutput (bool $jsApi=false)
 Creates output template. More...
 
 createOutput (array $option, bool $jsApi)
 recursive creation of output templates More...
 
 isClickable (string $type, int $ref_id=0)
 can i click on the module name More...
 
 getOutputIcons (\ilTemplate $tpl, array $a_option, int $a_node_id, string $scormtype="sco")
 tpl is filled with option state More...
 
- Public Member Functions inherited from ilExplorer
 setId (string $a_val)
 
 getId ()
 
 setAsynchExpanding (bool $a_val)
 
 getAsynchExpanding ()
 
 initItemCounter (int $a_number)
 
 setTitle (string $a_val)
 
 setTitleLength (int $a_length)
 
 getTitleLength ()
 
 getTitle ()
 
 setRoot ($a_root_id)
 
 getRoot ()
 
 setOrderColumn (string $a_column)
 
 setOrderDirection (string $a_direction)
 
 setTargetGet (string $a_target_get)
 
 setParamsGet (array $a_params_get)
 
 setExpandTarget (string $a_exp_target)
 target script for expand icons More...
 
 setFrameUpdater (string $a_up_frame, string $a_up_script, string $a_params="")
 
 highlightNode (string $a_id)
 
 checkPermissions (bool $a_check)
 
 setSessionExpandVariable (string $a_var_name="expand")
 
 outputIcons (bool $a_icons)
 
 setClickable (string $a_type, bool $a_clickable)
 
 isVisible ( $a_ref_id, string $a_type)
 
 setTreeLead (string $a_val)
 
 getTreeLead ()
 
 isClickable (string $type, int $ref_id=0)
 
 setPostSort (bool $a_sort)
 
 setFilterMode (int $a_mode=IL_FM_NEGATIVE)
 
 getFilterMode ()
 
 setUseStandardFrame (bool $a_val)
 Set use standard frame. More...
 
 getUseStandardFrame ()
 
 getChildsOfNode ($a_parent_id)
 
 setOutput ( $a_parent_id, int $a_depth=1, int $a_obj_id=0, bool $a_highlighted_subtree=false)
 Creates output for explorer view in admin menue recursive method. More...
 
 modifyChilds ( $a_parent_id, array $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. More...
 
 forceExpanded ($a_obj_id)
 force expansion of node More...
 
 getMaximumTreeDepth ()
 
 getOutput ()
 
 handleListEndTags (ilTemplate $a_tpl_tree, int $a_cur_depth, int $a_item_depth)
 handle list end tags ( and ) More...
 
 handleListStartTags (ilTemplate $a_tpl_tree, int $a_cur_depth, int $a_item_depth)
 handle list start tags ( More...
 
 formatHeader (ilTemplate $tpl, $a_obj_id, array $a_option)
 
 formatObject (ilTemplate $tpl, $a_node_id, array $a_option, $a_obj_id=0)
 
 getImage (string $a_name, string $a_type="", $a_obj_id="")
 
 getImageAlt (string $a_default_text, string $a_type="", $a_obj_id="")
 
 getNodeStyleClass ( $a_id, string $a_type)
 
 buildLinkTarget ( $a_node_id, string $a_type)
 
 buildOnClick ( $a_node_id, string $a_type, string $a_title)
 
 buildTitle (string $a_title, $a_id, string $a_type)
 
 buildDescription (string $a_desc, $a_id, string $a_type)
 
 buildSelect ($a_node_id, string $a_type)
 standard implementation for adding an option select box between image and title More...
 
 buildFrameTarget (string $a_type, $a_child=0, $a_obj_id=0)
 
 createTarget (string $a_type, $a_node_id, bool $a_highlighted_subtree=false, bool $a_append_anch=true)
 
 setFrameTarget (string $a_target)
 
 createLines (int $a_depth)
 
 is_in_array (int $a_start, int $a_depth)
 
 getIndex (array $a_data)
 
 addFilter (string $a_item)
 
 delFilter (string $a_item)
 
 setExpand ($a_node_id)
 set the expand option this value is stored in a SESSION variable to save it different view (lo view, frm view,...) More...
 
 forceExpandAll (bool $a_mode, bool $a_show_minus=true)
 force expandAll. More...
 
 setFiltered (bool $a_bool)
 
 checkFilter (string $a_item)
 
 sortNodes (array $a_nodes, $a_parent_obj_id)
 sort nodes and put adm object to the end of sorted array More...
 

Data Fields

ilObjSCORMLearningModule $slm_obj
 id of root folder More...
 
- Data Fields inherited from ilExplorer
string $id = ""
 
string $output = ""
 
array $format_options = []
 
ilTree $tree
 
string $target = ""
 
string $target_get = ""
 
string $params_get = ""
 
array $expanded = []
 
string $order_column = ""
 
string $order_direction = "asc"
 
string $expand_target = null
 
bool $rbac_check = false
 
bool $output_icons = false
 
string $expand_variable = ""
 
array $is_clickable = []
 
bool $post_sort = false
 
bool $filtered = false
 
bool $filter_mode
 
bool $expand_all = false
 
 $root_id = null
 
bool $use_standard_frame = false
 

Protected Member Functions

 createOutputArray (int $a_parent_id, array $options=array())
 recursive creating of outputs More...
 
 insertObject (array $option, ilTemplate $tpl, bool $jsApi)
 insert the option data in $tpl More...
 
- Protected Member Functions inherited from ilExplorer
 requestStr (string $key)
 

Additional Inherited Members

- Protected Attributes inherited from ilExplorer
ilObjectDefinition $obj_definition
 
ilErrorHandling $error
 
ilRbacSystem $rbacsystem
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
 $filter = []
 
string $highlighted = ""
 
bool $show_minus = true
 
int $counter = 0
 
bool $asnch_expanding = false
 
int $textwidth = 0
 
string $title = ""
 
string $up_frame = ""
 
string $a_up_script = ""
 
string $up_params = ""
 
string $frame_target = ""
 
string $up_script = ""
 
string $tree_lead = ""
 
array $iconList = []
 
ILIAS Refinery Factory $refinery
 
ILIAS HTTP Wrapper WrapperFactory $wrapper
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

Constructor & Destructor Documentation

◆ __construct()

ilSCORMExplorer::__construct ( string  $a_target,
ilObjSCORMLearningModule $a_slm_obj 
)

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

28 {
29 parent::__construct($a_target);
30 $this->slm_obj = $a_slm_obj;
31 $this->tree = new ilSCORMTree($a_slm_obj->getId());
32 $this->root_id = $this->tree->readRootId();
33 $this->checkPermissions(false);
34 $this->outputIcons(true);
35 $this->setOrderColumn("");
36 }
setOrderColumn(string $a_column)
checkPermissions(bool $a_check)
outputIcons(bool $a_icons)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), ilExplorer\checkPermissions(), ilObject\getId(), ilExplorer\outputIcons(), and ilExplorer\setOrderColumn().

+ Here is the call graph for this function:

Member Function Documentation

◆ createOutput()

ilSCORMExplorer::createOutput ( array  $option,
bool  $jsApi 
)

recursive creation of output templates

Exceptions
ilTemplateException

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

156 {
157 global $DIC;
158 $ilBench = $DIC['ilBench'];
159
160 if (isset($option["visible"]) && $option["visible"] == true) {
161 $tpl = new ilTemplate("tpl.sahs_tree_ul.html", true, true, "Modules/ScormAicc");
162 $tpl = $this->insertObject($option, $tpl, $jsApi);
163 } else {
164 $tpl = new ilTemplate("tpl.sahs_tree_free.html", true, true, "Modules/ScormAicc");
165 }
166
167 if (isset($option["childs"]) && is_array($option["childs"]) && count($option["childs"]) > 0) {
168 foreach ($option["childs"] as $key => $ch_option) {
169 $tpl->setCurrentBlock("childs");
170 $tpl->setVariable("CHILDS", $this->createOutput($ch_option, $jsApi)->get());
172 }
173 }
174
175 return $tpl;
176 }
ilGlobalTemplateInterface $tpl
createOutput(array $option, bool $jsApi)
recursive creation of output templates
insertObject(array $option, ilTemplate $tpl, bool $jsApi)
insert the option data in $tpl
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: feed.php:28
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
string $key
Consumer key/client ID value.
Definition: System.php:193

References $DIC, ILIAS\LTI\ToolProvider\$key, ilExplorer\$tpl, createOutput(), insertObject(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), and ilGlobalTemplateInterface\setVariable().

Referenced by createOutput(), and getOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createOutputArray()

ilSCORMExplorer::createOutputArray ( int  $a_parent_id,
array  $options = array() 
)
protected

recursive creating of outputs

Returns
mixed[]

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

98 : array
99 {
100 global $ilErr;
101 $types_do_not_display = array("sos", "sma");
102 $types_do_not_load = array("srs");
103
104 if (!isset($a_parent_id)) {
105 $ilErr->raiseError(get_class($this) . "::setOutput(): No node_id given!", $ilErr->error_obj->WARNING);
106 }
107
108 if (!$this->showChilds($a_parent_id)) {
109 return array();
110 }
111
112 foreach ($this->tree->getChilds($a_parent_id, $this->order_column) as $key => $child) {
113 if (in_array($child["c_type"], $types_do_not_load)) {
114 continue;
115 }
116
117 $option = array();
118 $option["parent"] = $child["parent"];
119 $option["id"] = $child["child"];
120 $option["title"] = $child["title"];
121 $option["c_type"] = $child["c_type"];
122 $option["obj_id"] = $child["obj_id"];
123 $option["desc"] = "obj_" . $child["c_type"];
124 $option["container"] = false;
125 $option["visible"] = !in_array($child["c_type"], $types_do_not_display);
126
127 if ($this->showChilds($option["id"])) {
128 $option = $this->createOutputArray((int) $option["id"], $option);
129 }
130
131 $options["childs"][] = $option;
132 }
133
134 return $options;
135 }
showChilds($a_parent_id)
determines wether the childs of an object should be shown or not note: this standard implementation a...
createOutputArray(int $a_parent_id, array $options=array())
recursive creating of outputs
$ilErr
Definition: raiseError.php:17

References $ilErr, ILIAS\LTI\ToolProvider\$key, createOutputArray(), and ilExplorer\showChilds().

Referenced by createOutputArray(), and setOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createTarget()

ilSCORMExplorer::createTarget ( string  $a_type,
  $a_node_id,
bool  $a_highlighted_subtree = false,
bool  $a_append_anch = true 
)

Creates Get Parameter.

Reimplemented from ilExplorer.

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

76 : string //Missing typehint because ilExplorer
77 {
78 // SET expand parameter:
79 // positive if object is expanded
80 // negative if object is compressed
81 $a_node_id = ($a_type == '+')
82 ? $a_node_id
83 : -(int) $a_node_id;
84
85 return $_SERVER["PATH_INFO"] . "?cmd=explorer&ref_id=" . $this->slm_obj->getRefId() . "&scexpand=" . $a_node_id; //ToDo $_SERVER?
86 }
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10

References $_SERVER.

◆ formatHeader()

ilSCORMExplorer::formatHeader ( ilTemplate  $tpl,
  $a_obj_id,
array  $a_option 
)

overwritten method from base class

Exceptions
ilTemplateException

Reimplemented from ilExplorer.

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

57 : void //Missing typehint because ilExplorer
58 {
59 global $DIC;
60 $lng = $DIC->language();
61
62 $tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer");
63
64 $tpl->setCurrentBlock("row");
65 $tpl->setVariable("TITLE", $lng->txt("cont_manifest"));
66 $tpl->setVariable("LINK_TARGET", $this->target . "&" . $this->target_get . "=" . $a_obj_id);
67 $tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\"");
69
70 $this->output .= $tpl->get();
71 }
ilLanguage $lng
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $DIC, ilExplorer\$lng, ilExplorer\$tpl, ilGlobalTemplateInterface\get(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), ilGlobalTemplateInterface\setVariable(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getIconImagePathPrefix()

ilSCORMExplorer::getIconImagePathPrefix ( )

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

43 : string
44 {
45 return "scorm/";
46 }

Referenced by getOutputIcons().

+ Here is the caller graph for this function:

◆ getItem()

ilSCORMExplorer::getItem ( int  $a_node_id)

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

39 {
40 return new ilSCORMItem($a_node_id);
41 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getNodesToSkip()

ilSCORMExplorer::getNodesToSkip ( )

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

48 : int
49 {
50 return 2;
51 }

◆ getOutput()

ilSCORMExplorer::getOutput ( bool  $jsApi = false)

Creates output template.

Exceptions
ilTemplateException

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

146 : string
147 {
148 return $this->createOutput($this->format_options, $jsApi)->get();
149 }

References createOutput().

+ Here is the call graph for this function:

◆ getOutputIcons()

ilSCORMExplorer::getOutputIcons ( \ilTemplate  $tpl,
array  $a_option,
int  $a_node_id,
string  $scormtype = "sco" 
)

tpl is filled with option state

Exceptions
ilTemplateException

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

252 : void
253 {
254 global $DIC;
255 $lng = $DIC->language();
256
257 $tpl->setCurrentBlock("icon");
258
259 if ($scormtype === 'asset') {
260 $tpl->setVariable('ICON_IMAGE', ilUtil::getImagePath($this->getIconImagePathPrefix() . "asset.svg"));
261 $tpl->setVariable('TXT_ALT_IMG', '');
263 return;
264 }
265
267 $a_node_id,
268 0,
269 $this->slm_obj->getId()
270 );
271
272 // status
273 $status = !isset($trdata["cmi.core.lesson_status"])
274 ? "not attempted"
275 : $trdata["cmi.core.lesson_status"];
276
277 $statusChar = strtolower($status[0]);
278 if ($statusChar === "f") {
279 $status = "failed";
280 } elseif ($statusChar === "b") {
281 $status = "browsed";
282 } elseif ($statusChar === "c") {
283 $status = "completed";
284 } elseif ($statusChar === "n") {
285 $status = "not_attempted";
286 } elseif ($statusChar === "p") {
287 $status = "passed";
288 } elseif ($statusChar === "r") {
289 $status = "running";
290 }
291
292 $alt = $lng->txt("cont_status") . ": " .
293 $lng->txt("cont_sc_stat_" . str_replace(" ", "_", $status));
294
295 // score
296 if (isset($trdata["cmi.core.score.raw"])) {
297 $alt .= ", " . $lng->txt("cont_credits") .
298 ": " . $trdata["cmi.core.score.raw"];
299 }
300
301 // total time
302 if (isset($trdata["cmi.core.total_time"]) &&
303 $trdata["cmi.core.total_time"] !== "0000:00:00.00") {
304 $alt .= ", " . $lng->txt("cont_total_time") .
305 ": " . $trdata["cmi.core.total_time"];
306 }
307
308 $tpl->setVariable("ICON_NAME", 'scoIcon' . $a_node_id);
309 $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath($this->getIconImagePathPrefix() . str_replace(" ", "_", $status) . ".svg"));
310 $tpl->setVariable("TXT_ALT_IMG", $alt);
312 }
static _lookupTrackingDataOfUser(int $a_item_id, int $a_user_id=0, int $a_obj_id=0)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References $DIC, ilExplorer\$lng, ilExplorer\$tpl, ilSCORMItem\_lookupTrackingDataOfUser(), getIconImagePathPrefix(), ilUtil\getImagePath(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), HTML_Template_IT\setVariable(), ilGlobalTemplateInterface\setVariable(), and ilLanguage\txt().

Referenced by insertObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertObject()

ilSCORMExplorer::insertObject ( array  $option,
ilTemplate  $tpl,
bool  $jsApi 
)
protected

insert the option data in $tpl

Exceptions
ilTemplateException

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

196 {
197 global $ilErr;
198 if (!is_array($option) || !isset($option["id"])) {
199 $ilErr->raiseError(get_class($this) . "::insertObject(): Missing parameter or wrong datatype! " .
200 "options:" . var_dump($option), $ilErr->error_obj->WARNING);
201 }
202 $clickable = false;
203 if ($option["c_type"] == "sit") {
204 //get scorm item
205 $sc_object = new ilSCORMItem((int) $option["id"]);
206 $id_ref = $sc_object->getIdentifierRef();
207
208 //get scorm resource ref id
209 $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId());
210
211 //get scorm type
212 $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id));
213
214 //is scorm clickabke
215 $clickable = $this->isClickable($option["c_type"], (int) $option["id"]);
216
217 if ($this->output_icons && $clickable) {
218 $this->getOutputIcons($tpl, $option, (int) $option["id"], $scormtype);
219 }
220 }
221 if ($clickable) { // output link
222 $tpl->setCurrentBlock("link");
223 $frame_target = $this->buildFrameTarget($option["c_type"], $option["id"], $option["obj_id"]);
224 if ($frame_target != "") {
225 $tpl->setVariable("TITLE", ilStr::shortenTextExtended($option["title"], $this->textwidth, true));
226 $tpl->setVariable("LINK_TARGET", "javascript:void(0);");
227 if ($jsApi == true) {
228 $tpl->setVariable("ONCLICK", " onclick=\"parent.API.IliasLaunch('" . $option["id"] . "');return false;\"");
229 } else {
230 $tpl->setVariable("ONCLICK", " onclick=\"parent.APIFRAME.setupApi();parent.APIFRAME.API."
231 . ($scormtype === 'asset' ? 'IliasLaunchAsset' : 'IliasLaunchSahs')
232 . "('" . $option["id"] . "');return false;\"");
233 }
234 }
236 } else { // output text only
237 $tpl->setCurrentBlock("text");
238 $tpl->setVariable("OBJ_TITLE", ilStr::shortenTextExtended($option["title"], $this->textwidth, true));
240 }
241
242 $tpl->setCurrentBlock("li");
244
245 return $tpl;
246 }
buildFrameTarget(string $a_type, $a_child=0, $a_obj_id=0)
string $frame_target
getOutputIcons(\ilTemplate $tpl, array $a_option, int $a_node_id, string $scormtype="sco")
tpl is filled with option state
isClickable(string $type, int $ref_id=0)
can i click on the module name
static _lookupIdByIdRef(string $a_id_ref, int $a_slm_id)
static _lookupScormType(int $a_obj_id)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)

References ilExplorer\$frame_target, $ilErr, ilExplorer\$tpl, ilSCORMResource\_lookupIdByIdRef(), ilSCORMResource\_lookupScormType(), ilExplorer\buildFrameTarget(), getOutputIcons(), isClickable(), ilGlobalTemplateInterface\parseCurrentBlock(), ilGlobalTemplateInterface\setCurrentBlock(), ilGlobalTemplateInterface\setVariable(), and ilStr\shortenTextExtended().

Referenced by createOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isClickable()

ilSCORMExplorer::isClickable ( string  $type,
int  $ref_id = 0 
)

can i click on the module name

Reimplemented from ilExplorer.

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

181 : bool
182 {
183 if ($type !== "sit") {
184 return false;
185 }
186
187 $sc_object = new ilSCORMItem($ref_id);
188 return $sc_object->getIdentifierRef() != "";
189 }
$ref_id
Definition: ltiauth.php:67
$type

References $ref_id, and $type.

Referenced by insertObject().

+ Here is the caller graph for this function:

◆ isVisible()

ilSCORMExplorer::isVisible (   $a_ref_id,
string  $a_type 
)

Reimplemented from ilExplorer.

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

137 : bool //Typehint not possible now - see ilExplorer
138 {
139 return $a_type !== "sre";
140 }

◆ setOutput()

ilSCORMExplorer::setOutput (   $a_parent_id,
int  $a_depth = 1,
int  $a_obj_id = 0,
  $a_highlighted_subtree = false 
)

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

88 : void
89 // public function setOutput(int $a_parent_id, int $a_depth = 1, int $a_obj_id = 0, bool $a_highlighted_subtree = false) : void
90 {
91 $this->format_options = $this->createOutputArray($a_parent_id);
92 }

References createOutputArray().

+ Here is the call graph for this function:

Field Documentation

◆ $slm_obj

ilObjSCORMLearningModule ilSCORMExplorer::$slm_obj

id of root folder

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


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