ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLMExplorerGUI 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 ilLMExplorerGUI:
+ Collaboration diagram for ilLMExplorerGUI:

Public Member Functions

 __construct ( $a_parent_obj, string $a_parent_cmd, ilObjContentObject $a_lm, string $a_id="")
 
 beforeRendering ()
 Before rendering. More...
 
 getNodeContent ($a_node)
 
 isNodeHighlighted ($a_node)
 
- Public Member Functions inherited from ilTreeExplorerGUI
 __construct (string $a_expl_id, $a_parent_obj, string $a_parent_cmd, ilTree $a_tree, string $a_node_parameter_name="node_id")
 
 getTree ()
 
 setOrderField (string $a_val, bool $a_numeric=false)
 
 getOrderField ()
 
 setTypeWhiteList (array $a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList (array $a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds (bool $a_val)
 
 getPreloadChilds ()
 
 getSuccessorNode ( $a_node_id, string $a_type="")
 Get successor node (currently only(!) based on lft/rgt tree values) More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeId ($a_node)
 Get id for node. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getRootNode ()
 Get root node. More...
 
 setRootId ($a_root)
 
 setPathOpen ($a_id)
 Set node path to be opened. More...
 
 getHTML ($new=false)
 Get HTML. More...
 
 getChildren ($record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
 
 getTreeLabel ()
 
 getTreeComponent ()
 
 toggleExplorerNodeState ()
 Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 setChildLimit (int $a_val)
 
 getChildLimit ()
 
 setSearchTerm (string $a_val)
 
 getSearchTerm ()
 
 setMainTemplate (?ilGlobalTemplateInterface $a_main_tpl=null)
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get children of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has children Please note that this standard method may not be optimal depending on what a derived class does in isNodeVisible. More...
 
 sortChilds (array $a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode (bool $a_val)
 
 getSkipRootNode ()
 
 setAjax (bool $a_val)
 
 getAjax ()
 
 setSecondaryHighlightedNodes (array $a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode (string $a_postvar, bool $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode (bool $a_val)
 
 getOfflineMode ()
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 
 renderNode ($a_node, ilTemplate $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, ilTemplate $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId (string $a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart (ilTemplate $tpl, $a_node)
 List item start. More...
 
 listItemEnd (ilTemplate $tpl)
 
 listStart (ilTemplate $tpl)
 
 listEnd (ilTemplate $tpl)
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled (bool $nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd (bool $enable_dnd)
 
- Public Member Functions inherited from ILIAS\UI\Component\Tree\TreeRecursion
 getChildren ( $record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Protected Member Functions

 checkLPIcon (int $a_id)
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 
 matches ($node)
 Does a node match a search term (or is search term empty) More...
 
 getRootId ()
 
 createNode (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
 Creates at tree node, can be overwritten in derivatives if another node type should be used. More...
 
 getNodeStateToggleCmdClasses ($record)
 Should return an array of ilCtrl-enabled command classes which should be used to build the URL for the expand/collapse actions applied on a tree node. More...
 
 render ()
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 isNodeSelectable ($a_node)
 Is node selectable? More...
 
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
 isNodeOpen ($node_id)
 Get all open nodes. More...
 
 getJSTreePlugins ()
 
 isNodeRequested (string $a_node_id)
 

Protected Attributes

ilObjContentObject $lm
 
ilObjUser $user
 
array $lp_cache = []
 
int $cnt_lmobj = 0
 
string $obj_id = ""
 
string $transl = ""
 
- Protected Attributes inherited from ilTreeExplorerGUI
ilLanguage $lng
 
Psr Http Message ServerRequestInterface $httpRequest
 
ilTree $tree = null
 
string $tree_label = ""
 
string $order_field = ""
 
bool $order_field_numeric = false
 
array $type_white_list = array()
 
array $type_black_list = array()
 
array $childs = array()
 
bool $preloaded = false
 
bool $preload_childs = false
 
array $root_node_data = null
 
array $all_childs = array()
 
 $root_id = 0
 
ILIAS DI UIServices $ui
 
- Protected Attributes inherited from ilExplorerBaseGUI
string $node_parameter_name
 
ilLogger $log
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
bool $skip_root_node = false
 
bool $ajax = false
 
array $custom_open_nodes = array()
 
array $selected_nodes = array()
 
string $select_postvar = ""
 
bool $offline_mode = false
 
array $sec_highl_nodes = array()
 
bool $enable_dnd = false
 
string $search_term = ""
 
array $open_nodes = []
 
ilSessionIStorage $store
 
bool $select_multi = false
 
 $parent_obj
 
int $child_limit = 0
 
string $parent_cmd = ''
 
string $requested_exp_cmd = ""
 
string $requested_exp_cont = ""
 
string $requested_searchterm = ""
 
string $requested_node_id = ""
 
string $id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 
static getLocalJsTreeJsPath ()
 
static getLocalJsTreeCssPath ()
 
static createHTMLExportDirs (string $a_target_dir)
 
static init (?ilGlobalTemplateInterface $a_main_tpl=null)
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static string $js_tree_path = "./node_modules/jstree/dist/jstree.js"
 
static string $js_tree_path_css = "./node_modules/jstree/dist/themes/default/style.min.css"
 
static string $js_expl_path = "assets/js/Explorer2.js"
 

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 LM editor explorer GUI class

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilLMExplorerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMExplorerGUI::__construct (   $a_parent_obj,
string  $a_parent_cmd,
ilObjContentObject  $a_lm,
string  $a_id = "" 
)
Parameters
object | string$a_parent_obj

Reimplemented in ilLMEditorExplorerGUI.

Definition at line 35 of file class.ilLMExplorerGUI.php.

40 {
41 global $DIC;
42
43 $this->user = $DIC->user();
44 $this->lm = $a_lm;
45
46 $tree = ilLMTree::getInstance($this->lm->getId());
47
48 $this->cnt_lmobj = ilLMObject::preloadDataByLM($this->lm->getId());
49
51
52 if ($a_id == "") {
53 $a_id = "lm_exp";
54
55 // this does not work, since it is not set yet
56 if ($this->getOfflineMode()) {
57 $a_id = "lm_exp_off";
58 }
59 }
60
61 parent::__construct($a_id, $a_parent_obj, $a_parent_cmd, $tree);
62
63 $this->setSkipRootNode(false);
64 $this->setAjax(false);
65 $this->setPreloadChilds(true);
66
67 $this->setPathOpen($tree->readRootId());
68
69 $params = $DIC->http()->request()->getQueryParams();
70 $this->obj_id = (string) ($params["obj_id"] ?? "");
71 $this->transl = (string) ($params["transl"] ?? "");
72
73 if ($this->obj_id > 0) {
74 $this->setPathOpen($this->obj_id);
75 }
76 }
static preloadDataByLM(int $a_lm_id)
Preload data records by lm.
static getInstance(int $a_tree_id)
static preloadActivationDataByParentId(int $a_parent_id)
Preload activation data by Parent Id.
setPathOpen($a_id)
Set node path to be opened.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, $params, ilTreeExplorerGUI\$tree, ILIAS\GlobalScreen\Provider\__construct(), ilLMTree\getInstance(), ilExplorerBaseGUI\getOfflineMode(), ilPageObject\preloadActivationDataByParentId(), ilLMObject\preloadDataByLM(), ilTree\readRootId(), ilExplorerBaseGUI\setAjax(), ilTreeExplorerGUI\setPathOpen(), ilTreeExplorerGUI\setPreloadChilds(), ilExplorerBaseGUI\setSkipRootNode(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ beforeRendering()

ilLMExplorerGUI::beforeRendering ( )

Before rendering.

Reimplemented from ilExplorerBaseGUI.

Definition at line 78 of file class.ilLMExplorerGUI.php.

78 : void
79 {
80 if ($this->cnt_lmobj > 200 && !$this->getOfflineMode()) {
81 $class = (is_object($this->parent_obj))
82 ? get_class($this->parent_obj)
84 $this->ctrl->setParameterByClass($class, "obj_id", $this->obj_id);
85 $this->setAjax(true);
86 }
87 }

References ilExplorerBaseGUI\$parent_obj, ILIAS\Repository\ctrl(), ilExplorerBaseGUI\getOfflineMode(), and ilExplorerBaseGUI\setAjax().

+ Here is the call graph for this function:

◆ checkLPIcon()

ilLMExplorerGUI::checkLPIcon ( int  $a_id)
protected
Parameters
int$a_idlm tree node id
Exceptions
ilInvalidLPStatusException

Definition at line 129 of file class.ilLMExplorerGUI.php.

129 : string
130 {
131 $ilUser = $this->user;
132
133 // do it once for all chapters
134 if (!isset($this->lp_cache[$this->lm->getId()])) {
135 $this->lp_cache[$this->lm->getId()] = [];
136
137 if (ilLearningProgressAccess::checkAccess($this->lm->getRefId())) {
138 $info = null;
139
140 $olp = ilObjectLP::getInstance($this->lm->getId());
141 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL ||
142 $olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
143 $class = ilLPStatusFactory::_getClassById($this->lm->getId(), $olp->getCurrentMode());
144 $info = $class::_getStatusInfo($this->lm->getId());
145 }
146
147 // parse collection items
148 if (isset($info["items"])) {
149 foreach ($info["items"] as $item_id) {
151 if (isset($info["in_progress"][$item_id]) &&
152 in_array($ilUser->getId(), $info["in_progress"][$item_id])) {
154 } elseif (isset($info["completed"][$item_id]) &&
155 in_array($ilUser->getId(), $info["completed"][$item_id])) {
157 }
158 $this->lp_cache[$this->lm->getId()][$item_id] = $status;
159 }
160 }
161 }
162 }
163
164 if (isset($this->lp_cache[$this->lm->getId()]) &&
165 isset($this->lp_cache[$this->lm->getId()][$a_id])) {
167 return $icons->getImagePathForStatus($this->lp_cache[$this->lm->getId()][$a_id]);
168 }
169
170 return "";
171 }
static _getClassById(int $a_obj_id, ?int $a_mode=null)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static getInstance(int $obj_id)
$info
Definition: entry_point.php:21

References $info, $user, ilLPStatusFactory\_getClassById(), ilLearningProgressAccess\checkAccess(), ilObjectLP\getInstance(), ilLPStatusIcons\getInstance(), ilLPStatusIcons\ICON_VARIANT_SHORT, ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

+ Here is the call graph for this function:

◆ getNodeContent()

ilLMExplorerGUI::getNodeContent (   $a_node)
Parameters
object | array$a_node

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilLMTOCExplorerGUI.

Definition at line 93 of file class.ilLMExplorerGUI.php.

93 : string
94 {
95 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
96 return $this->lm->getTitle();
97 }
98
99 $lang = ($this->transl != "")
100 ? $this->transl
101 : "-";
103 $a_node,
105 $this->lm->isActiveNumbering(),
106 false,
107 false,
108 $this->lm->getId(),
109 $lang
110 );
111 }
static _getNodePresentationTitle(array $a_node, string $a_mode=self::PAGE_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-")
getNodeId($a_node)
Get id for node.
$lang
Definition: xapiexit.php:25

References $lang, ilLMObject\_getNodePresentationTitle(), ilTreeExplorerGUI\getNodeId(), ilTreeExplorerGUI\getRootNode(), and ilLMObject\PAGE_TITLE.

+ Here is the call graph for this function:

◆ isNodeHighlighted()

ilLMExplorerGUI::isNodeHighlighted (   $a_node)
Parameters
object | array$a_node

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilLMTOCExplorerGUI.

Definition at line 116 of file class.ilLMExplorerGUI.php.

116 : bool
117 {
118 if ($a_node["child"] == $this->obj_id ||
119 ($this->obj_id == "" && $a_node["child"] == $this->getNodeId($this->getRootNode()))) {
120 return true;
121 }
122 return false;
123 }

References ilTreeExplorerGUI\getNodeId(), and ilTreeExplorerGUI\getRootNode().

+ Here is the call graph for this function:

Field Documentation

◆ $cnt_lmobj

int ilLMExplorerGUI::$cnt_lmobj = 0
protected

Definition at line 28 of file class.ilLMExplorerGUI.php.

◆ $lm

ilObjContentObject ilLMExplorerGUI::$lm
protected

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

◆ $lp_cache

array ilLMExplorerGUI::$lp_cache = []
protected

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

◆ $obj_id

string ilLMExplorerGUI::$obj_id = ""
protected

Definition at line 29 of file class.ilLMExplorerGUI.php.

Referenced by ilLMEditorExplorerGUI\getNodeHref().

◆ $transl

string ilLMExplorerGUI::$transl = ""
protected

Definition at line 30 of file class.ilLMExplorerGUI.php.

◆ $user

ilObjUser ilLMExplorerGUI::$user
protected

Definition at line 26 of file class.ilLMExplorerGUI.php.

Referenced by checkLPIcon().


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