ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSCORMExplorer Class Reference
+ 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

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)
SCORM Object Tree.
__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 154 of file class.ilSCORMExplorer.php.

155 {
156 global $DIC;
157 $ilBench = $DIC['ilBench'];
158
159 if (isset($option["visible"]) && $option["visible"] == true) {
160 $tpl = new ilTemplate("tpl.sahs_tree_ul.html", true, true, "components/ILIAS/ScormAicc");
161 $tpl = $this->insertObject($option, $tpl, $jsApi);
162 } else {
163 $tpl = new ilTemplate("tpl.sahs_tree_free.html", true, true, "components/ILIAS/ScormAicc");
164 }
165
166 if (isset($option["childs"]) && is_array($option["childs"]) && count($option["childs"]) > 0) {
167 foreach ($option["childs"] as $key => $ch_option) {
168 $tpl->setCurrentBlock("childs");
169 $tpl->setVariable("CHILDS", $this->createOutput($ch_option, $jsApi)->get());
171 }
172 }
173
174 return $tpl;
175 }
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
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
global $DIC
Definition: shib_login.php:26

References $DIC, ilExplorer\$tpl, createOutput(), insertObject(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), and ILIAS\UICore\GlobalTemplate\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

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

97 : array
98 {
99 global $ilErr;
100 $types_do_not_display = array("sos", "sma");
101 $types_do_not_load = array("srs");
102
103 if (!isset($a_parent_id)) {
104 $ilErr->raiseError(get_class($this) . "::setOutput(): No node_id given!", $ilErr->error_obj->WARNING);
105 }
106
107 if (!$this->showChilds($a_parent_id)) {
108 return array();
109 }
110
111 foreach ($this->tree->getChilds($a_parent_id, $this->order_column) as $key => $child) {
112 if (in_array($child["c_type"], $types_do_not_load)) {
113 continue;
114 }
115
116 $option = array();
117 $option["parent"] = $child["parent"];
118 $option["id"] = $child["child"];
119 $option["title"] = $child["title"];
120 $option["c_type"] = $child["c_type"];
121 $option["obj_id"] = $child["obj_id"];
122 $option["desc"] = "obj_" . $child["c_type"];
123 $option["container"] = false;
124 $option["visible"] = !in_array($child["c_type"], $types_do_not_display);
125
126 if ($this->showChilds($option["id"])) {
127 $option = $this->createOutputArray((int) $option["id"], $option);
128 }
129
130 $options["childs"][] = $option;
131 }
132
133 return $options;
134 }
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:33

References $ilErr, 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:26

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, "components/ILIAS/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, ILIAS\UICore\GlobalTemplate\get(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\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 }

◆ 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 145 of file class.ilSCORMExplorer.php.

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

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 251 of file class.ilSCORMExplorer.php.

251 : void
252 {
253 global $DIC;
254 $lng = $DIC->language();
255
256 $tpl->setCurrentBlock("icon");
257
258 if ($scormtype === 'asset') {
259 $tpl->setVariable('ICON_IMAGE', ilUtil::getImagePath($this->getIconImagePathPrefix() . "asset.svg"));
260 $tpl->setVariable('TXT_ALT_IMG', '');
262 return;
263 }
264
266 $a_node_id,
267 0,
268 $this->slm_obj->getId()
269 );
270
271 // status
272 $status = !isset($trdata["cmi.core.lesson_status"])
273 ? "not attempted"
274 : $trdata["cmi.core.lesson_status"];
275
276 $statusChar = strtolower($status[0]);
277 if ($statusChar === "f") {
278 $status = "failed";
279 } elseif ($statusChar === "b") {
280 $status = "browsed";
281 } elseif ($statusChar === "c") {
282 $status = "completed";
283 } elseif ($statusChar === "n") {
284 $status = "not_attempted";
285 } elseif ($statusChar === "p") {
286 $status = "passed";
287 } elseif ($statusChar === "r") {
288 $status = "running";
289 }
290
291 $alt = $lng->txt("cont_status") . ": " .
292 $lng->txt("cont_sc_stat_" . str_replace(" ", "_", $status));
293
294 // score
295 if (isset($trdata["cmi.core.score.raw"])) {
296 $alt .= ", " . $lng->txt("cont_credits") .
297 ": " . $trdata["cmi.core.score.raw"];
298 }
299
300 // total time
301 if (isset($trdata["cmi.core.total_time"]) &&
302 $trdata["cmi.core.total_time"] !== "0000:00:00.00") {
303 $alt .= ", " . $lng->txt("cont_total_time") .
304 ": " . $trdata["cmi.core.total_time"];
305 }
306
307 $tpl->setVariable("ICON_NAME", 'scoIcon' . $a_node_id);
308 $tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath($this->getIconImagePathPrefix() . str_replace(" ", "_", $status) . ".svg"));
309 $tpl->setVariable("TXT_ALT_IMG", $alt);
311 }
static _lookupTrackingDataOfUser(int $a_item_id, int $a_user_id=0, int $a_obj_id=0)
static getImagePath(string $image_name, 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(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), ILIAS\UICore\GlobalTemplate\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 194 of file class.ilSCORMExplorer.php.

195 {
196 global $ilErr;
197 if (!is_array($option) || !isset($option["id"])) {
198 $ilErr->raiseError(get_class($this) . "::insertObject(): Missing parameter or wrong datatype! " .
199 "options:" . var_dump($option), $ilErr->error_obj->WARNING);
200 }
201 $clickable = false;
202 if ($option["c_type"] == "sit") {
203 //get scorm item
204 $sc_object = new ilSCORMItem((int) $option["id"]);
205 $id_ref = $sc_object->getIdentifierRef();
206
207 //get scorm resource ref id
208 $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId());
209
210 //get scorm type
211 $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id));
212
213 //is scorm clickabke
214 $clickable = $this->isClickable($option["c_type"], (int) $option["id"]);
215
216 if ($this->output_icons && $clickable) {
217 $this->getOutputIcons($tpl, $option, (int) $option["id"], $scormtype);
218 }
219 }
220 if ($clickable) { // output link
221 $tpl->setCurrentBlock("link");
222 $frame_target = $this->buildFrameTarget($option["c_type"], $option["id"], $option["obj_id"]);
223 if ($frame_target != "") {
224 $tpl->setVariable("TITLE", ilStr::shortenTextExtended($option["title"], $this->textwidth, true));
225 $tpl->setVariable("LINK_TARGET", "javascript:void(0);");
226 if ($jsApi == true) {
227 $tpl->setVariable("ONCLICK", " onclick=\"parent.API.IliasLaunch('" . $option["id"] . "');return false;\"");
228 } else {
229 $tpl->setVariable("ONCLICK", " onclick=\"parent.APIFRAME.setupApi();parent.APIFRAME.API."
230 . ($scormtype === 'asset' ? 'IliasLaunchAsset' : 'IliasLaunchSahs')
231 . "('" . $option["id"] . "');return false;\"");
232 }
233 }
235 } else { // output text only
236 $tpl->setCurrentBlock("text");
237 $tpl->setVariable("OBJ_TITLE", ilStr::shortenTextExtended($option["title"], $this->textwidth, true));
239 }
240
241 $tpl->setCurrentBlock("li");
243
244 return $tpl;
245 }
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(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\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 180 of file class.ilSCORMExplorer.php.

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

References $ref_id.

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 136 of file class.ilSCORMExplorer.php.

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

◆ 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: