ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 
23  var $ch_obj;
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  {
178  return $this->target_ref_id;
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  $this->tpl->setVariable('TABLE_CONDITIONS',$table->getHTML());
296  $this->tpl->setContent($table->getHTML());
297  }
298 
302  protected function saveObligatorySettings()
303  {
304  $form = $this->showObligatoryForm();
305  if($form->checkInput())
306  {
307  $old_mode = $form->getInput("old_list_mode");
308  switch($form->getInput("list_mode"))
309  {
310  case "all":
311  if($old_mode != "all")
312  {
313  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
315  $this->getTargetRefId(),
316  $this->getTargetId(),
317  $this->getTargetType()
318  );
319  // Set all optional conditions to obligatory
320  foreach((array) $optional_conditions as $item)
321  {
322  ilConditionHandler::updateObligatory($item["condition_id"], true);
323  }
324  }
325  break;
326 
327  case "subset":
328  $num_req = $form->getInput('required');
329  if($old_mode != "subset")
330  {
332  $this->getTargetRefId(),
333  $this->getTargetId(),
334  $this->getTargetType()
335  );
336  foreach($all_conditions as $item)
337  {
338  ilConditionHandler::updateObligatory($item["condition_id"], false);
339  }
340  $num_req = 1;
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  $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
446  $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
447  $mode->addOption($msubset);
448 
449  $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
450  $obl->setInfo($this->lng->txt('precondition_num_optional_info'));
451  if(count($opt))
452  {
454  $this->getTargetRefId(),
455  $this->getTargetId(),
456  $this->getTargetType()
457  );
458  $min = count($all) - count($opt) + 1;
459  $max = count($all) - 1;
460  }
461  else
462  {
463  $obligatory = $min = $max = 1;
464  }
465  $obl->setValue($obligatory);
466  $obl->setRequired(true);
467  $obl->setSize(1);
468  $obl->setMinValue($min);
469  $obl->setMaxValue($max);
470  $msubset->addSubItem($obl);
471 
472  $old_mode = new ilHiddenInputGUI("old_list_mode");
473  $old_mode->setValue($_REQUEST["list_mode"]);
474  $form->addItem($old_mode);
475 
476  return $form;
477  }
478 
479 
480  function edit()
481  {
482  global $ilObjDataCache;
483 
484  if(!$_GET['condition_id'])
485  {
486  ilUtil::sendFailure("Missing id: condition_id");
487  $this->listConditions();
488  return false;
489  }
490  $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
491 
492  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_edit_condition.html',
493  "Services/AccessControl");
494  $this->ctrl->setParameter($this,'condition_id',(int) $_GET['condition_id']);
495 
496  $this->initFormCondition($condition['trigger_ref_id'],(int) $_GET['condition_id'],'edit');
497  $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
498  }
499 
500  function updateCondition()
501  {
502  global $ilObjDataCache;
503 
504  if(!$_GET['condition_id'])
505  {
506  ilUtil::sendFailure("Missing id: condition_id");
507  $this->listConditions();
508  return false;
509  }
510 
511  // Update condition
512  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
513  $condition_handler = new ilConditionHandler();
514 
515  $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
516  $condition_handler->setOperator($_POST['operator']);
517  $condition_handler->setObligatory((int) $_POST['obligatory']);
518  $condition_handler->setTargetRefId($this->getTargetRefId());
519  $condition_handler->setValue('');
520  switch($this->getTargetType())
521  {
522  case 'st':
523  $condition_handler->setReferenceHandlingType($_POST['ref_handling']);
524  break;
525 
526  default:
527  $condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
528  break;
529  }
530  $condition_handler->updateCondition($condition['id']);
531 
532  // Update relevant sco's
533  if($condition['trigger_type'] == 'sahs')
534  {
535  include_once 'Services/Object/classes/class.ilObjectLP.php';
536  $olp = ilObjectLP::getInstance($condition['trigger_obj_id']);
537  $collection = $olp->getCollectionInstance();
538  if($collection)
539  {
540  $collection->delete();
541  }
542 
543  if(is_array($_POST['item_ids'])) // #12901
544  {
545  $collection->activateEntries($_POST['item_ids']);
546  }
547 
548  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
549  ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
550  }
551 
552  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
553  $this->ctrl->redirect($this,'listConditions');
554  }
555 
556  function askDelete()
557  {
558  global $tpl;
559 
560  if(!count($_POST['conditions']))
561  {
562  ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
563  $this->listConditions();
564  return true;
565  }
566 
567  // display confirmation message
568  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
569  $cgui = new ilConfirmationGUI();
570  $cgui->setFormAction($this->ctrl->getFormAction($this, "listConditions"));
571  $cgui->setHeaderText($this->lng->txt("rbac_condition_delete_sure"));
572  $cgui->setCancel($this->lng->txt("cancel"), "listConditions");
573  $cgui->setConfirm($this->lng->txt("delete"), "delete");
574 
575  // list conditions that should be deleted
576  foreach($_POST['conditions'] as $condition_id)
577  {
578  $condition = ilConditionHandler::_getCondition($condition_id);
579 
580  $title = ilObject::_lookupTitle($condition['trigger_obj_id']).
581  " (".$this->lng->txt("condition").": ".
582  $this->lng->txt('condition_'.$condition['operator']).")";
583  $icon = ilUtil::getImagePath('icon_'.$condition['trigger_type'].'.svg');
584  $alt = $this->lng->txt('obj_'.$condition['trigger_type']);
585 
586  $cgui->addItem("conditions[]", $condition_id, $title, $icon, $alt);
587  }
588 
589  $tpl->setContent($cgui->getHTML());
590  }
591 
592  function delete()
593  {
594  if(!count($_POST['conditions']))
595  {
596  ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
597  $this->listConditions();
598  return true;
599  }
600 
601  foreach($_POST['conditions'] as $condition_id)
602  {
603  $this->ch_obj->deleteCondition($condition_id);
604  }
605  ilUtil::sendSuccess($this->lng->txt('condition_deleted'),true);
606  $this->ctrl->redirect($this,'listConditions');
607 
608  return true;
609  }
610 
611  function selector()
612  {
613  include_once ("./Services/AccessControl/classes/class.ilConditionSelector.php");
614 
615  ilUtil::sendInfo($this->lng->txt("condition_select_object"));
616 
617  $exp = new ilConditionSelector($this, "selector");
618  $exp->setTypeWhiteList(array_merge($this->getConditionHandler()->getTriggerTypes(),
619  array("root", "cat", "grp", "fold", "crs")
620  ));
621  //setRefId have to be after setTypeWhiteList!
622  $exp->setRefId($this->getTargetRefId());
623  $exp->setClickableTypes($this->getConditionHandler()->getTriggerTypes());
624 
625  if (!$exp->handleCommand())
626  {
627  $this->tpl->setContent($exp->getHTML());
628  }
629  }
630 
631  function add()
632  {
633  global $ilObjDataCache;
634 
635  if(!$_GET['source_id'])
636  {
637  ilUtil::sendFailure("Missing id: condition_id");
638  $this->selector();
639  return false;
640  }
641 
642  $this->initFormCondition((int) $_GET['source_id'],0,'add');
643  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_add.html',
644  "Services/AccessControl");
645  $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
646  }
647 
648 
652  function assign()
653  {
654  if(!isset($_GET['source_id']))
655  {
656  echo "class.ilConditionHandlerGUI: no source_id given";
657 
658  return false;
659  }
660  if(!$_POST['operator'])
661  {
662  ilUtil::sendFailure($this->lng->txt('err_check_input'));
663  $this->add();
664  return false;
665  }
666 
667  $this->ch_obj->setTargetRefId($this->getTargetRefId());
668  $this->ch_obj->setTargetObjId($this->getTargetId());
669  $this->ch_obj->setTargetType($this->getTargetType());
670 
671  switch($this->getTargetType())
672  {
673  case 'st':
674  $this->ch_obj->setReferenceHandlingType($_POST['ref_handling']);
675  break;
676 
677  default:
678  $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
679  break;
680  }
681  // this has to be changed, if non referenced trigger are implemted
682  if(!$trigger_obj =& ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'],false))
683  {
684  echo 'ilConditionHandler: Trigger object does not exist';
685  }
686  $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
687  $this->ch_obj->setTriggerObjId($trigger_obj->getId());
688  $this->ch_obj->setTriggerType($trigger_obj->getType());
689  $this->ch_obj->setOperator($_POST['operator']);
690  $this->ch_obj->setObligatory((int) $_POST['obligatory']);
691  $this->ch_obj->setHiddenStatus(ilConditionHandler::lookupHiddenStatusByTarget($this->getTargetRefId()));
692  $this->ch_obj->setValue('');
693 
694  // Save assigned sco's
695  if($this->ch_obj->getTriggerType() == 'sahs')
696  {
697  include_once 'Services/Object/classes/class.ilObjectLP.php';
698  $olp = ilObjectLP::getInstance($this->ch_obj->getTriggerObjId());
699  $collection = $olp->getCollectionInstance();
700  if($collection)
701  {
702  $collection->delete();
703  }
704 
705  if(is_array($_POST['item_ids'])) // #12901
706  {
707  $collection->activateEntries($_POST['item_ids']);
708  }
709  }
710 
711  $this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
712  if(!$this->ch_obj->storeCondition())
713  {
714  ilUtil::sendFailure($this->ch_obj->getErrorMessage(),true);
715  }
716  else
717  {
718  ilUtil::sendSuccess($this->lng->txt('added_new_condition'),true);
719  }
720 
721  $this->ctrl->redirect($this,'listConditions');
722 
723  return true;
724  }
725 
726  function chi_update()
727  {
728  #if(in_array('',$_POST['operator']))
729  #{
730  # ilUtil::sendInfo($this->lng->txt('select_one_operator'));
731 
732  # return false;
733  #}
734  foreach($this->__getConditionsOfTarget() as $condition)
735  {
736  $this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
737  $this->ch_obj->setValue($_POST['value'][$condition["id"]]);
738  $this->ch_obj->updateCondition($condition['id']);
739 
740  }
741  ilUtil::sendSuccess($this->lng->txt('conditions_updated'));
742 
743  $this->ctrl->returnToParent($this);
744 
745  return true;
746  }
748  {
749  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
750 
751  foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(),$this->getTargetId(), $this->getTargetType()) as $condition)
752  {
753  if($condition['operator'] == 'not_member')
754  {
755  continue;
756  }
757  else
758  {
759  $cond[] = $condition;
760  }
761  }
762  return $cond ? $cond : array();
763  }
764 
772  private function initFormCondition($a_source_id,$a_condition_id = 0,$a_mode = 'add')
773  {
774  $trigger_obj_id = ilObject::_lookupObjId($a_source_id);
775  $trigger_type = ilObject::_lookupType($trigger_obj_id);
776 
777  $condition = ilConditionHandler::_getCondition($a_condition_id);
778 
779  if(is_object($this->form))
780  {
781  return true;
782  }
783  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
784  $this->form = new ilPropertyFormGUI();
785  $this->ctrl->setParameter($this,'source_id',$a_source_id);
786  $this->form->setFormAction($this->ctrl->getFormAction($this));
787 
788  $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
789  $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id)));
790  $this->form->addItem($info_source);
791 
792  $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
793  $info_target->setValue($this->getTargetTitle());
794  $this->form->addItem($info_target);
795 
796  /* moved to list
797  $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory');
798  $obl->setInfo($this->lng->txt('precondition_obligatory_info'));
799  $obl->setValue(1);
800  if($a_condition_id)
801  {
802  $obl->setChecked($condition['obligatory']);
803  }
804  else
805  {
806  $obl->setChecked(true);
807  }
808  $this->form->addItem($obl);
809  */
810  $obl = new ilHiddenInputGUI('obligatory');
811  if($a_condition_id)
812  {
813  $obl->setValue($condition['obligatory']);
814  }
815  else
816  {
817  $obl->setValue(1);
818  }
819  $this->form->addItem($obl);
820 
821  $sel = new ilSelectInputGUI($this->lng->txt('condition'),'operator');
822  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
823  $ch_obj = new ilConditionHandler();
824  if($a_mode == 'add')
825  {
826  $operators[0] = $this->lng->txt('select_one');
827  }
828  foreach($ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
829  {
830  $operators[$operator] = $this->lng->txt('condition_'.$operator);
831  }
832  $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0);
833  $sel->setOptions($operators);
834  $sel->setRequired(true);
835  $this->form->addItem($sel);
836 
838  {
839  $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'),'ref_handling');
840  $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS);
841 
842  $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'),ilConditionHandler::SHARED_CONDITIONS);
843  $rad_opt->addOption($opt2);
844 
845  $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'),ilConditionHandler::UNIQUE_CONDITIONS);
846  $rad_opt->addOption($opt1);
847 
848  $this->form->addItem($rad_opt);
849  }
850 
851  // Additional settings for SCO's
852  if($trigger_type == 'sahs')
853  {
854  $this->lng->loadLanguageModule('trac');
855 
856  $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'),'item_ids[]');
857  $cus->setRequired(true);
858 
859  $tpl = new ilTemplate('tpl.condition_handler_sco_row.html',true,true,
860  "Services/AccessControl");
861  $counter = 0;
862 
863  include_once 'Services/Object/classes/class.ilObjectLP.php';
864  $olp = ilObjectLP::getInstance($trigger_obj_id);
865  $collection = $olp->getCollectionInstance();
866  if($collection)
867  {
868  foreach($collection->getPossibleItems() as $item_id => $sahs_item)
869  {
870  $tpl->setCurrentBlock("sco_row");
871  $tpl->setVariable('SCO_ID',$item_id);
872  $tpl->setVariable('SCO_TITLE',$sahs_item['title']);
873  $tpl->setVariable('CHECKED',$collection->isAssignedEntry($item_id) ? 'checked="checked"' : '');
874  $tpl->parseCurrentBlock();
875  $counter++;
876  }
877  }
878  $tpl->setVariable('INFO_SEL',$this->lng->txt('trac_lp_determination_info_sco'));
879  $cus->setHTML($tpl->get());
880  $this->form->addItem($cus);
881  }
882  switch($a_mode)
883  {
884  case 'edit':
885  $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.svg'));
886  $this->form->setTitle($this->lng->txt('rbac_edit_condition'));
887  $this->form->addCommandButton('updateCondition',$this->lng->txt('save'));
888  $this->form->addCommandButton('listConditions',$this->lng->txt('cancel'));
889  break;
890 
891 
892  case 'add':
893  $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.svg'));
894  $this->form->setTitle($this->lng->txt('add_condition'));
895  $this->form->addCommandButton('assign',$this->lng->txt('save'));
896  $this->form->addCommandButton('selector',$this->lng->txt('back'));
897  break;
898  }
899  return true;
900  }
901 }
902 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
listConditions()
list conditions ilToolbar
This class represents an option in a radio group.
class ilConditionHandlerGUI
static saveNumberOfRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_num)
Save number of obigatory triggers.
$_POST['username']
Definition: cron.php:12
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
This class represents a property form user interface.
$_GET["client_id"]
static lookupHiddenStatusByTarget($a_target_ref_id)
Lookup hidden status type $ilDB.
static translateOperator($a_obj_id, $a_operator)
Translate operator.
$cmd
Definition: sahs_server.php:35
initFormCondition($a_source_id, $a_condition_id=0, $a_mode='add')
Init form for condition table.
setTargetId($a_target_id)
set target id
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
assign()
assign new trigger condition to target
setInfo($a_info)
Set Info.
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setChecked($a_checked)
Set Checked.
This class represents a hidden form property in a property form.
__construct($gui_obj, $a_ref_id=null)
Constructor <type> $lng <type> $tpl <type> $tree <type> $ilCtrl.
This class represents a property in a property form.
setTargetRefId($a_target_ref_id)
set target ref id
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
getConditionHandler()
Get condition handler.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
Table presentation of conditions.
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
setTargetTitle($a_target_title)
set target title
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Handles conditions for accesses to different ILIAS objects.
saveObligatorySettings()
Save obligatory settings.
This class represents a custom property in a property form.
static _isReferenceHandlingOptional($a_type)
is reference handling optional
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
saveObligatoryList()
Save obligatory settings.
This class represents a non editable value in a property form.
static updateObligatory($a_id, $a_status)
Toggle condition obligatory status.
chi_init(&$chi_target_obj, $a_ref_id=null)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
setTargetType($a_target_type)
set target type
isTargetReferenced()
Check if target has refernce id.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
static getInstance($a_obj_id)
showObligatoryForm($opt=array())
Show obligatory form.
setRequired($a_required)
Set Required.
Confirmation screen class.
static _mode2Text($a_mode)