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");
71 'node_title' =>
'title',
72 'node_point' =>
'points',
73 'node_current' =>
'ilHighlighted current_node',
74 'node_buttons' =>
'tree_button' 76 'lp_object' =>
'lp-object',
90 $ilAccess = $DIC[
'ilAccess'];
93 $ilToolbar = $DIC[
'ilToolbar'];
96 parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
98 $this->tree_root_id = $a_tree_root_id;
100 $this->access = $ilAccess;
103 $this->toolbar = $ilToolbar;
106 $this->js_conf = array();
108 $lng->loadLanguageModule(
"prg");
112 if ($this->
checkAccess(
'write', $a_tree_root_id)) {
129 $ilAccess = $DIC[
'ilAccess'];
131 $current_ref_id = (isset(
$_GET[
"ref_id"]))?
$_GET[
"ref_id"] : -1;
133 $is_current_node = ($node->getRefId() == $current_ref_id);
135 $is_root_node = ($is_study_programme && $node->getRoot() == null);
138 $is_delete_enabled = ($is_study_programme && ($is_current_node || $is_root_node))? false : $this->
checkAccess(
"delete", $current_ref_id);
140 $is_creation_enabled = ($this->
checkAccess(
"create", $current_ref_id));
142 $node_config = array(
143 'current_ref_id' => $current_ref_id,
144 'is_current_node' => $is_current_node,
145 'is_delete_enabled' => $is_delete_enabled,
146 'is_creation_enabled' => $is_creation_enabled,
147 'is_study_programme' => $is_study_programme,
148 'is_root_node' => $is_root_node
155 if ($this->
checkAccess(
'write', $node->getRefId())) {
156 if ($is_study_programme) {
163 $tpl->setCurrentBlock(
'node-content-block');
165 $tpl->setVariable(
'NODE_TITLE', $node->getTitle());
167 if ($is_study_programme) {
168 $tpl->setVariable(
'NODE_POINT_CLASSES', $this->class_configuration[
'node'][
'node_point']);
172 $tpl->parseCurrentBlock(
'node-content-block');
186 $node_title_classes = array($this->class_configuration[
'node'][
'node_title']);
187 if ($node_config[
'is_study_programme']) {
188 if ($node_config[
'is_current_node']) {
189 array_push($node_title_classes, $this->class_configuration[
'node'][
'node_current']);
192 array_push($node_title_classes, $this->class_configuration[
'lp_object']);
195 return $node_title_classes;
208 $tpl->setCurrentBlock(
'enable-tree-buttons');
212 $tpl->setVariable(
'NODE_INFO_BUTTON', $info_button);
215 if ($node_config[
'is_creation_enabled']) {
217 $tpl->setVariable(
'NODE_CREATE_BUTTON', $create_button);
221 if ($node_config[
'is_delete_enabled']) {
223 $tpl->setVariable(
'NODE_DELETE_BUTTON', $delete_button);
226 $tpl->parseCurrentBlock(
'enable-tree-buttons');
238 $tpl->setCurrentBlock(
'enable-tree-buttons');
241 if ($node_config[
'is_delete_enabled']) {
243 $tpl->setVariable(
'NODE_DELETE_BUTTON', $delete_button);
246 $tpl->parseCurrentBlock(
'enable-tree-buttons');
256 return new ilTemplate(
"tpl.tree_node_content.html",
true,
true,
"Modules/StudyProgramme");
268 return '(' . $points .
" " . $this->lng->txt(
'prg_points') .
')';
284 foreach (
$params as $param_name => $param_value) {
285 $this->ctrl->setParameterByClass($target_class, $param_name, $param_value);
290 $tpl->setCurrentBlock(
'tree-button-block');
292 $classes = array($this->class_configuration[
'node'][
'node_buttons']);
293 $classes[] =
'cmd_' . $cmd;
295 $tpl->setVariable(
'LINK_HREF', $this->ctrl->getLinkTargetByClass($target_class, $cmd,
'',
true,
false));
296 $tpl->setVariable(
'LINK_CLASSES', implode(
' ', $classes));
299 $tpl->touchBlock(
'enable-async-link');
300 $tpl->setVariable(
'LINK_DATA_TARGET',
'#' . $this->modal_id);
303 $tpl->setVariable(
'LINK_CONTENT', $content);
318 if ($node->getRoot() != null) {
319 return $node->getRoot();
335 $ilias = $DIC[
'ilias'];
338 if ($ilias->getSetting(
'custom_icons')) {
342 return ilObject::_getIcon($obj_id,
"tiny");
358 if (
$ilCtrl->getCmd() ==
"performPaste") {
359 $ilCtrl->setParameterByClass(
"ilObjStudyProgrammeGUI",
"target_node", $node->getRefId());
362 $ilCtrl->setParameterByClass(
"ilObjStudyProgrammeGUI",
"ref_id", $node->getRefId());
379 $ilAccess = $DIC[
'ilAccess'];
383 $children_with_permission = array();
387 $children = ($parent_obj->hasChildren())? $parent_obj->getChildren() : $parent_obj->getLPChildren();
389 if (is_array($children)) {
390 foreach ($children as $node) {
391 if ($this->
checkAccess(
'visible', $node->getRefId())) {
392 $children_with_permission[] = $node;
398 return $children_with_permission;
424 if (!is_null($a_node)) {
425 return $a_node->getRefId();
438 $tpl->setCurrentBlock(
"list_item_start");
441 $tpl->touchBlock(
"li_closed");
447 $tpl->parseCurrentBlock();
448 $tpl->touchBlock(
"tag");
460 $this->tpl->addJavascript($this->js_study_programme_path);
461 $this->tpl->addCss($this->css_study_programme_path);
463 $this->tpl->addOnLoadCode(
'$("#' . $this->
getContainerId() .
'").study_programme_tree(' . json_encode($this->js_conf) .
');');
465 return parent::getHTML();
477 if (in_array($node_id, $this->open_nodes)) {
478 $k = array_search($node_id, $this->open_nodes);
479 unset($this->open_nodes[$k]);
481 $this->store->set(
"on_" . $this->
id, serialize($this->open_nodes));
493 if (!in_array(
$id, $this->open_nodes)) {
494 $this->open_nodes[] =
$id;
496 $this->store->set(
"on_" . $this->
id, serialize($this->open_nodes));
510 $checker = $this->access->checkAccess($permission,
'', $ref_id);
527 throw new ilException(
"You have no permission for " . $permission .
" Object with ref_id " . $ref_id .
"!");
538 $this->js_conf[
$key] = $value;
548 return $this->js_conf[
$key];
getRootNode()
Return root node of tree.
checkAccess($permission, $ref_id)
Checks permission of current tree or certain child of it.
if(!array_key_exists('StateId', $_REQUEST)) $id
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.