ILIAS  release_8 Revision v8.24
ilObjStudyProgrammeTreeGUI Class Reference

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

+ Collaboration diagram for ilObjStudyProgrammeTreeGUI:

Public Member Functions

 __construct (ilGlobalTemplateInterface $tpl, ilCtrl $ilCtrl, ilAccess $ilAccess, ilToolbarGUI $ilToolbar, ilLanguage $lng, ilComponentLogger $ilLog, ILIAS $ilias, ilSetting $ilSetting, ilTree $ilTree, ilRbacAdmin $rbacadmin, ILIAS\HTTP\Wrapper\WrapperFactory $http_wrapper, ILIAS\Refinery\Factory $refinery)
 
 setRefId (int $ref_id)
 
 executeCommand ()
 Execute GUI-commands If there is a async request the response is sent as a json string. More...
 

Protected Member Functions

 initTree ()
 Initialize Tree Creates tree instance and set tree configuration. More...
 
 view ()
 Display the tree view. More...
 
 cancel ()
 Cancel operation. More...
 
 saveTreeOrder ()
 Saves tree node order Data is json encoded from the jstree component. More...
 
 createNewLeaf ()
 Creates a new leaf Currently only course references can be created. More...
 
 getContainerSelectionExplorer (bool $convert_to_string=true)
 Initialize the Course Explorer for creating a leaf. More...
 
 getCreationForm ()
 Returns the async creation form for StudyProgrammes. More...
 
 create ()
 Generates the modal window content for the creation form of nodes or leafs If there are already StudyProgramme-nodes in the parent, leaf creation is disabled and if there are already leafs, nodes can't be created. More...
 
 delete ()
 Show to delete confirmation dialog for objects in the tree. More...
 
 confirmedDelete ()
 Deletes a node or a leaf in the tree. More...
 
 cancelDelete ()
 Cancel deletion Return a json string for the async handling. More...
 
 initAsyncUIElements ()
 Initializes all elements used for async-interaction Adds HTML-skeleton for the bootstrap modal dialog, the notification mechanism and the Selection container. More...
 
 getToolbar ()
 Setup the toolbar. More...
 
 checkAccess (string $permission, int $ref_id=null)
 Checks permission of current tree or certain child of it. More...
 
 checkAccessOrFail (string $permission, int $ref_id=null)
 Checks permission of a object and throws an exception if they are not granted. More...
 

Protected Attributes

ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilComponentLogger $log
 
Ilias $ilias
 
ilSetting $ilSetting
 
ilTree $ilTree
 
ilRbacAdmin $rbacadmin
 
ILIAS HTTP Wrapper WrapperFactory $http_wrapper
 
ILIAS Refinery Factory $refinery
 
string $modal_id
 CSS-ID of the modal windows. More...
 
ilAsyncOutputHandler $async_output_handler
 
int $ref_id
 Ref-ID of the object. More...
 
ilObjStudyProgrammeTreeExplorerGUI $tree
 
ilObjStudyProgramme $object
 

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 Class ilObjStudyProgrammeTreeGUI Generates the manage view for ilTrainingProgramme-Repository objects. Handles all the async requests.

Author
Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

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

Constructor & Destructor Documentation

◆ __construct()

ilObjStudyProgrammeTreeGUI::__construct ( ilGlobalTemplateInterface  $tpl,
ilCtrl  $ilCtrl,
ilAccess  $ilAccess,
ilToolbarGUI  $ilToolbar,
ilLanguage  $lng,
ilComponentLogger  $ilLog,
ILIAS  $ilias,
ilSetting  $ilSetting,
ilTree  $ilTree,
ilRbacAdmin  $rbacadmin,
ILIAS\HTTP\Wrapper\WrapperFactory  $http_wrapper,
ILIAS\Refinery\Factory  $refinery 
)

Definition at line 56 of file class.ilObjStudyProgrammeTreeGUI.php.

69 {
70 $this->tpl = $tpl;
71 $this->ctrl = $ilCtrl;
72 $this->access = $ilAccess;
73 $this->toolbar = $ilToolbar;
74 $this->log = $ilLog;
75 $this->ilias = $ilias;
76 $this->lng = $lng;
77 $this->ilSetting = $ilSetting;
78 $this->ilTree = $ilTree;
79 $this->rbacadmin = $rbacadmin;
80 $this->http_wrapper = $http_wrapper;
81 $this->refinery = $refinery;
82
83 $this->modal_id = "tree_modal";
84 $this->async_output_handler = new ilAsyncOutputHandler();
85
87 }
Class ilAsyncOutputHandler Handles the output for async-requests.
loadLanguageModule(string $a_module)
Load language module.
ILIAS HTTP Wrapper WrapperFactory $http_wrapper
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
header include for all ilias files.

References $http_wrapper, $ilias, $ilSetting, $ilTree, $lng, $rbacadmin, $refinery, $tpl, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilLanguage\loadLanguageModule(), ILIAS\Repository\refinery(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilObjStudyProgrammeTreeGUI::cancel ( )
protected

Cancel operation.

Definition at line 166 of file class.ilObjStudyProgrammeTreeGUI.php.

166 : string
167 {
169 }
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.

References ilAsyncOutputHandler\encodeAsyncResponse().

+ Here is the call graph for this function:

◆ cancelDelete()

ilObjStudyProgrammeTreeGUI::cancelDelete ( )
protected

Cancel deletion Return a json string for the async handling.

Definition at line 525 of file class.ilObjStudyProgrammeTreeGUI.php.

525 : string
526 {
528 }

References ilAsyncOutputHandler\encodeAsyncResponse().

+ Here is the call graph for this function:

◆ checkAccess()

ilObjStudyProgrammeTreeGUI::checkAccess ( string  $permission,
int  $ref_id = null 
)
protected

Checks permission of current tree or certain child of it.

Definition at line 589 of file class.ilObjStudyProgrammeTreeGUI.php.

589 : bool
590 {
591 if (is_null($ref_id)) {
593 }
594 return $this->access->checkAccess($permission, '', $ref_id);
595 }

References $ref_id, and ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ checkAccessOrFail()

ilObjStudyProgrammeTreeGUI::checkAccessOrFail ( string  $permission,
int  $ref_id = null 
)
protected

Checks permission of a object and throws an exception if they are not granted.

Exceptions
ilException

Definition at line 602 of file class.ilObjStudyProgrammeTreeGUI.php.

602 : void
603 {
604 if (!$this->checkAccess($permission, $ref_id)) {
605 throw new ilException("You have no permission for " . $permission . " Object with ref_id " . $ref_id . "!");
606 }
607 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccess(string $permission, int $ref_id=null)
Checks permission of current tree or certain child of it.

References $ref_id.

Referenced by saveTreeOrder().

+ Here is the caller graph for this function:

◆ confirmedDelete()

ilObjStudyProgrammeTreeGUI::confirmedDelete ( )
protected

Deletes a node or a leaf in the tree.

Exceptions
ilException

Definition at line 452 of file class.ilObjStudyProgrammeTreeGUI.php.

452 : string
453 {
454 $this->checkAccessOrFail("delete");
455
456 if (
457 (!$this->http_wrapper->post()->has("id") || !$this->http_wrapper->post()->has("item_ref_id")) &&
458 is_array($this->http_wrapper->post()->retrieve(
459 "id[]",
460 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
461 ))
462 ) {
463 throw new ilException("No item select for deletion!");
464 }
465
466 $ids = $this->http_wrapper->post()->retrieve(
467 "id",
468 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
469 );
470 $current_node = $this->http_wrapper->post()->retrieve("item_ref_id", $this->refinery->kindlyTo()->int());
471 $result = true;
472 $msg = '';
473
474 foreach ($ids as $id) {
475 $obj = ilObjectFactoryWrapper::singleton()->getInstanceByRefId($id);
476
477 $not_parent_of_current = true;
478 $not_root = true;
479
480 // do some additional validation if it is a StudyProgramme
481 if ($obj instanceof ilObjStudyProgramme) {
482
483 //check if you are not deleting a parent element of the current element
484 $children_of_node = ilObjStudyProgramme::getAllChildren($obj->getRefId());
485 $get_ref_ids = static function (ilObjStudyProgramme $obj): int {
486 return $obj->getRefId();
487 };
488
489 $children_ref_ids = array_map($get_ref_ids, $children_of_node);
490 $not_parent_of_current = (!in_array($current_node, $children_ref_ids));
491
492 $not_root = ($obj->getRoot() != null);// TODO PHP8-REVIEW This is always true
493 }
494
495 if (
496 $current_node != $id &&
497 $not_root &&
498 $not_parent_of_current &&
499 $this->checkAccess('delete', $obj->getRefId())
500 ) {
502
503 // deletes the tree-open-node-session storage
504 if (isset($children_of_node)) {
505 $this->tree->closeCertainNode($id);
506 foreach ($children_of_node as $child) {
507 $this->tree->closeCertainNode($child->getRefId());
508 }
509 }
510
511 $msg = $this->lng->txt("prg_deleted_safely");
512 } else {
513 $msg = $this->lng->txt("prg_not_allowed_node_to_delete");
514 $result = false;
515 }
516 }
517
518 return ilAsyncOutputHandler::encodeAsyncResponse(array('success' => $result, 'message' => $msg));
519 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
checkAccessOrFail(string $permission, int $ref_id=null)
Checks permission of a object and throws an exception if they are not granted.
static getAllChildren(int $a_ref_id, bool $include_references=false)
Get a list of all ilObjStudyProgrammes in the subtree starting at $a_ref_id.
static deleteObjects(int $a_cur_ref_id, array $a_ids, bool $throw_error_on_already_deleted=true)
Delete objects.

References $id, ilRepUtil\deleteObjects(), ilAsyncOutputHandler\encodeAsyncResponse(), ilObjStudyProgramme\getAllChildren(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilObjectFactoryWrapper\singleton().

+ Here is the call graph for this function:

◆ create()

ilObjStudyProgrammeTreeGUI::create ( )
protected

Generates the modal window content for the creation form of nodes or leafs If there are already StudyProgramme-nodes in the parent, leaf creation is disabled and if there are already leafs, nodes can't be created.

Exceptions
ilException

Definition at line 348 of file class.ilObjStudyProgrammeTreeGUI.php.

348 : void
349 {
350 $parent_id = null;
351 if ($this->http_wrapper->query()->has("ref_id")) {
352 $parent_id = $this->http_wrapper->query()->retrieve("ref_id", $this->refinery->kindlyTo()->int());
353 }
354 $this->checkAccessOrFail('create', $parent_id);
355
356 $parent = ilObjectFactoryWrapper::singleton()->getInstanceByRefId($parent_id);// TODO PHP8-REVIEW `$parent_id` is NULL, an `int` is expected
357 $accordion = new ilAccordionGUI();
358
359 $added_slides = 0;
360 $content = "";
361 if ($parent instanceof ilObjStudyProgramme) {
362 // only allow adding new StudyProgramme-Node if there are no lp-children
363 if (!$parent->hasLPChildren()) {
364 $content_new_node = $this->getCreationForm()->getHTML();
365 $accordion->addItem($this->lng->txt('prg_create_new_node'), $content_new_node);
366 $added_slides++;
367 }
368
369 /* only allow adding new LP-Children if there are no other StudyProgrammes
370 * AND creating crs references is activated in administration
371 */
372 if (!$parent->hasChildren() && $this->ilSetting->get("obj_dis_creation_crsr") === "") {
373 $content_new_leaf = ilUtil::getSystemMessageHTML(
374 $this->lng->txt('prg_please_select_a_course_for_creating_a_leaf')
375 );
376 $content_new_leaf .= $this->getContainerSelectionExplorer();
377
378 $accordion->addItem($this->lng->txt('prg_create_new_leaf'), $content_new_leaf);
379 $added_slides++;
380 }
381
382 if ($added_slides === 1) {
383 $accordion->setBehaviour(ilAccordionGUI::FIRST_OPEN);
384 }
385
386 $content = $accordion->getHTML(true);
387 }
388
389 // creating modal window output
390 $this->async_output_handler->setHeading($this->lng->txt("prg_async_" . $this->ctrl->getCmd()));
391 $this->async_output_handler->setContent($content);
392 $this->async_output_handler->terminate();
393 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getContainerSelectionExplorer(bool $convert_to_string=true)
Initialize the Course Explorer for creating a leaf.
getCreationForm()
Returns the async creation form for StudyProgrammes.
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.

References ilAccordionGUI\FIRST_OPEN, ilUtil\getSystemMessageHTML(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilObjectFactoryWrapper\singleton().

+ Here is the call graph for this function:

◆ createNewLeaf()

ilObjStudyProgrammeTreeGUI::createNewLeaf ( )
protected

Creates a new leaf Currently only course references can be created.

Exceptions
ilException

Definition at line 258 of file class.ilObjStudyProgrammeTreeGUI.php.

258 : string
259 {
260 $this->checkAccessOrFail('create', $this->http_wrapper->post()->retrieve("parent_id", $this->refinery->kindlyTo()->int()));
261
262 if (
263 $this->http_wrapper->post()->has("target_id") &&
264 $this->http_wrapper->post()->has("type") &&
265 $this->http_wrapper->post()->has("parent_id")
266 ) {
267 $target_id = $this->http_wrapper->post()->retrieve("target_id", $this->refinery->kindlyTo()->int());
268 $parent_id = $this->http_wrapper->post()->retrieve("parent_id", $this->refinery->kindlyTo()->int());
269
270 // TODO: more generic way for implementing different type of leafs
271 $course_ref = new ilObjCourseReference();
272 $course_ref->setTitleType(ilContainerReference::TITLE_TYPE_REUSE);
273 $course_ref->setTargetRefId($target_id);
274
275 $course_ref->create();
276 $course_ref->createReference();
277
278 $course_ref->putInTree($parent_id);
279
280 // This is how it's done in ILIAS. If you set the target ID before the creation, it won't work
281 $course_ref->setTargetId(ilObject::_lookupObjectId($target_id));
282 $course_ref->update();
283 }
284
286 ['success' => true, 'message' => $this->lng->txt('prg_added_course_ref_successful')]
287 );
288 }
static _lookupObjectId(int $ref_id)
$target_id
Definition: goto.php:52

References $target_id, ilObject\_lookupObjectId(), ilAsyncOutputHandler\encodeAsyncResponse(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilContainerReference\TITLE_TYPE_REUSE.

+ Here is the call graph for this function:

◆ delete()

ilObjStudyProgrammeTreeGUI::delete ( )
protected

Show to delete confirmation dialog for objects in the tree.

Exceptions
ilException

Definition at line 400 of file class.ilObjStudyProgrammeTreeGUI.php.

400 : void
401 {
402 $this->checkAccessOrFail("delete");
403
404 if (!$this->http_wrapper->query()->has("ref_id") || !$this->http_wrapper->query()->has("item_ref_id")) {
405 throw new ilException("Nothing to delete!");
406 }
407
408 $element_ref_id = $this->http_wrapper->query()->retrieve("ref_id", $this->refinery->kindlyTo()->int());
409
410 $cgui = new ilConfirmationGUI();
411
412 $msg = $this->lng->txt("info_delete_sure");
413 if (!$this->ilSetting->get('enable_trash')) {
414 $msg .= "<br/>" . $this->lng->txt("info_delete_warning_no_trash");
415 }
416 $cgui->setHeaderText($msg);
417 $cgui->setFormAction($this->ctrl->getFormAction($this, 'confirmedDelete', '', true));
418 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
419 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
420 $cgui->setFormName('async_form');
421
422 $obj_id = ilObject::_lookupObjectId((int) $element_ref_id);
423 $type = ilObject::_lookupType($obj_id);
424 $title = call_user_func(array(ilObjectFactory::getClassByType($type),'_lookupTitle'), $obj_id);
425 $alt = $this->lng->txt("icon") . " " . $this->lng->txt("obj_" . $type);
426
427 $cgui->addItem(
428 "id[]",
429 (string)$element_ref_id,
430 $title,
431 ilObject::_getIcon($obj_id, "small", $type),
432 $alt
433 );
434 $cgui->addHiddenItem(
435 'item_ref_id',
436 $this->http_wrapper->query()->retrieve("item_ref_id", $this->refinery->kindlyTo()->string())
437 );
438
439 $content = $cgui->getHTML();
440
441 // creating the modal window output
442 $this->async_output_handler->setHeading($msg);
443 $this->async_output_handler->setContent($content);
444 $this->async_output_handler->terminate();
445 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getClassByType(string $obj_type)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
get(string $a_keyword, ?string $a_default_value=null)
get setting
$type

References $type, ilObject\_getIcon(), ilObject\_lookupObjectId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilSetting\get(), ilObjectFactory\getClassByType(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjStudyProgrammeTreeGUI::executeCommand ( )

Execute GUI-commands If there is a async request the response is sent as a json string.

Exceptions
ilException

Definition at line 114 of file class.ilObjStudyProgrammeTreeGUI.php.

114 : void
115 {
116 $this->initTree();
117 $cmd = $this->ctrl->getCmd();
118
119 $this->getToolbar();
120
121 if ($cmd === "" || $cmd === null) {
122 $cmd = "view";
123 }
124
125 // handles tree commands ("openNode", "closeNode", "getNodeAsync")
126 if ($this->tree->handleCommand()) {
127 exit();
128 }
129
130 switch ($cmd) {
131 case "view":
132 case "create":
133 case "save":
134 case "cancel":
135 case "delete":
136 case "confirmedDelete":
137 case "cancelDelete":
138 case "getContainerSelectionExplorer":
139 case "saveTreeOrder":
140 case "createNewLeaf":
141
142 $content = $this->$cmd();
143 break;
144 default:
145 throw new ilException("ilObjStudyProgrammeTreeGUI: " .
146 "Command not supported: $cmd");
147 }
148
150 }
static handleAsyncOutput(string $normal_content, string $async_content=null, bool $apply_to_tpl=true)
Handles async output.
initTree()
Initialize Tree Creates tree instance and set tree configuration.
exit
Definition: login.php:28

References ILIAS\Repository\ctrl(), exit, getToolbar(), ilAsyncOutputHandler\handleAsyncOutput(), and initTree().

+ Here is the call graph for this function:

◆ getContainerSelectionExplorer()

ilObjStudyProgrammeTreeGUI::getContainerSelectionExplorer ( bool  $convert_to_string = true)
protected

Initialize the Course Explorer for creating a leaf.

Parameters
bool$convert_to_stringIf set to true, the getOutput function is already called
Returns
ilAsyncContainerSelectionExplorer|string

Definition at line 297 of file class.ilObjStudyProgrammeTreeGUI.php.

298 {
299 $create_leaf_form = new ilAsyncContainerSelectionExplorer(
300 rawurldecode($this->ctrl->getLinkTarget($this, 'createNewLeaf', '', true)),
301 $this->refinery,
302 $this->http_wrapper->query()
303 );
304 $create_leaf_form->setId("select_course_explorer");
305
306 $ref_expand = ROOT_FOLDER_ID;
307 if ($this->http_wrapper->query()->has("ref_repexpand")) {
308 $ref_expand = $this->http_wrapper->query()->retrieve("ref_repexpand", $this->refinery->kindlyTo()->int());
309 }
310
311 $create_leaf_form->setExpand($ref_expand);
312 $create_leaf_form->setExpandTarget($this->ctrl->getLinkTarget($this, 'getContainerSelectionExplorer'));
313 $create_leaf_form->setAsynchExpanding(true);
314 $create_leaf_form->setTargetGet('target_id');
315 $create_leaf_form->setFrameTarget("_self");
316 $create_leaf_form->setClickable('crs', true);
317 $create_leaf_form->setTargetType('crs');
318 $create_leaf_form->setOutput(0);
319
320 if ($convert_to_string) {
321 return $create_leaf_form->getOutput();
322 }
323
324 return $create_leaf_form;
325 }
Class ilAsyncContainerSelectionExplorer A class for async ilContainerSelectionExplorer which triggers...
const ROOT_FOLDER_ID
Definition: constants.php:32

References ILIAS\Repository\ctrl(), ILIAS\Repository\refinery(), and ROOT_FOLDER_ID.

+ Here is the call graph for this function:

◆ getCreationForm()

ilObjStudyProgrammeTreeGUI::getCreationForm ( )
protected

Returns the async creation form for StudyProgrammes.

Definition at line 330 of file class.ilObjStudyProgrammeTreeGUI.php.

331 {
332 $tmp_obj = new ilObjStudyProgrammeGUI();
333
334 $create_node_form = $tmp_obj->getAsyncCreationForm();
335 $create_node_form->setTitle("");
336 $this->ctrl->setParameterByClass("ilobjstudyprogrammegui", "new_type", "prg");
337 $create_node_form->setFormAction($this->ctrl->getFormActionByClass("ilobjstudyprogrammegui", "save"));
338
339 return $create_node_form;
340 }
Class ilAsyncPropertyFormGUI.
Class ilObjStudyProgrammeGUI class @ilCtrl_Calls ilObjStudyProgrammeGUI: ilPermissionGUI @ilCtrl_Call...

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getToolbar()

ilObjStudyProgrammeTreeGUI::getToolbar ( )
protected

Setup the toolbar.

Definition at line 568 of file class.ilObjStudyProgrammeTreeGUI.php.

568 : void
569 {
570 $save_order_btn = ilLinkButton::getInstance();
571 $save_order_btn->setId('save_order_button');
572 $save_order_btn->setUrl("javascript:void(0);");
573 $save_order_btn->setOnClick("$('body').trigger('study_programme-save_order');");
574 $save_order_btn->setCaption('prg_save_tree_order');
575
576 $cancel_order_btn = ilLinkButton::getInstance();
577 $cancel_order_btn->setId('cancel_order_button');
578 $cancel_order_btn->setUrl("javascript:void(0);");
579 $cancel_order_btn->setOnClick("$('body').trigger('study_programme-cancel_order');");
580 $cancel_order_btn->setCaption('prg_cancel_tree_order');
581
582 $this->toolbar->addButtonInstance($save_order_btn);
583 $this->toolbar->addButtonInstance($cancel_order_btn);
584 }

References ilLinkButton\getInstance(), and ILIAS\Repository\toolbar().

Referenced by executeCommand().

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

◆ initAsyncUIElements()

ilObjStudyProgrammeTreeGUI::initAsyncUIElements ( )
protected

Initializes all elements used for async-interaction Adds HTML-skeleton for the bootstrap modal dialog, the notification mechanism and the Selection container.

Definition at line 534 of file class.ilObjStudyProgrammeTreeGUI.php.

534 : string
535 {
536 // add js files
540
541 // add bootstrap modal
542 $settings_modal = ilModalGUI::getInstance();
543 $settings_modal->setId($this->modal_id);
544 $settings_modal->setType(ilModalGUI::TYPE_LARGE);
545 $this->tpl->addOnLoadCode('$("#' . $this->modal_id . '").study_programme_modal();');
546
547 $content = $settings_modal->getHTML();
548
549 // init js notifications
550 $notifications = new ilAsyncNotifications();
551 $notifications->addJsConfig('events', array('success' => array('study_programme-show_success')));
552 $notifications->initJs();
553
554 // init tree selection explorer
555 $async_explorer = new ilAsyncContainerSelectionExplorer(
556 rawurldecode($this->ctrl->getLinkTarget($this, 'createNewLeaf', '', true)),
557 $this->refinery,
558 $this->http_wrapper->query()
559 );
560 $async_explorer->initJs();
561
562 return $content;
563 }
static addJavaScript(ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
static addJavascript()
Adds the javascript to template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static addJavaScript(bool $add_form_loader=false, string $js_base_path=null)
Adds all needed js By default is called by ilAsyncPropertyFormGUI::getHTML()
static getInstance()

References ilAsyncContainerSelectionExplorer\addJavascript(), ilAsyncPropertyFormGUI\addJavaScript(), ilAccordionGUI\addJavaScript(), ILIAS\Repository\ctrl(), ilModalGUI\getInstance(), and ilModalGUI\TYPE_LARGE.

Referenced by view().

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

◆ initTree()

ilObjStudyProgrammeTreeGUI::initTree ( )
protected

Initialize Tree Creates tree instance and set tree configuration.

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

98 : void
99 {
100 $this->tree = new ilObjStudyProgrammeTreeExplorerGUI($this->ref_id, $this->modal_id, "prg_tree", $this, 'view');
101
102 $js_url = rawurldecode($this->ctrl->getLinkTarget($this, 'saveTreeOrder', '', true));
103 $this->tree->addJsConf('save_tree_url', $js_url);
104 $this->tree->addJsConf('save_button_id', 'save_order_button');
105 $this->tree->addJsConf('cancel_button_id', 'cancel_order_button');
106 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

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

◆ saveTreeOrder()

ilObjStudyProgrammeTreeGUI::saveTreeOrder ( )
protected

Saves tree node order Data is json encoded from the jstree component.

Exceptions
ilException

Definition at line 177 of file class.ilObjStudyProgrammeTreeGUI.php.

177 : string
178 {
179 $this->checkAccessOrFail('write');
180
181 $tree = "";
182 if ($this->http_wrapper->post()->has("tree")) {
183 $tree = $this->http_wrapper->post()->retrieve("tree", $this->refinery->kindlyTo()->string());
184 }
185 $treeAsJson = ilUtil::stripSlashes($tree);
186 $treeData = json_decode($treeAsJson, false, 512, JSON_THROW_ON_ERROR);
187
188 if (!is_array($treeData) || [] === $treeData) {
189 throw new ilStudyProgrammeTreeException("There is no tree data to save!");
190 }
191
192 // saves order recursive
193 $this->storeTreeOrder($treeData);
194
196 ['success' => true, 'message' => $this->lng->txt('prg_saved_order_successful')]
197 );
198 }
ilObjStudyProgrammeTreeExplorerGUI $tree
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References $tree, checkAccessOrFail(), ilAsyncOutputHandler\encodeAsyncResponse(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ setRefId()

ilObjStudyProgrammeTreeGUI::setRefId ( int  $ref_id)

Definition at line 89 of file class.ilObjStudyProgrammeTreeGUI.php.

89 : void
90 {
91 $this->ref_id = $ref_id;
92 }

References $ref_id.

◆ view()

ilObjStudyProgrammeTreeGUI::view ( )
protected

Display the tree view.

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

155 : string
156 {
157 $output = $this->tree->getHTML();
158 $output .= $this->initAsyncUIElements();
159
160 return $output;
161 }
initAsyncUIElements()
Initializes all elements used for async-interaction Adds HTML-skeleton for the bootstrap modal dialog...

References initAsyncUIElements().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjStudyProgrammeTreeGUI::$access
protected

Definition at line 32 of file class.ilObjStudyProgrammeTreeGUI.php.

◆ $async_output_handler

ilAsyncOutputHandler ilObjStudyProgrammeTreeGUI::$async_output_handler
protected

Definition at line 47 of file class.ilObjStudyProgrammeTreeGUI.php.

◆ $ctrl

ilCtrl ilObjStudyProgrammeTreeGUI::$ctrl
protected

Definition at line 31 of file class.ilObjStudyProgrammeTreeGUI.php.

◆ $http_wrapper

ILIAS HTTP Wrapper WrapperFactory ilObjStudyProgrammeTreeGUI::$http_wrapper
protected

Definition at line 40 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by __construct().

◆ $ilias

Ilias ilObjStudyProgrammeTreeGUI::$ilias
protected

Definition at line 36 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by __construct().

◆ $ilSetting

ilSetting ilObjStudyProgrammeTreeGUI::$ilSetting
protected

Definition at line 37 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by __construct().

◆ $ilTree

ilTree ilObjStudyProgrammeTreeGUI::$ilTree
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilObjStudyProgrammeTreeGUI::$lng
protected

Definition at line 34 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by __construct().

◆ $log

ilComponentLogger ilObjStudyProgrammeTreeGUI::$log
protected

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

◆ $modal_id

string ilObjStudyProgrammeTreeGUI::$modal_id
protected

CSS-ID of the modal windows.

Definition at line 46 of file class.ilObjStudyProgrammeTreeGUI.php.

◆ $object

ilObjStudyProgramme ilObjStudyProgrammeTreeGUI::$object
protected

Definition at line 54 of file class.ilObjStudyProgrammeTreeGUI.php.

◆ $rbacadmin

ilRbacAdmin ilObjStudyProgrammeTreeGUI::$rbacadmin
protected

Definition at line 39 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by __construct().

◆ $ref_id

int ilObjStudyProgrammeTreeGUI::$ref_id
protected

Ref-ID of the object.

Definition at line 52 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by setRefId().

◆ $refinery

ILIAS Refinery Factory ilObjStudyProgrammeTreeGUI::$refinery
protected

Definition at line 41 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilObjStudyProgrammeTreeGUI::$toolbar
protected

Definition at line 33 of file class.ilObjStudyProgrammeTreeGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilObjStudyProgrammeTreeGUI::$tpl
protected

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

Referenced by __construct().

◆ $tree

ilObjStudyProgrammeTreeExplorerGUI ilObjStudyProgrammeTreeGUI::$tree
protected

Definition at line 53 of file class.ilObjStudyProgrammeTreeGUI.php.

Referenced by saveTreeOrder().


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