46                 include_once 
"./Services/AccessControl/classes/class.ilConditionHandler.php";
 
   51                 $this->gui_obj =& $gui_obj;
 
   53                 $this->lng->loadLanguageModule(
'rbac');
 
   63                         $this->target_obj =& $this->gui_obj->object;
 
   68                 if (is_object($this->target_obj))
 
   90                 if(!$ilAccess->checkAccess(
'write',
'',$this->getTargetRefId()))
 
   92                         $ilErr->raiseError($lng->txt(
'permission_denied'),$ilErr->WARNING);
 
   95                 $next_class = $this->ctrl->getNextClass($this);
 
   96                 $cmd = $this->ctrl->getCmd();
 
  112                 $this->automatic_validation = $a_status;
 
  125                 $this->target_id = $a_target_id;
 
  141                 $this->target_ref_id = $a_target_ref_id;
 
  157                 $this->target_type = $a_target_type;
 
  173                 $this->target_title = $a_target_title;
 
  193         function chi_init(&$chi_target_obj,$a_ref_id = null)
 
  197                 include_once 
"./Services/AccessControl/classes/class.ilConditionHandler.php";
 
  207                         $this->target_obj =& $this->object;
 
  221                 $ilToolbar->addButton($this->lng->txt(
'add_condition'),$this->ctrl->getLinkTarget($this,
'selector'));
 
  223                 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.list_conditions.html',
'Services/AccessControl');
 
  230                 if(count($optional_conditions))
 
  242                 $this->tpl->setVariable(
'TABLE_SETTINGS',$form->getHTML());
 
  244                 include_once 
'./Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
 
  246                 $table->setConditions(
 
  254                 $this->tpl->setVariable(
'TABLE_CONDITIONS',$table->getHTML());
 
  255                 $this->tpl->setContent($table->getHTML());
 
  264                 if($form->checkInput())
 
  266                         $old_mode = $form->getInput(
"old_list_mode");
 
  267                         switch($form->getInput(
"list_mode"))
 
  270                                         if($old_mode != 
"all")
 
  272                                                 include_once 
'./Services/AccessControl/classes/class.ilConditionHandler.php';
 
  278                                                 if(
sizeof($optional_conditions) > 1)
 
  281                                                         foreach($optional_conditions as $item)
 
  290                                         $num_req = $form->getInput(
'required');
 
  291                                         if($old_mode != 
"subset")
 
  298                                                 foreach($all_conditions as $item)
 
  313                         $this->ctrl->redirect($this,
'listConditions');
 
  316                 $form->setValuesByPost();
 
  318                 $this->tpl->setContent($form->getHTML());
 
  332                 if(
$_POST[
"obl"] && 
sizeof(
$_POST[
"obl"]) > 
sizeof($all_conditions)-2)
 
  335                         $this->ctrl->redirect($this,
'listConditions');
 
  338                 foreach($all_conditions as $item)
 
  341                         if(
$_POST[
"obl"] && in_array($item[
"condition_id"], 
$_POST[
"obl"]))
 
  357                 $this->ctrl->redirect($this,
'listConditions');
 
  377                 include_once 
'./Services/Form/classes/class.ilPropertyFormGUI.php';
 
  379                 $form->setFormAction($this->ctrl->getFormAction($this),
'listConditions');
 
  380                 $form->setTitle($this->lng->txt(
'precondition_obligatory_settings'));
 
  381                 $form->addCommandButton(
'saveObligatorySettings', $this->lng->txt(
'save'));
 
  384                 $form->addItem($mode);
 
  387                 $mall = 
new ilRadioOption($this->lng->txt(
"rbac_precondition_mode_all"), 
"all");
 
  388                 $mall->
setInfo($this->lng->txt(
"rbac_precondition_mode_all_info"));
 
  389                 $mode->addOption($mall);
 
  391                 $msubset = 
new ilRadioOption($this->lng->txt(
"rbac_precondition_mode_subset"), 
"subset");
 
  392                 $msubset->
setInfo($this->lng->txt(
"rbac_precondition_mode_subset_info"));
 
  393                 $mode->addOption($msubset);
 
  395                 $obl = 
new ilNumberInputGUI($this->lng->txt(
'precondition_num_obligatory'), 
'required');
 
  396                 $obl->
setInfo($this->lng->txt(
'precondition_num_optional_info'));
 
  404                         $min = count($all) - count($opt) + 1;
 
  405                         $max = count($all) - 1;
 
  409                         $obligatory = $min = $max = 1;
 
  411                 $obl->setValue($obligatory);
 
  412                 $obl->setRequired(
true);
 
  414                 $obl->setMinValue($min);
 
  415                 $obl->setMaxValue($max);
 
  416                 $msubset->addSubItem($obl);
 
  419                 $old_mode->setValue(
$_REQUEST[
"list_mode"]);
 
  420                 $form->addItem($old_mode);
 
  428                 global $ilObjDataCache;
 
  430                 if(!
$_GET[
'condition_id'])
 
  438                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.condition_handler_edit_condition.html',
 
  439                         "Services/AccessControl");
 
  440                 $this->ctrl->setParameter($this,
'condition_id',(
int) $_GET[
'condition_id']);
 
  442                 $this->
initFormCondition($condition[
'trigger_ref_id'],(
int) $_GET[
'condition_id'],
'edit');
 
  443                 $this->tpl->setVariable(
'CONDITION_TABLE',$this->form->getHTML());
 
  448                 global $ilObjDataCache;
 
  450                 if(!
$_GET[
'condition_id'])
 
  458                 include_once 
'./Services/AccessControl/classes/class.ilConditionHandler.php';
 
  462                 $condition_handler->setOperator(
$_POST[
'operator']);
 
  463                 $condition_handler->setObligatory((
int) 
$_POST[
'obligatory']);
 
  465                 $condition_handler->setValue(
'');
 
  469                                 $condition_handler->setReferenceHandlingType($_POST[
'ref_handling']);
 
  476                 $condition_handler->updateCondition($condition[
'id']);
 
  479                 if($condition[
'trigger_type'] == 
'sahs')
 
  481                         include_once 
'Services/Tracking/classes/class.ilLPCollections.php';
 
  483                         $lp_collection->deleteAll();
 
  485                         $items = is_array($_POST[
'item_ids']) ? $_POST[
'item_ids'] : array();
 
  486                         foreach($items as $item_id)
 
  488                                 $lp_collection->add($item_id);
 
  491                         include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
 
  496                 $this->ctrl->redirect($this,
'listConditions');
 
  503                 if(!count(
$_POST[
'conditions']))
 
  511                 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  513                 $cgui->setFormAction($this->ctrl->getFormAction($this, 
"listConditions"));
 
  514                 $cgui->setHeaderText($this->lng->txt(
"rbac_condition_delete_sure"));
 
  515                 $cgui->setCancel($this->lng->txt(
"cancel"), 
"listConditions");
 
  516                 $cgui->setConfirm($this->lng->txt(
"delete"), 
"delete");
 
  519                 foreach(
$_POST[
'conditions'] as $condition_id)
 
  524                                 " (".$this->lng->txt(
"condition").
": ".
 
  525                                 $this->lng->txt(
'condition_'.$condition[
'operator']).
")";                       
 
  527                         $alt = $this->lng->txt(
'obj_'.$condition[
'trigger_type']);
 
  529                         $cgui->addItem(
"conditions[]", $condition_id, 
$title, $icon, $alt);
 
  532                 $tpl->setContent($cgui->getHTML());
 
  537                 if(!count(
$_POST[
'conditions']))
 
  544                 foreach(
$_POST[
'conditions'] as $condition_id)
 
  546                         $this->ch_obj->deleteCondition($condition_id);
 
  549                 $this->ctrl->redirect($this,
'listConditions');
 
  558                 include_once (
"./Services/AccessControl/classes/class.ilConditionSelector.php");
 
  560                 $this->tpl->addBlockFile(
'ADM_CONTENT', 
"adm_content", 
"tpl.condition_selector.html",
 
  561                         "Services/AccessControl");
 
  566                 $exp->
setExpand(
$_GET[
"condition_selector_expand"] ? 
$_GET[
"condition_selector_expand"] : $this->tree->readRootId());
 
  567                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'selector'));
 
  568                 $exp->setTargetGet(
"ref_id");
 
  575                         $exp->setForceOpenPath(
$path);
 
  578                 $exp->addFilter(
'crs');
 
  579                 $exp->addFilter(
'tst');
 
  580                 $exp->addFilter(
'sahs');
 
  581                 $exp->addFilter(
'svy');
 
  583                 $exp->setSelectableTypes($this->ch_obj->getTriggerTypes());
 
  584                 $exp->setControlClass($this);
 
  588                 $this->tpl->setCurrentBlock(
"adm_content");
 
  589                 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
 
  590                 $this->tpl->parseCurrentBlock();
 
  595                 global $ilObjDataCache;
 
  597                 if(!
$_GET[
'source_id'])
 
  605                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.condition_handler_add.html',
 
  606                         "Services/AccessControl");
 
  607                 $this->tpl->setVariable(
'CONDITION_TABLE',$this->form->getHTML());              
 
  616                 if(!isset(
$_GET[
'source_id']))
 
  618                         echo 
"class.ilConditionHandlerInterface: no source_id given";
 
  630                 $this->ch_obj->setTargetObjId($this->
getTargetId());
 
  636                                 $this->ch_obj->setReferenceHandlingType(
$_POST[
'ref_handling']);
 
  646                         echo 
'ilConditionHandler: Trigger object does not exist';
 
  648                 $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
 
  649                 $this->ch_obj->setTriggerObjId($trigger_obj->getId());
 
  650                 $this->ch_obj->setTriggerType($trigger_obj->getType());
 
  651                 $this->ch_obj->setOperator(
$_POST[
'operator']);
 
  652                 $this->ch_obj->setObligatory((
int) 
$_POST[
'obligatory']);
 
  653                 $this->ch_obj->setValue(
'');
 
  656                 if($this->ch_obj->getTriggerType() == 
'sahs')
 
  658                         include_once 
'Services/Tracking/classes/class.ilLPCollections.php';
 
  659                         $lp_collection = 
new ilLPCollections($this->ch_obj->getTriggerObjId());
 
  662                         $items = is_array($_POST[
'item_ids']) ? $_POST[
'item_ids'] : array();
 
  663                         foreach($items as $item_id)
 
  665                                 $lp_collection->add($item_id);
 
  670                 if(!$this->ch_obj->storeCondition())
 
  679                 $this->ctrl->redirect($this,
'listConditions');
 
  686                 #if(in_array('',$_POST['operator'])) 
  688                 #       ilUtil::sendInfo($this->lng->txt('select_one_operator')); 
  694                         $this->ch_obj->setOperator(
$_POST[
'operator'][$condition[
"id"]]);
 
  695                         $this->ch_obj->setValue(
$_POST[
'value'][$condition[
"id"]]);
 
  696                         $this->ch_obj->updateCondition($condition[
'id']);
 
  701                 $this->ctrl->returnToParent($this);
 
  707                 include_once 
'./Services/AccessControl/classes/class.ilConditionHandler.php';
 
  711                         if($condition[
'operator'] == 
'not_member')
 
  717                                 $cond[] = $condition;
 
  720                 return $cond ? $cond : array();
 
  730                 $this->tpl->addBlockfile(
"BUTTONS", 
"buttons", 
"tpl.buttons.html");
 
  733                         $this->tpl->setCurrentBlock(
"btn_cell");
 
  734                         $this->tpl->setVariable(
"BTN_LINK",$link);
 
  735                         $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt($name));
 
  736                         $this->tpl->parseCurrentBlock();
 
  754                 if(is_object($this->form))
 
  758                 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
 
  760                 $this->ctrl->setParameter($this,
'source_id',$a_source_id);
 
  761                 $this->form->setFormAction($this->ctrl->getFormAction($this));
 
  765                 $this->form->addItem($info_source);
 
  769                 $this->form->addItem($info_target);
 
  788                         $obl->setValue($condition[
'obligatory']);
 
  794                 $this->form->addItem($obl);
 
  797                 include_once 
"./Services/AccessControl/classes/class.ilConditionHandler.php";
 
  801                         $operators[0] = $this->lng->txt(
'select_one');
 
  803                 foreach(
$ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
 
  805                         $operators[$operator] = $this->lng->txt(
'condition_'.$operator);
 
  807                 $sel->setValue(isset($condition[
'operator']) ? $condition[
'operator'] : 0);
 
  808                 $sel->setOptions($operators);
 
  809                 $sel->setRequired(
true);
 
  810                 $this->form->addItem($sel);
 
  817                         $opt2 = 
new ilRadioOption($this->lng->txt(
'cond_ref_shared'),ilConditionHandler::SHARED_CONDITIONS);
 
  818                         $rad_opt->addOption($opt2);
 
  821                         $rad_opt->addOption($opt1);
 
  823                         $this->form->addItem($rad_opt);
 
  827                 if($trigger_type == 
'sahs')
 
  829                         $this->lng->loadLanguageModule(
'trac');
 
  830                         include_once 
'Services/Tracking/classes/class.ilLPCollections.php';
 
  833                         $cus = 
new ilCustomInputGUI($this->lng->txt(
'trac_sahs_relevant_items'),
'item_ids[]');
 
  836                         $tpl = 
new ilTemplate(
'tpl.condition_handler_sco_row.html',
true,
true,
 
  837                                 "Services/AccessControl");
 
  842                                 $tpl->setCurrentBlock(
"sco_row");
 
  843                                 $tpl->setVariable(
'SCO_ID',$item_id);
 
  844                                 $tpl->setVariable(
'SCO_TITLE',$sahs_item[
'title']);
 
  845                                 $tpl->setVariable(
'CHECKED',$lp_collections->isAssigned($item_id) ? 
'checked="checked"' : 
'');
 
  846                                 $tpl->parseCurrentBlock();
 
  849                         $tpl->setVariable(
'INFO_SEL',$this->lng->txt(
'trac_lp_determination_info_sco'));
 
  850                         $cus->setHTML(
$tpl->get());
 
  851                         $this->form->addItem($cus);
 
  857                                 $this->form->setTitle($this->lng->txt(
'rbac_edit_condition'));
 
  858                                 $this->form->addCommandButton(
'updateCondition',$this->lng->txt(
'save'));
 
  859                                 $this->form->addCommandButton(
'listConditions',$this->lng->txt(
'cancel'));
 
  865                                 $this->form->setTitle($this->lng->txt(
'add_condition'));
 
  866                                 $this->form->addCommandButton(
'assign',$this->lng->txt(
'save'));
 
  867                                 $this->form->addCommandButton(
'selector',$this->lng->txt(
'back'));