3 require_once(
"./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
4 require_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
5 require_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
6 require_once(
"./Services/UIComponent/Button/classes/class.ilLinkButton.php");
7 require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeSettingsGUI.php");
70 'node_title' =>
'title',
71 'node_point' =>
'points',
72 'node_current' =>
'ilHighlighted current_node',
73 'node_buttons' =>
'tree_button' 75 'lp_object' =>
'lp-object',
89 parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
91 $this->tree_root_id = $a_tree_root_id;
93 $this->access = $ilAccess;
96 $this->toolbar = $ilToolbar;
99 $this->js_conf = array();
101 $lng->loadLanguageModule(
"prg");
119 global
$lng, $ilAccess;
121 $current_ref_id = (isset(
$_GET[
"ref_id"]))?
$_GET[
"ref_id"] : -1;
123 $is_current_node = ($node->getRefId() == $current_ref_id);
125 $is_root_node = ($is_study_programme && $node->getRoot() == null);
128 $is_delete_enabled = ($is_study_programme && ($is_current_node || $is_root_node))? false : $this->
checkAccess(
"delete", $current_ref_id);
130 $is_creation_enabled = ($this->
checkAccess(
"create", $current_ref_id));
132 $node_config = array(
133 'current_ref_id' =>$current_ref_id,
134 'is_current_node' => $is_current_node,
135 'is_delete_enabled' => $is_delete_enabled,
136 'is_creation_enabled' => $is_creation_enabled,
137 'is_study_programme' => $is_study_programme,
138 'is_root_node' => $is_root_node
144 $tpl->setCurrentBlock(
'node-content-block');
146 $tpl->setVariable(
'NODE_TITLE', $node->getTitle());
148 if($is_study_programme) {
149 $tpl->setVariable(
'NODE_POINT_CLASSES', $this->class_configuration[
'node'][
'node_point']);
153 $tpl->parseCurrentBlock(
'node-content-block');
156 if($this->
checkAccess(
'write', $node->getRefId())) {
157 if($is_study_programme) {
175 $node_title_classes = array($this->class_configuration[
'node'][
'node_title']);
176 if($node_config[
'is_study_programme']){
177 if ($node_config[
'is_current_node']) {
178 array_push($node_title_classes, $this->class_configuration[
'node'][
'node_current']);
181 array_push($node_title_classes, $this->class_configuration[
'lp_object']);
184 return $node_title_classes;
196 $tpl->setCurrentBlock(
'enable-tree-buttons');
197 $tpl->touchBlock(
'enable-tree-buttons');
201 $tpl->setVariable(
'NODE_INFO_BUTTON', $info_button);
204 if($node_config[
'is_creation_enabled']) {
206 $tpl->setVariable(
'NODE_CREATE_BUTTON', $create_button);
210 if($node_config[
'is_delete_enabled']) {
212 $tpl->setVariable(
'NODE_DELETE_BUTTON', $delete_button);
215 $tpl->parseCurrentBlock(
'enable-tree-buttons');
226 $tpl->setCurrentBlock(
'enable-tree-buttons');
227 $tpl->touchBlock(
'enable-tree-buttons');
230 if($node_config[
'is_delete_enabled']) {
232 $tpl->setVariable(
'NODE_DELETE_BUTTON', $delete_button);
235 $tpl->parseCurrentBlock(
'enable-tree-buttons');
244 return new ilTemplate(
"tpl.tree_node_content.html",
true,
true,
"Modules/StudyProgramme");
255 return '('. $points .
" ".$this->lng->txt(
'prg_points').
')';
270 foreach(
$params as $param_name=>$param_value) {
271 $this->ctrl->setParameterByClass($target_class, $param_name, $param_value);
276 $tpl->setCurrentBlock(
'tree-button-block');
278 $classes = array($this->class_configuration[
'node'][
'node_buttons']);
279 $classes[] =
'cmd_'.$cmd;
281 $tpl->setVariable(
'LINK_HREF', $this->ctrl->getLinkTargetByClass($target_class,
$cmd,
'',
true,
false));
282 $tpl->setVariable(
'LINK_CLASSES', implode(
' ', $classes));
285 $tpl->touchBlock(
'enable-async-link');
286 $tpl->setVariable(
'LINK_DATA_TARGET',
'#'.$this->modal_id);
289 $tpl->setVariable(
'LINK_CONTENT', $content);
303 if($node->getRoot() != NULL) {
304 return $node->getRoot();
321 if ($ilias->getSetting(
'custom_icons')) {
339 if ($ilCtrl->getCmd() ==
"performPaste") {
340 $ilCtrl->setParameterByClass(
"ilObjStudyProgrammeGUI",
"target_node", $node->getRefId());
343 $ilCtrl->setParameterByClass(
"ilObjStudyProgrammeGUI",
"ref_id", $node->getRefId());
362 $children_with_permission = array();
366 $children = ($parent_obj->hasChildren())? $parent_obj->getChildren() : $parent_obj->getLPChildren();
368 if(is_array($children)) {
369 foreach($children as $node) {
370 if($this->
checkAccess(
'visible', $node->getRefId())) {
371 $children_with_permission[] = $node;
377 return $children_with_permission;
401 if(!is_null($a_node)) {
402 return $a_node->getRefId();
415 $tpl->setCurrentBlock(
"list_item_start");
419 $tpl->touchBlock(
"li_closed");
421 $tpl->setVariable(
"DOM_NODE_ID",
423 $tpl->parseCurrentBlock();
424 $tpl->touchBlock(
"tag");
435 $this->tpl->addJavascript($this->js_study_programme_path);
436 $this->tpl->addCss($this->css_study_programme_path);
438 $this->tpl->addOnLoadCode(
'$("#'.$this->
getContainerId().
'").study_programme_tree('.json_encode($this->js_conf).
');');
440 return parent::getHTML();
451 if (in_array($node_id, $this->open_nodes))
453 $k = array_search($node_id, $this->open_nodes);
454 unset($this->open_nodes[$k]);
456 $this->store->set(
"on_".$this->
id, serialize($this->open_nodes));
467 if (!in_array($id, $this->open_nodes))
469 $this->open_nodes[] = $id;
471 $this->store->set(
"on_".$this->
id, serialize($this->open_nodes));
484 $checker = $this->access->checkAccess($permission,
'',
$ref_id);
500 throw new ilException(
"You have no permission for ".$permission.
" Object with ref_id ".
$ref_id.
"!");
510 $this->js_conf[$key] = $value;
519 return $this->js_conf[$key];
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
getRootNode()
Return root node of tree.
checkAccess($permission, $ref_id)
Checks permission of current tree or certain child of it.
Base class for ILIAS Exception handling.
static get($a_glyph, $a_text="")
Get glyph html.
getJsConf($key)
Returns setting of the study-programme-tree.
$css_study_programme_path
getNodeIcon($a_node)
Get node icon Return custom icon of OrgUnit type if existing.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
isNodeClickable($a_node)
Is node clickable?
setEnableDnd($enable_dnd)
Enable Drag & Drop functionality.
getNodeTemplateInstance()
Factory method for a new instance of a node template.
getNodeId($a_node)
Get id of a node.
getNodeContent($node)
Return node element.
getHTML()
Returns the output of the complete tree There are added some additional javascripts before output the...
Class ilObjStudyProgramme.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
openCertainNode($node_id)
Open certain node in the tree session The open nodes of a tree are stored in a session.
formatPointValue($points)
Returns formatted point value.
closeCertainNode($node_id)
Closes certain node in the tree session The open nodes of a tree are stored in a session.
parseStudyProgrammeNodeButtons($node, $node_config, $tpl)
Generates the buttons for a study-programme node.
getNodeButtonActionLink($target_class, $cmd, $params, $content, $async=true)
Generate link-element.
getChildsOfNode($a_parent_node_id)
Get childs of node.
addJsConf($key, $value)
Adds configuration to the study-programme-tree jquery plugin.
getNodeHref($node)
Returns node link target.
listItemStart($tpl, $a_node)
List item start.
__construct($a_tree_root_id, $modal_id, $a_expl_id, $a_parent_obj, $a_parent_cmd)
Class ilStudyProgrammeTreeGUI ilObjStudyProgrammeTreeExplorerGUI generates the tree output for StudyP...
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
nodeHasVisibleChilds($a_node)
Node has childs?
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
parseLeafNodeButtons($node, $node_config, $tpl)
Generates the buttons for a study programme leaf.
getNodeTitleClasses($node_config)
Returns array with all css classes of the title node element.
checkAccessOrFail($permission, $ref_id)
Checks permission of a object and throws an exception if they are not granted.
getContainerId()
Get container id.