ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 var $ctrl = null;
18
19 var $lng;
20 var $tpl;
21 var $tree;
22
30
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 {
59 $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
60 }
61 else
62 {
63 $this->target_obj =& $this->gui_obj->object;
64 }
65
66 // this only works for ilObject derived objects (other objects
67 // should call set() methods manually
68 if (is_object($this->target_obj))
69 {
70 $this->setTargetId($this->target_obj->getId());
71 $this->setTargetRefId($this->target_obj->getRefId());
72 $this->setTargetType($this->target_obj->getType());
73 $this->setTargetTitle($this->target_obj->getTitle());
74 }
75 }
76
81 public static function translateOperator($a_obj_id, $a_operator)
82 {
83 switch($a_operator)
84 {
86 $GLOBALS['lng']->loadLanguageModule('trac');
87 include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
88 $obj_settings = new ilLPObjSettings($a_obj_id);
89 return ilLPObjSettings::_mode2Text($obj_settings->getMode());
90
91 default:
92 $GLOBALS['lng']->loadLanguageModule('rbac');
93 return $GLOBALS['lng']->txt('condition_'.$a_operator);
94 }
95 }
96
101 protected function getConditionHandler()
102 {
103 return $this->ch_obj;
104 }
105
106 function setBackButtons($a_btn_arr)
107 {
108 $_SESSION['precon_btn'] = $a_btn_arr;
109 }
110 function getBackButtons()
111 {
112 return $_SESSION['precon_btn'] ? $_SESSION['precon_btn'] : array();
113 }
114
115 public function executeCommand()
116 {
117 global $ilErr, $ilAccess, $lng;
118
119 if(!$ilAccess->checkAccess('write','',$this->getTargetRefId()))
120 {
121 $ilErr->raiseError($lng->txt('permission_denied'),$ilErr->WARNING);
122 }
123
124 $next_class = $this->ctrl->getNextClass($this);
125 $cmd = $this->ctrl->getCmd();
126
127 switch ($next_class)
128 {
129 default:
130 if (empty($cmd))
131 {
132 $cmd = "view";
133 }
134 $this->$cmd();
135 break;
136 }
137 }
138
139 function setAutomaticValidation($a_status)
140 {
141 $this->automatic_validation = $a_status;
142 }
144 {
146 }
147
148
152 function setTargetId($a_target_id)
153 {
154 $this->target_id = $a_target_id;
155 }
156
160 function getTargetId()
161 {
162 return $this->target_id;
163 }
164
168 function setTargetRefId($a_target_ref_id)
169 {
170 $this->target_ref_id = $a_target_ref_id;
171 }
172
176 function getTargetRefId()
177 {
179 }
180
184 function setTargetType($a_target_type)
185 {
186 $this->target_type = $a_target_type;
187 }
188
192 function getTargetType()
193 {
194 return $this->target_type;
195 }
196
200 function setTargetTitle($a_target_title)
201 {
202 $this->target_title = $a_target_title;
203 }
204
209 public function isTargetReferenced()
210 {
211 return $this->getTargetRefId() ? true : false;
212 }
213
217 function getTargetTitle()
218 {
219 return $this->target_title;
220 }
221
222 function chi_init(&$chi_target_obj,$a_ref_id = null)
223 {
224 echo 'deprecated';
225
226 include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
227
228 $this->ch_obj = new ilConditionHandler();
229
230 if($a_ref_id)
231 {
232 $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
233 }
234 else
235 {
236 $this->target_obj =& $this->object;
237 }
238
239 return true;
240 }
241
246 protected function listConditions()
247 {
248 global $ilToolbar;
249
250 $ilToolbar->addButton($this->lng->txt('add_condition'),$this->ctrl->getLinkTarget($this,'selector'));
251
252 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.list_conditions.html','Services/AccessControl');
253
255 $this->getTargetRefId(),
256 $this->getTargetId(),
257 $this->getTargetType()
258 );
259 if(count($optional_conditions))
260 {
261 if(!$_REQUEST["list_mode"])
262 {
263 $_REQUEST["list_mode"] = "subset";
264 }
265 }
266 else if(!$_REQUEST["list_mode"])
267 {
268 $_REQUEST["list_mode"] = "all";
269 }
270
271 // Show form only if conditions are availabe
273 $this->getTargetRefId(),
274 $this->getTargetId(),
275 $this->getTargetType()))
276 )
277 {
278 $form = $this->showObligatoryForm($optional_conditions);
279 if($form instanceof ilPropertyFormGUI)
280 {
281 $this->tpl->setVariable('TABLE_SETTINGS',$form->getHTML());
282 }
283 }
284
285 include_once './Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
286 $table = new ilConditionHandlerTableGUI($this,'listConditions', ($_REQUEST["list_mode"] != "all"));
287 $table->setConditions(
289 $this->getTargetRefId(),
290 $this->getTargetId(),
291 $this->getTargetType()
292 )
293 );
294
295 $h = $table->getHTML();
296 $this->tpl->setVariable('TABLE_CONDITIONS',$h);
297 //$this->tpl->setContent($h);
298 }
299
303 protected function saveObligatorySettings()
304 {
305 $form = $this->showObligatoryForm();
306 if($form->checkInput())
307 {
308 $old_mode = $form->getInput("old_list_mode");
309 switch($form->getInput("list_mode"))
310 {
311 case "all":
312 if($old_mode != "all")
313 {
314 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
316 $this->getTargetRefId(),
317 $this->getTargetId(),
318 $this->getTargetType()
319 );
320 // Set all optional conditions to obligatory
321 foreach((array) $optional_conditions as $item)
322 {
323 ilConditionHandler::updateObligatory($item["condition_id"], true);
324 }
325 }
326 break;
327
328 case "subset":
329 $num_req = $form->getInput('required');
330 if($old_mode != "subset")
331 {
333 $this->getTargetRefId(),
334 $this->getTargetId(),
335 $this->getTargetType()
336 );
337 foreach($all_conditions as $item)
338 {
339 ilConditionHandler::updateObligatory($item["condition_id"], false);
340 }
341 }
343 $this->getTargetRefId(),
344 $this->getTargetId(),
345 $num_req
346 );
347 break;
348 }
349
350 $cond = new ilConditionHandler();
351 $cond->setTargetRefId($this->getTargetRefId());
352 $cond->updateHiddenStatus((int) $form->getInput('hidden'));
353
354 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
355 $this->ctrl->redirect($this,'listConditions');
356 }
357
358 $form->setValuesByPost();
359 ilUtil::sendFailure($this->lng->txt('err_check_input'));
360 $this->tpl->setContent($form->getHTML());
361 }
362
366 protected function saveObligatoryList()
367 {
369 $this->getTargetRefId(),
370 $this->getTargetId(),
371 $this->getTargetType()
372 );
373
374 if($_POST["obl"] && sizeof($_POST["obl"]) > sizeof($all_conditions)-2)
375 {
376 ilUtil::sendFailure($this->lng->txt("rbac_precondition_minimum_optional"), true);
377 $this->ctrl->redirect($this,'listConditions');
378 }
379
380 foreach($all_conditions as $item)
381 {
382 $status = false;
383 if($_POST["obl"] && in_array($item["condition_id"], $_POST["obl"]))
384 {
385 $status = true;
386 }
387 ilConditionHandler::updateObligatory($item["condition_id"], $status);
388 }
389
390 // re-calculate
392 $this->getTargetRefId(),
393 $this->getTargetId(),
394 $this->getTargetType(),
395 true
396 );
397
398 ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
399 $this->ctrl->redirect($this,'listConditions');
400 }
401
406 protected function showObligatoryForm($opt = array())
407 {
408 if(!$GLOBALS['objDefinition']->isRbacObject($this->getTargetType()))
409 {
410 return;
411 }
412
413
414 if(!$opt)
415 {
417 $this->getTargetRefId(),
418 $this->getTargetId(),
419 $this->getTargetType()
420 );
421 }
422
424
425 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
426 $form = new ilPropertyFormGUI();
427 $form->setFormAction($this->ctrl->getFormAction($this),'listConditions');
428 $form->setTitle($this->lng->txt('precondition_obligatory_settings'));
429 $form->addCommandButton('saveObligatorySettings', $this->lng->txt('save'));
430
431 $hide = new ilCheckboxInputGUI($this->lng->txt('rbac_precondition_hide'),'hidden');
433 $hide->setValue(1);
434 $hide->setInfo($this->lng->txt('rbac_precondition_hide_info'));
435 $form->addItem($hide);
436
437 $mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode");
438 $form->addItem($mode);
439 $mode->setValue($_REQUEST["list_mode"]);
440
441 $mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all");
442 $mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info"));
443 $mode->addOption($mall);
444
445
446 if(count($all) > 1)
447 {
448 $min = 1;
449 $max = count($all) - 1;
450
451 $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
452 $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
453 $mode->addOption($msubset);
454
455 $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
456 $obl->setInfo($this->lng->txt('precondition_num_optional_info'));
457
459 $obl->setValue($num_required > 0 ? $num_required : null);
460 $obl->setRequired(true);
461 $obl->setSize(1);
462 $obl->setMinValue($min);
463 $obl->setMaxValue($max);
464 $msubset->addSubItem($obl);
465 }
466
467 $old_mode = new ilHiddenInputGUI("old_list_mode");
468 $old_mode->setValue($_REQUEST["list_mode"]);
469 $form->addItem($old_mode);
470
471 return $form;
472 }
473
474
475 function edit()
476 {
477 global $ilObjDataCache;
478
479 if(!$_GET['condition_id'])
480 {
481 ilUtil::sendFailure("Missing id: condition_id");
482 $this->listConditions();
483 return false;
484 }
485 $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
486
487 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_edit_condition.html',
488 "Services/AccessControl");
489 $this->ctrl->setParameter($this,'condition_id',(int) $_GET['condition_id']);
490
491 $this->initFormCondition($condition['trigger_ref_id'],(int) $_GET['condition_id'],'edit');
492 $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
493 }
494
496 {
497 global $ilObjDataCache;
498
499 if(!$_GET['condition_id'])
500 {
501 ilUtil::sendFailure("Missing id: condition_id");
502 $this->listConditions();
503 return false;
504 }
505
506 // Update condition
507 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
508 $condition_handler = new ilConditionHandler();
509
510 $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
511 $condition_handler->setOperator($_POST['operator']);
512 $condition_handler->setObligatory((int) $_POST['obligatory']);
513 $condition_handler->setTargetRefId($this->getTargetRefId());
514 $condition_handler->setValue('');
515 switch($this->getTargetType())
516 {
517 case 'st':
518 $condition_handler->setReferenceHandlingType($_POST['ref_handling']);
519 break;
520
521 default:
522 $condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
523 break;
524 }
525 $condition_handler->updateCondition($condition['id']);
526
527 // Update relevant sco's
528 if($condition['trigger_type'] == 'sahs')
529 {
530 include_once 'Services/Object/classes/class.ilObjectLP.php';
531 $olp = ilObjectLP::getInstance($condition['trigger_obj_id']);
532 $collection = $olp->getCollectionInstance();
533 if($collection)
534 {
535 $collection->delete();
536 }
537
538 if(is_array($_POST['item_ids'])) // #12901
539 {
540 $collection->activateEntries($_POST['item_ids']);
541 }
542
543 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
544 ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
545 }
546
547 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
548 $this->ctrl->redirect($this,'listConditions');
549 }
550
551 function askDelete()
552 {
553 global $tpl;
554
555 if(!count($_POST['conditions']))
556 {
557 ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
558 $this->listConditions();
559 return true;
560 }
561
562 // display confirmation message
563 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
564 $cgui = new ilConfirmationGUI();
565 $cgui->setFormAction($this->ctrl->getFormAction($this, "listConditions"));
566 $cgui->setHeaderText($this->lng->txt("rbac_condition_delete_sure"));
567 $cgui->setCancel($this->lng->txt("cancel"), "listConditions");
568 $cgui->setConfirm($this->lng->txt("delete"), "delete");
569
570 // list conditions that should be deleted
571 foreach($_POST['conditions'] as $condition_id)
572 {
573 $condition = ilConditionHandler::_getCondition($condition_id);
574
575 $title = ilObject::_lookupTitle($condition['trigger_obj_id']).
576 " (".$this->lng->txt("condition").": ".
577 $this->lng->txt('condition_'.$condition['operator']).")";
578 $icon = ilUtil::getImagePath('icon_'.$condition['trigger_type'].'.svg');
579 $alt = $this->lng->txt('obj_'.$condition['trigger_type']);
580
581 $cgui->addItem("conditions[]", $condition_id, $title, $icon, $alt);
582 }
583
584 $tpl->setContent($cgui->getHTML());
585 }
586
587 function delete()
588 {
589 if(!count($_POST['conditions']))
590 {
591 ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
592 $this->listConditions();
593 return true;
594 }
595
596 foreach($_POST['conditions'] as $condition_id)
597 {
598 $this->ch_obj->deleteCondition($condition_id);
599 }
600 ilUtil::sendSuccess($this->lng->txt('condition_deleted'),true);
601 $this->ctrl->redirect($this,'listConditions');
602
603 return true;
604 }
605
606 function selector()
607 {
608 include_once ("./Services/AccessControl/classes/class.ilConditionSelector.php");
609
610 ilUtil::sendInfo($this->lng->txt("condition_select_object"));
611
612 $exp = new ilConditionSelector($this, "selector");
613 $exp->setTypeWhiteList(array_merge($this->getConditionHandler()->getTriggerTypes(),
614 array("root", "cat", "grp", "fold", "crs")
615 ));
616 //setRefId have to be after setTypeWhiteList!
617 $exp->setRefId($this->getTargetRefId());
618 $exp->setClickableTypes($this->getConditionHandler()->getTriggerTypes());
619
620 if (!$exp->handleCommand())
621 {
622 $this->tpl->setContent($exp->getHTML());
623 }
624 }
625
626 function add()
627 {
628 global $ilObjDataCache;
629
630 if(!$_GET['source_id'])
631 {
632 ilUtil::sendFailure("Missing id: condition_id");
633 $this->selector();
634 return false;
635 }
636
637 $this->initFormCondition((int) $_GET['source_id'],0,'add');
638 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_add.html',
639 "Services/AccessControl");
640 $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
641 }
642
643
647 function assign()
648 {
649 if(!isset($_GET['source_id']))
650 {
651 echo "class.ilConditionHandlerGUI: no source_id given";
652
653 return false;
654 }
655 if(!$_POST['operator'])
656 {
657 ilUtil::sendFailure($this->lng->txt('err_check_input'));
658 $this->add();
659 return false;
660 }
661
662 $this->ch_obj->setTargetRefId($this->getTargetRefId());
663 $this->ch_obj->setTargetObjId($this->getTargetId());
664 $this->ch_obj->setTargetType($this->getTargetType());
665
666 switch($this->getTargetType())
667 {
668 case 'st':
669 $this->ch_obj->setReferenceHandlingType($_POST['ref_handling']);
670 break;
671
672 default:
673 $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
674 break;
675 }
676 // this has to be changed, if non referenced trigger are implemted
677 if(!$trigger_obj =& ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'],false))
678 {
679 echo 'ilConditionHandler: Trigger object does not exist';
680 }
681 $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
682 $this->ch_obj->setTriggerObjId($trigger_obj->getId());
683 $this->ch_obj->setTriggerType($trigger_obj->getType());
684 $this->ch_obj->setOperator($_POST['operator']);
685 $this->ch_obj->setObligatory((int) $_POST['obligatory']);
686 $this->ch_obj->setHiddenStatus(ilConditionHandler::lookupHiddenStatusByTarget($this->getTargetRefId()));
687 $this->ch_obj->setValue('');
688
689 // Save assigned sco's
690 if($this->ch_obj->getTriggerType() == 'sahs')
691 {
692 include_once 'Services/Object/classes/class.ilObjectLP.php';
693 $olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId());
694 $collection = $olp->getCollectionInstance();
695 if($collection)
696 {
697 $collection->delete();
698 }
699
700 if(is_array($_POST['item_ids'])) // #12901
701 {
702 $collection->activateEntries($_POST['item_ids']);
703 }
704 }
705
706 $this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
707 if(!$this->ch_obj->storeCondition())
708 {
709 ilUtil::sendFailure($this->ch_obj->getErrorMessage(),true);
710 }
711 else
712 {
713 ilUtil::sendSuccess($this->lng->txt('added_new_condition'),true);
714 }
715
716 $this->ctrl->redirect($this,'listConditions');
717
718 return true;
719 }
720
721 function chi_update()
722 {
723 #if(in_array('',$_POST['operator']))
724 #{
725 # ilUtil::sendInfo($this->lng->txt('select_one_operator'));
726
727 # return false;
728 #}
729 foreach($this->__getConditionsOfTarget() as $condition)
730 {
731 $this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
732 $this->ch_obj->setValue($_POST['value'][$condition["id"]]);
733 $this->ch_obj->updateCondition($condition['id']);
734
735 }
736 ilUtil::sendSuccess($this->lng->txt('conditions_updated'));
737
738 $this->ctrl->returnToParent($this);
739
740 return true;
741 }
743 {
744 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
745
746 foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(),$this->getTargetId(), $this->getTargetType()) as $condition)
747 {
748 if($condition['operator'] == 'not_member')
749 {
750 continue;
751 }
752 else
753 {
754 $cond[] = $condition;
755 }
756 }
757 return $cond ? $cond : array();
758 }
759
767 private function initFormCondition($a_source_id,$a_condition_id = 0,$a_mode = 'add')
768 {
769 $trigger_obj_id = ilObject::_lookupObjId($a_source_id);
770 $trigger_type = ilObject::_lookupType($trigger_obj_id);
771
772 $condition = ilConditionHandler::_getCondition($a_condition_id);
773
774 if(is_object($this->form))
775 {
776 return true;
777 }
778 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
779 $this->form = new ilPropertyFormGUI();
780 $this->ctrl->setParameter($this,'source_id',$a_source_id);
781 $this->form->setFormAction($this->ctrl->getFormAction($this));
782
783 $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
784 $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id)));
785 $this->form->addItem($info_source);
786
787 $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
788 $info_target->setValue($this->getTargetTitle());
789 $this->form->addItem($info_target);
790
791 /* moved to list
792 $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory');
793 $obl->setInfo($this->lng->txt('precondition_obligatory_info'));
794 $obl->setValue(1);
795 if($a_condition_id)
796 {
797 $obl->setChecked($condition['obligatory']);
798 }
799 else
800 {
801 $obl->setChecked(true);
802 }
803 $this->form->addItem($obl);
804 */
805 $obl = new ilHiddenInputGUI('obligatory');
806 if($a_condition_id)
807 {
808 $obl->setValue($condition['obligatory']);
809 }
810 else
811 {
812 $obl->setValue(1);
813 }
814 $this->form->addItem($obl);
815
816 $sel = new ilSelectInputGUI($this->lng->txt('condition'),'operator');
817 include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
819 if($a_mode == 'add')
820 {
821 $operators[0] = $this->lng->txt('select_one');
822 }
823 foreach($ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
824 {
825 $operators[$operator] = $this->lng->txt('condition_'.$operator);
826 }
827 $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0);
828 $sel->setOptions($operators);
829 $sel->setRequired(true);
830 $this->form->addItem($sel);
831
833 {
834 $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'),'ref_handling');
835 $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS);
836
837 $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'),ilConditionHandler::SHARED_CONDITIONS);
838 $rad_opt->addOption($opt2);
839
840 $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'),ilConditionHandler::UNIQUE_CONDITIONS);
841 $rad_opt->addOption($opt1);
842
843 $this->form->addItem($rad_opt);
844 }
845
846 // Additional settings for SCO's
847 if($trigger_type == 'sahs')
848 {
849 $this->lng->loadLanguageModule('trac');
850
851 $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'),'item_ids[]');
852 $cus->setRequired(true);
853
854 $tpl = new ilTemplate('tpl.condition_handler_sco_row.html',true,true,
855 "Services/AccessControl");
856 $counter = 0;
857
858 include_once 'Services/Object/classes/class.ilObjectLP.php';
859 $olp = ilObjectLP::getInstance($trigger_obj_id);
860 $collection = $olp->getCollectionInstance();
861 if($collection)
862 {
863 foreach($collection->getPossibleItems() as $item_id => $sahs_item)
864 {
865 $tpl->setCurrentBlock("sco_row");
866 $tpl->setVariable('SCO_ID',$item_id);
867 $tpl->setVariable('SCO_TITLE',$sahs_item['title']);
868 $tpl->setVariable('CHECKED',$collection->isAssignedEntry($item_id) ? 'checked="checked"' : '');
869 $tpl->parseCurrentBlock();
870 $counter++;
871 }
872 }
873 $tpl->setVariable('INFO_SEL',$this->lng->txt('trac_lp_determination_info_sco'));
874 $cus->setHTML($tpl->get());
875 $this->form->addItem($cus);
876 }
877 switch($a_mode)
878 {
879 case 'edit':
880 $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.svg'));
881 $this->form->setTitle($this->lng->txt('rbac_edit_condition'));
882 $this->form->addCommandButton('updateCondition',$this->lng->txt('save'));
883 $this->form->addCommandButton('listConditions',$this->lng->txt('cancel'));
884 break;
885
886
887 case 'add':
888 $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.svg'));
889 $this->form->setTitle($this->lng->txt('add_condition'));
890 $this->form->addCommandButton('assign',$this->lng->txt('save'));
891 $this->form->addCommandButton('selector',$this->lng->txt('back'));
892 break;
893 }
894 return true;
895 }
896}
897?>
$_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
global $ilErr
Definition: raiseError.php:16
$cmd
Definition: sahs_server.php:35