ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilConditionHandlerGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
16{
17 public $ctrl = null;
18
19 public $lng;
20 public $tpl;
21 public $tree;
22
23 public $ch_obj;
26 public $target_id;
30
31 public $automatic_validation = true;
32
42 public function __construct($gui_obj, $a_ref_id = null)
43 {
44 global $lng,$tpl,$tree,$ilCtrl;
45
46 include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
47
48 $this->ch_obj = new ilConditionHandler();
49
50 $this->ctrl =&$ilCtrl;
51 $this->gui_obj =&$gui_obj;
52 $this->lng =&$lng;
53 $this->lng->loadLanguageModule('rbac');
54 $this->tpl =&$tpl;
55 $this->tree =&$tree;
56
57 if ($a_ref_id) {
58 $this->target_obj =&ilObjectFactory::getInstanceByRefId($a_ref_id);
59 } else {
60 $this->target_obj =&$this->gui_obj->object;
61 }
62
63 // this only works for ilObject derived objects (other objects
64 // should call set() methods manually
65 if (is_object($this->target_obj)) {
66 $this->setTargetId($this->target_obj->getId());
67 $this->setTargetRefId($this->target_obj->getRefId());
68 $this->setTargetType($this->target_obj->getType());
69 $this->setTargetTitle($this->target_obj->getTitle());
70 }
71 }
72
77 public static function translateOperator($a_obj_id, $a_operator)
78 {
79 switch ($a_operator) {
81 $GLOBALS['lng']->loadLanguageModule('trac');
82 include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
83 $obj_settings = new ilLPObjSettings($a_obj_id);
84 return ilLPObjSettings::_mode2Text($obj_settings->getMode());
85
86 default:
87 $GLOBALS['lng']->loadLanguageModule('rbac');
88 return $GLOBALS['lng']->txt('condition_' . $a_operator);
89 }
90 }
91
96 protected function getConditionHandler()
97 {
98 return $this->ch_obj;
99 }
100
101 public function setBackButtons($a_btn_arr)
102 {
103 $_SESSION['precon_btn'] = $a_btn_arr;
104 }
105 public function getBackButtons()
106 {
107 return $_SESSION['precon_btn'] ? $_SESSION['precon_btn'] : array();
108 }
109
110 public function executeCommand()
111 {
112 global $ilErr, $ilAccess, $lng;
113
114 if (!$ilAccess->checkAccess('write', '', $this->getTargetRefId())) {
115 $ilErr->raiseError($lng->txt('permission_denied'), $ilErr->WARNING);
116 }
117
118 $next_class = $this->ctrl->getNextClass($this);
119 $cmd = $this->ctrl->getCmd();
120
121 switch ($next_class) {
122 default:
123 if (empty($cmd)) {
124 $cmd = "view";
125 }
126 $this->$cmd();
127 break;
128 }
129 }
130
131 public function setAutomaticValidation($a_status)
132 {
133 $this->automatic_validation = $a_status;
134 }
135 public function getAutomaticValidation()
136 {
138 }
139
140
144 public function setTargetId($a_target_id)
145 {
146 $this->target_id = $a_target_id;
147 }
148
152 public function getTargetId()
153 {
154 return $this->target_id;
155 }
156
160 public function setTargetRefId($a_target_ref_id)
161 {
162 $this->target_ref_id = $a_target_ref_id;
163 }
164
168 public function getTargetRefId()
169 {
171 }
172
176 public function setTargetType($a_target_type)
177 {
178 $this->target_type = $a_target_type;
179 }
180
184 public function getTargetType()
185 {
186 return $this->target_type;
187 }
188
192 public function setTargetTitle($a_target_title)
193 {
194 $this->target_title = $a_target_title;
195 }
196
201 public function isTargetReferenced()
202 {
203 return $this->getTargetRefId() ? true : false;
204 }
205
209 public function getTargetTitle()
210 {
211 return $this->target_title;
212 }
213
214 public function chi_init(&$chi_target_obj, $a_ref_id = null)
215 {
216 echo 'deprecated';
217
218 include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
219
220 $this->ch_obj = new ilConditionHandler();
221
222 if ($a_ref_id) {
223 $this->target_obj =&ilObjectFactory::getInstanceByRefId($a_ref_id);
224 } else {
225 $this->target_obj =&$this->object;
226 }
227
228 return true;
229 }
230
235 protected function listConditions()
236 {
237 global $ilToolbar;
238
239 $ilToolbar->addButton($this->lng->txt('add_condition'), $this->ctrl->getLinkTarget($this, 'selector'));
240
241 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.list_conditions.html', 'Services/AccessControl');
242
244 $this->getTargetRefId(),
245 $this->getTargetId(),
246 $this->getTargetType()
247 );
248 if (count($optional_conditions)) {
249 if (!$_REQUEST["list_mode"]) {
250 $_REQUEST["list_mode"] = "subset";
251 }
252 } elseif (!$_REQUEST["list_mode"]) {
253 $_REQUEST["list_mode"] = "all";
254 }
255
256 // Show form only if conditions are availabe
258 $this->getTargetRefId(),
259 $this->getTargetId(),
260 $this->getTargetType()
261 ))
262 ) {
263 $form = $this->showObligatoryForm($optional_conditions);
264 if ($form instanceof ilPropertyFormGUI) {
265 $this->tpl->setVariable('TABLE_SETTINGS', $form->getHTML());
266 }
267 }
268
269 include_once './Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
270 $table = new ilConditionHandlerTableGUI($this, 'listConditions', ($_REQUEST["list_mode"] != "all"));
271 $table->setConditions(
273 $this->getTargetRefId(),
274 $this->getTargetId(),
275 $this->getTargetType()
276 )
277 );
278
279 $h = $table->getHTML();
280 $this->tpl->setVariable('TABLE_CONDITIONS', $h);
281 //$this->tpl->setContent($h);
282 }
283
287 protected function saveObligatorySettings()
288 {
289 $form = $this->showObligatoryForm();
290 if ($form->checkInput()) {
291 $old_mode = $form->getInput("old_list_mode");
292 switch ($form->getInput("list_mode")) {
293 case "all":
294 if ($old_mode != "all") {
295 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
297 $this->getTargetRefId(),
298 $this->getTargetId(),
299 $this->getTargetType()
300 );
301 // Set all optional conditions to obligatory
302 foreach ((array) $optional_conditions as $item) {
303 ilConditionHandler::updateObligatory($item["condition_id"], true);
304 }
305 }
306 break;
307
308 case "subset":
309 $num_req = $form->getInput('required');
310 if ($old_mode != "subset") {
312 $this->getTargetRefId(),
313 $this->getTargetId(),
314 $this->getTargetType()
315 );
316 foreach ($all_conditions as $item) {
317 ilConditionHandler::updateObligatory($item["condition_id"], false);
318 }
319 }
321 $this->getTargetRefId(),
322 $this->getTargetId(),
323 $num_req
324 );
325 break;
326 }
327
328 $cond = new ilConditionHandler();
329 $cond->setTargetRefId($this->getTargetRefId());
330 $cond->updateHiddenStatus((int) $form->getInput('hidden'));
331
332 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
333 $this->ctrl->redirect($this, 'listConditions');
334 }
335
336 $form->setValuesByPost();
337 ilUtil::sendFailure($this->lng->txt('err_check_input'));
338 $this->tpl->setContent($form->getHTML());
339 }
340
344 protected function saveObligatoryList()
345 {
347 $this->getTargetRefId(),
348 $this->getTargetId(),
349 $this->getTargetType()
350 );
351
352 if ($_POST["obl"] && sizeof($_POST["obl"]) > sizeof($all_conditions)-2) {
353 ilUtil::sendFailure($this->lng->txt("rbac_precondition_minimum_optional"), true);
354 $this->ctrl->redirect($this, 'listConditions');
355 }
356
357 foreach ($all_conditions as $item) {
358 $status = false;
359 if ($_POST["obl"] && in_array($item["condition_id"], $_POST["obl"])) {
360 $status = true;
361 }
362 ilConditionHandler::updateObligatory($item["condition_id"], $status);
363 }
364
365 // re-calculate
367 $this->getTargetRefId(),
368 $this->getTargetId(),
369 $this->getTargetType(),
370 true
371 );
372
373 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
374 $this->ctrl->redirect($this, 'listConditions');
375 }
376
381 protected function showObligatoryForm($opt = array())
382 {
383 if (!$GLOBALS['objDefinition']->isRbacObject($this->getTargetType())) {
384 return;
385 }
386
387
388 if (!$opt) {
390 $this->getTargetRefId(),
391 $this->getTargetId(),
392 $this->getTargetType()
393 );
394 }
395
397
398 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
399 $form = new ilPropertyFormGUI();
400 $form->setFormAction($this->ctrl->getFormAction($this), 'listConditions');
401 $form->setTitle($this->lng->txt('precondition_obligatory_settings'));
402 $form->addCommandButton('saveObligatorySettings', $this->lng->txt('save'));
403
404 $hide = new ilCheckboxInputGUI($this->lng->txt('rbac_precondition_hide'), 'hidden');
406 $hide->setValue(1);
407 $hide->setInfo($this->lng->txt('rbac_precondition_hide_info'));
408 $form->addItem($hide);
409
410 $mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode");
411 $form->addItem($mode);
412 $mode->setValue($_REQUEST["list_mode"]);
413
414 $mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all");
415 $mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info"));
416 $mode->addOption($mall);
417
418
419 if (count($all) > 1) {
420 $min = 1;
421 $max = count($all) - 1;
422
423 $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
424 $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
425 $mode->addOption($msubset);
426
427 $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
428 $obl->setInfo($this->lng->txt('precondition_num_optional_info'));
429
431 $obl->setValue($num_required > 0 ? $num_required : null);
432 $obl->setRequired(true);
433 $obl->setSize(1);
434 $obl->setMinValue($min);
435 $obl->setMaxValue($max);
436 $msubset->addSubItem($obl);
437 }
438
439 $old_mode = new ilHiddenInputGUI("old_list_mode");
440 $old_mode->setValue($_REQUEST["list_mode"]);
441 $form->addItem($old_mode);
442
443 return $form;
444 }
445
446
447 public function edit()
448 {
449 global $ilObjDataCache;
450
451 if (!$_GET['condition_id']) {
452 ilUtil::sendFailure("Missing id: condition_id");
453 $this->listConditions();
454 return false;
455 }
456 $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
457
458 $this->tpl->addBlockfile(
459 'ADM_CONTENT',
460 'adm_content',
461 'tpl.condition_handler_edit_condition.html',
462 "Services/AccessControl"
463 );
464 $this->ctrl->setParameter($this, 'condition_id', (int) $_GET['condition_id']);
465
466 $this->initFormCondition($condition['trigger_ref_id'], (int) $_GET['condition_id'], 'edit');
467 $this->tpl->setVariable('CONDITION_TABLE', $this->form->getHTML());
468 }
469
470 public function updateCondition()
471 {
472 global $ilObjDataCache;
473
474 if (!$_GET['condition_id']) {
475 ilUtil::sendFailure("Missing id: condition_id");
476 $this->listConditions();
477 return false;
478 }
479
480 // Update condition
481 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
482 $condition_handler = new ilConditionHandler();
483
484 $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
485 $condition_handler->setOperator($_POST['operator']);
486 $condition_handler->setObligatory((int) $_POST['obligatory']);
487 $condition_handler->setTargetRefId($this->getTargetRefId());
488 $condition_handler->setValue('');
489 switch ($this->getTargetType()) {
490 case 'st':
491 $condition_handler->setReferenceHandlingType($_POST['ref_handling']);
492 break;
493
494 default:
495 $condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
496 break;
497 }
498 $condition_handler->updateCondition($condition['id']);
499
500 // Update relevant sco's
501 if ($condition['trigger_type'] == 'sahs') {
502 include_once 'Services/Object/classes/class.ilObjectLP.php';
503 $olp = ilObjectLP::getInstance($condition['trigger_obj_id']);
504 $collection = $olp->getCollectionInstance();
505 if ($collection) {
506 $collection->delete();
507 }
508
509 if (is_array($_POST['item_ids'])) { // #12901
510 $collection->activateEntries($_POST['item_ids']);
511 }
512
513 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
514 ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
515 }
516
517 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
518 $this->ctrl->redirect($this, 'listConditions');
519 }
520
521 public function askDelete()
522 {
523 global $tpl;
524
525 if (!count($_POST['conditions'])) {
526 ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
527 $this->listConditions();
528 return true;
529 }
530
531 // display confirmation message
532 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
533 $cgui = new ilConfirmationGUI();
534 $cgui->setFormAction($this->ctrl->getFormAction($this, "listConditions"));
535 $cgui->setHeaderText($this->lng->txt("rbac_condition_delete_sure"));
536 $cgui->setCancel($this->lng->txt("cancel"), "listConditions");
537 $cgui->setConfirm($this->lng->txt("delete"), "delete");
538
539 // list conditions that should be deleted
540 foreach ($_POST['conditions'] as $condition_id) {
541 $condition = ilConditionHandler::_getCondition($condition_id);
542
543 $title = ilObject::_lookupTitle($condition['trigger_obj_id']) .
544 " (" . $this->lng->txt("condition") . ": " .
545 $this->lng->txt('condition_' . $condition['operator']) . ")";
546 $icon = ilUtil::getImagePath('icon_' . $condition['trigger_type'] . '.svg');
547 $alt = $this->lng->txt('obj_' . $condition['trigger_type']);
548
549 $cgui->addItem("conditions[]", $condition_id, $title, $icon, $alt);
550 }
551
552 $tpl->setContent($cgui->getHTML());
553 }
554
555 public function delete()
556 {
557 if (!count($_POST['conditions'])) {
558 ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
559 $this->listConditions();
560 return true;
561 }
562
563 foreach ($_POST['conditions'] as $condition_id) {
564 $this->ch_obj->deleteCondition($condition_id);
565 }
566 ilUtil::sendSuccess($this->lng->txt('condition_deleted'), true);
567 $this->ctrl->redirect($this, 'listConditions');
568
569 return true;
570 }
571
572 public function selector()
573 {
574 include_once("./Services/AccessControl/classes/class.ilConditionSelector.php");
575
576 ilUtil::sendInfo($this->lng->txt("condition_select_object"));
577
578 $exp = new ilConditionSelector($this, "selector");
579 $exp->setTypeWhiteList(array_merge(
580 $this->getConditionHandler()->getTriggerTypes(),
581 array("root", "cat", "grp", "fold", "crs", "prg")
582 ));
583 //setRefId have to be after setTypeWhiteList!
584 $exp->setRefId($this->getTargetRefId());
585 $exp->setClickableTypes($this->getConditionHandler()->getTriggerTypes());
586
587 if (!$exp->handleCommand()) {
588 $this->tpl->setContent($exp->getHTML());
589 }
590 }
591
592 public function add()
593 {
594 global $ilObjDataCache;
595
596 if (!$_GET['source_id']) {
597 ilUtil::sendFailure("Missing id: condition_id");
598 $this->selector();
599 return false;
600 }
601
602 $this->initFormCondition((int) $_GET['source_id'], 0, 'add');
603 $this->tpl->addBlockfile(
604 'ADM_CONTENT',
605 'adm_content',
606 'tpl.condition_handler_add.html',
607 "Services/AccessControl"
608 );
609 $this->tpl->setVariable('CONDITION_TABLE', $this->form->getHTML());
610 }
611
612
616 public function assign()
617 {
618 if (!isset($_GET['source_id'])) {
619 echo "class.ilConditionHandlerGUI: no source_id given";
620
621 return false;
622 }
623 if (!$_POST['operator']) {
624 ilUtil::sendFailure($this->lng->txt('err_check_input'));
625 $this->add();
626 return false;
627 }
628
629 $this->ch_obj->setTargetRefId($this->getTargetRefId());
630 $this->ch_obj->setTargetObjId($this->getTargetId());
631 $this->ch_obj->setTargetType($this->getTargetType());
632
633 switch ($this->getTargetType()) {
634 case 'st':
635 $this->ch_obj->setReferenceHandlingType($_POST['ref_handling']);
636 break;
637
638 default:
639 $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
640 break;
641 }
642 // this has to be changed, if non referenced trigger are implemted
643 if (!$trigger_obj =&ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'], false)) {
644 echo 'ilConditionHandler: Trigger object does not exist';
645 }
646 $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
647 $this->ch_obj->setTriggerObjId($trigger_obj->getId());
648 $this->ch_obj->setTriggerType($trigger_obj->getType());
649 $this->ch_obj->setOperator($_POST['operator']);
650 $this->ch_obj->setObligatory((int) $_POST['obligatory']);
651 $this->ch_obj->setHiddenStatus(ilConditionHandler::lookupHiddenStatusByTarget($this->getTargetRefId()));
652 $this->ch_obj->setValue('');
653
654 // Save assigned sco's
655 if ($this->ch_obj->getTriggerType() == 'sahs') {
656 include_once 'Services/Object/classes/class.ilObjectLP.php';
657 $olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId());
658 $collection = $olp->getCollectionInstance();
659 if ($collection) {
660 $collection->delete();
661 }
662
663 if (is_array($_POST['item_ids'])) { // #12901
664 $collection->activateEntries($_POST['item_ids']);
665 }
666 }
667
668 $this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
669 if (!$this->ch_obj->storeCondition()) {
670 ilUtil::sendFailure($this->ch_obj->getErrorMessage(), true);
671 } else {
672 ilUtil::sendSuccess($this->lng->txt('added_new_condition'), true);
673 }
674
675 $this->ctrl->redirect($this, 'listConditions');
676
677 return true;
678 }
679
680 public function chi_update()
681 {
682 #if(in_array('',$_POST['operator']))
683 #{
684 # ilUtil::sendInfo($this->lng->txt('select_one_operator'));
685
686 # return false;
687 #}
688 foreach ($this->__getConditionsOfTarget() as $condition) {
689 $this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
690 $this->ch_obj->setValue($_POST['value'][$condition["id"]]);
691 $this->ch_obj->updateCondition($condition['id']);
692 }
693 ilUtil::sendSuccess($this->lng->txt('conditions_updated'));
694
695 $this->ctrl->returnToParent($this);
696
697 return true;
698 }
699 public function __getConditionsOfTarget()
700 {
701 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
702
703 foreach (ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(), $this->getTargetId(), $this->getTargetType()) as $condition) {
704 if ($condition['operator'] == 'not_member') {
705 continue;
706 } else {
707 $cond[] = $condition;
708 }
709 }
710 return $cond ? $cond : array();
711 }
712
720 private function initFormCondition($a_source_id, $a_condition_id = 0, $a_mode = 'add')
721 {
722 $trigger_obj_id = ilObject::_lookupObjId($a_source_id);
723 $trigger_type = ilObject::_lookupType($trigger_obj_id);
724
725 $condition = ilConditionHandler::_getCondition($a_condition_id);
726
727 if (is_object($this->form)) {
728 return true;
729 }
730 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
731 $this->form = new ilPropertyFormGUI();
732 $this->ctrl->setParameter($this, 'source_id', $a_source_id);
733 $this->form->setFormAction($this->ctrl->getFormAction($this));
734
735 $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
736 $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id)));
737 $this->form->addItem($info_source);
738
739 $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
740 $info_target->setValue($this->getTargetTitle());
741 $this->form->addItem($info_target);
742
743 /* moved to list
744 $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory');
745 $obl->setInfo($this->lng->txt('precondition_obligatory_info'));
746 $obl->setValue(1);
747 if($a_condition_id)
748 {
749 $obl->setChecked($condition['obligatory']);
750 }
751 else
752 {
753 $obl->setChecked(true);
754 }
755 $this->form->addItem($obl);
756 */
757 $obl = new ilHiddenInputGUI('obligatory');
758 if ($a_condition_id) {
759 $obl->setValue($condition['obligatory']);
760 } else {
761 $obl->setValue(1);
762 }
763 $this->form->addItem($obl);
764
765 $sel = new ilSelectInputGUI($this->lng->txt('condition'), 'operator');
766 include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
768 if ($a_mode == 'add') {
769 $operators[0] = $this->lng->txt('select_one');
770 }
771 foreach ($ch_obj->getOperatorsByTargetType($trigger_type) as $operator) {
772 $operators[$operator] = $this->lng->txt('condition_' . $operator);
773 }
774 $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0);
775 $sel->setOptions($operators);
776 $sel->setRequired(true);
777 $this->form->addItem($sel);
778
780 $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'), 'ref_handling');
781 $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS);
782
783 $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'), ilConditionHandler::SHARED_CONDITIONS);
784 $rad_opt->addOption($opt2);
785
786 $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'), ilConditionHandler::UNIQUE_CONDITIONS);
787 $rad_opt->addOption($opt1);
788
789 $this->form->addItem($rad_opt);
790 }
791
792 // Additional settings for SCO's
793 if ($trigger_type == 'sahs') {
794 $this->lng->loadLanguageModule('trac');
795
796 $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'), 'item_ids[]');
797 $cus->setRequired(true);
798
799 $tpl = new ilTemplate(
800 'tpl.condition_handler_sco_row.html',
801 true,
802 true,
803 "Services/AccessControl"
804 );
805 $counter = 0;
806
807 include_once 'Services/Object/classes/class.ilObjectLP.php';
808 $olp = ilObjectLP::getInstance($trigger_obj_id);
809 $collection = $olp->getCollectionInstance();
810 if ($collection) {
811 foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
812 $tpl->setCurrentBlock("sco_row");
813 $tpl->setVariable('SCO_ID', $item_id);
814 $tpl->setVariable('SCO_TITLE', $sahs_item['title']);
815 $tpl->setVariable('CHECKED', $collection->isAssignedEntry($item_id) ? 'checked="checked"' : '');
816 $tpl->parseCurrentBlock();
817 $counter++;
818 }
819 }
820 $tpl->setVariable('INFO_SEL', $this->lng->txt('trac_lp_determination_info_sco'));
821 $cus->setHTML($tpl->get());
822 $this->form->addItem($cus);
823 }
824 switch ($a_mode) {
825 case 'edit':
826 $this->form->setTitleIcon(ilUtil::getImagePath('icon_' . $this->getTargetType() . '.svg'));
827 $this->form->setTitle($this->lng->txt('rbac_edit_condition'));
828 $this->form->addCommandButton('updateCondition', $this->lng->txt('save'));
829 $this->form->addCommandButton('listConditions', $this->lng->txt('cancel'));
830 break;
831
832
833 case 'add':
834 $this->form->setTitleIcon(ilUtil::getImagePath('icon_' . $this->getTargetType() . '.svg'));
835 $this->form->setTitle($this->lng->txt('add_condition'));
836 $this->form->addCommandButton('assign', $this->lng->txt('save'));
837 $this->form->addCommandButton('selector', $this->lng->txt('back'));
838 break;
839 }
840 return true;
841 }
842}
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
class ilConditionHandlerGUI
chi_init(&$chi_target_obj, $a_ref_id=null)
setTargetType($a_target_type)
set target type
listConditions()
list conditions @global ilToolbar
isTargetReferenced()
Check if target has refernce id.
saveObligatoryList()
Save obligatory settings.
static translateOperator($a_obj_id, $a_operator)
Translate operator.
__construct($gui_obj, $a_ref_id=null)
Constructor @global <type> $lng @global <type> $tpl @global <type> $tree @global <type> $ilCtrl.
showObligatoryForm($opt=array())
Show obligatory form.
setTargetId($a_target_id)
set target id
saveObligatorySettings()
Save obligatory settings.
initFormCondition($a_source_id, $a_condition_id=0, $a_mode='add')
Init form for condition table.
setTargetTitle($a_target_title)
set target title
assign()
assign new trigger condition to target
getConditionHandler()
Get condition handler.
setTargetRefId($a_target_ref_id)
set target ref id
Table presentation of conditions.
Handles conditions for accesses to different ILIAS objects.
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
static saveNumberOfRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_num)
Save number of obigatory triggers.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static lookupHiddenStatusByTarget($a_target_ref_id)
Lookup hidden status @global type $ilDB.
static _isReferenceHandlingOptional($a_type)
is reference handling optional
static updateObligatory($a_id, $a_status)
Toggle condition obligatory status.
static lookupObligatoryConditionsOfTarget($a_target_ref_id, $a_target_obj_id)
Lookup obligatory conditions of target.
Confirmation screen class.
This class represents a custom property in a property form.
This class represents a hidden form property in a property form.
static _mode2Text($a_mode)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$counter
$h
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
if(empty($password)) $table
Definition: pwgen.php:24
global $ilErr
Definition: raiseError.php:16
if(isset($_POST['submit'])) $form