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))
86 $GLOBALS[
'lng']->loadLanguageModule(
'trac');
87 include_once
'./Services/Tracking/classes/class.ilLPObjSettings.php';
92 $GLOBALS[
'lng']->loadLanguageModule(
'rbac');
93 return $GLOBALS[
'lng']->txt(
'condition_'.$a_operator);
119 if(!$ilAccess->checkAccess(
'write',
'',$this->getTargetRefId()))
121 $ilErr->raiseError($lng->txt(
'permission_denied'),$ilErr->WARNING);
124 $next_class = $this->ctrl->getNextClass($this);
125 $cmd = $this->ctrl->getCmd();
141 $this->automatic_validation = $a_status;
154 $this->target_id = $a_target_id;
170 $this->target_ref_id = $a_target_ref_id;
186 $this->target_type = $a_target_type;
202 $this->target_title = $a_target_title;
222 function chi_init(&$chi_target_obj,$a_ref_id = null)
226 include_once
"./Services/AccessControl/classes/class.ilConditionHandler.php";
236 $this->target_obj =& $this->object;
250 $ilToolbar->addButton($this->lng->txt(
'add_condition'),$this->ctrl->getLinkTarget($this,
'selector'));
252 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.list_conditions.html',
'Services/AccessControl');
259 if(count($optional_conditions))
261 if(!$_REQUEST[
"list_mode"])
263 $_REQUEST[
"list_mode"] =
"subset";
266 else if(!$_REQUEST[
"list_mode"])
268 $_REQUEST[
"list_mode"] =
"all";
281 $this->tpl->setVariable(
'TABLE_SETTINGS',$form->getHTML());
285 include_once
'./Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
287 $table->setConditions(
295 $h = $table->getHTML();
296 $this->tpl->setVariable(
'TABLE_CONDITIONS',
$h);
306 if($form->checkInput())
308 $old_mode = $form->getInput(
"old_list_mode");
309 switch($form->getInput(
"list_mode"))
312 if($old_mode !=
"all")
314 include_once
'./Services/AccessControl/classes/class.ilConditionHandler.php';
321 foreach((
array) $optional_conditions as $item)
329 $num_req = $form->getInput(
'required');
330 if($old_mode !=
"subset")
337 foreach($all_conditions as $item)
352 $cond->updateHiddenStatus((
int) $form->getInput(
'hidden'));
355 $this->ctrl->redirect($this,
'listConditions');
358 $form->setValuesByPost();
360 $this->tpl->setContent($form->getHTML());
374 if(
$_POST[
"obl"] &&
sizeof(
$_POST[
"obl"]) >
sizeof($all_conditions)-2)
377 $this->ctrl->redirect($this,
'listConditions');
380 foreach($all_conditions as $item)
383 if(
$_POST[
"obl"] && in_array($item[
"condition_id"],
$_POST[
"obl"]))
399 $this->ctrl->redirect($this,
'listConditions');
425 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
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'));
434 $hide->setInfo($this->lng->txt(
'rbac_precondition_hide_info'));
435 $form->addItem($hide);
438 $form->addItem($mode);
439 $mode->
setValue($_REQUEST[
"list_mode"]);
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);
449 $max = count($all) - 1;
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);
455 $obl =
new ilNumberInputGUI($this->lng->txt(
'precondition_num_obligatory'),
'required');
456 $obl->
setInfo($this->lng->txt(
'precondition_num_optional_info'));
459 $obl->setValue($num_required > 0 ? $num_required : null);
460 $obl->setRequired(
true);
462 $obl->setMinValue($min);
463 $obl->setMaxValue($max);
464 $msubset->addSubItem($obl);
468 $old_mode->setValue($_REQUEST[
"list_mode"]);
469 $form->addItem($old_mode);
477 global $ilObjDataCache;
479 if(!
$_GET[
'condition_id'])
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']);
491 $this->
initFormCondition($condition[
'trigger_ref_id'],(
int) $_GET[
'condition_id'],
'edit');
492 $this->tpl->setVariable(
'CONDITION_TABLE',$this->form->getHTML());
497 global $ilObjDataCache;
499 if(!
$_GET[
'condition_id'])
507 include_once
'./Services/AccessControl/classes/class.ilConditionHandler.php';
511 $condition_handler->setOperator(
$_POST[
'operator']);
512 $condition_handler->setObligatory((
int)
$_POST[
'obligatory']);
514 $condition_handler->setValue(
'');
518 $condition_handler->setReferenceHandlingType($_POST[
'ref_handling']);
525 $condition_handler->updateCondition($condition[
'id']);
528 if($condition[
'trigger_type'] ==
'sahs')
530 include_once
'Services/Object/classes/class.ilObjectLP.php';
532 $collection = $olp->getCollectionInstance();
535 $collection->delete();
538 if(is_array($_POST[
'item_ids']))
540 $collection->activateEntries($_POST[
'item_ids']);
543 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
548 $this->ctrl->redirect($this,
'listConditions');
555 if(!count(
$_POST[
'conditions']))
563 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
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");
571 foreach(
$_POST[
'conditions'] as $condition_id)
576 " (".$this->lng->txt(
"condition").
": ".
577 $this->lng->txt(
'condition_'.$condition[
'operator']).
")";
579 $alt = $this->lng->txt(
'obj_'.$condition[
'trigger_type']);
581 $cgui->addItem(
"conditions[]", $condition_id,
$title, $icon, $alt);
584 $tpl->setContent($cgui->getHTML());
589 if(!count(
$_POST[
'conditions']))
596 foreach(
$_POST[
'conditions'] as $condition_id)
598 $this->ch_obj->deleteCondition($condition_id);
601 $this->ctrl->redirect($this,
'listConditions');
608 include_once (
"./Services/AccessControl/classes/class.ilConditionSelector.php");
614 array(
"root",
"cat",
"grp",
"fold",
"crs")
620 if (!$exp->handleCommand())
622 $this->tpl->setContent($exp->getHTML());
628 global $ilObjDataCache;
630 if(!
$_GET[
'source_id'])
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());
649 if(!isset(
$_GET[
'source_id']))
651 echo "class.ilConditionHandlerGUI: no source_id given";
663 $this->ch_obj->setTargetObjId($this->
getTargetId());
669 $this->ch_obj->setReferenceHandlingType(
$_POST[
'ref_handling']);
679 echo 'ilConditionHandler: Trigger object does not exist';
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']);
687 $this->ch_obj->setValue(
'');
690 if($this->ch_obj->getTriggerType() ==
'sahs')
692 include_once
'Services/Object/classes/class.ilObjectLP.php';
694 $collection = $olp->getCollectionInstance();
697 $collection->delete();
700 if(is_array($_POST[
'item_ids']))
702 $collection->activateEntries($_POST[
'item_ids']);
707 if(!$this->ch_obj->storeCondition())
716 $this->ctrl->redirect($this,
'listConditions');
723 #if(in_array('',$_POST['operator'])) 725 # ilUtil::sendInfo($this->lng->txt('select_one_operator')); 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']);
738 $this->ctrl->returnToParent($this);
744 include_once
'./Services/AccessControl/classes/class.ilConditionHandler.php';
748 if($condition[
'operator'] ==
'not_member')
754 $cond[] = $condition;
757 return $cond ? $cond :
array();
774 if(is_object($this->form))
778 include_once(
'Services/Form/classes/class.ilPropertyFormGUI.php');
780 $this->ctrl->setParameter($this,
'source_id',$a_source_id);
781 $this->form->setFormAction($this->ctrl->getFormAction($this));
785 $this->form->addItem($info_source);
789 $this->form->addItem($info_target);
808 $obl->setValue($condition[
'obligatory']);
814 $this->form->addItem($obl);
817 include_once
"./Services/AccessControl/classes/class.ilConditionHandler.php";
821 $operators[0] = $this->lng->txt(
'select_one');
823 foreach($ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
825 $operators[$operator] = $this->lng->txt(
'condition_'.$operator);
827 $sel->setValue(isset($condition[
'operator']) ? $condition[
'operator'] : 0);
828 $sel->setOptions($operators);
829 $sel->setRequired(
true);
830 $this->form->addItem($sel);
838 $rad_opt->addOption($opt2);
841 $rad_opt->addOption($opt1);
843 $this->form->addItem($rad_opt);
847 if($trigger_type ==
'sahs')
849 $this->lng->loadLanguageModule(
'trac');
851 $cus =
new ilCustomInputGUI($this->lng->txt(
'trac_sahs_relevant_items'),
'item_ids[]');
854 $tpl =
new ilTemplate(
'tpl.condition_handler_sco_row.html',
true,
true,
855 "Services/AccessControl");
858 include_once
'Services/Object/classes/class.ilObjectLP.php';
860 $collection = $olp->getCollectionInstance();
863 foreach($collection->getPossibleItems() as $item_id => $sahs_item)
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();
873 $tpl->setVariable(
'INFO_SEL',$this->lng->txt(
'trac_lp_determination_info_sco'));
874 $cus->setHTML($tpl->get());
875 $this->form->addItem($cus);
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'));
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'));
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
listConditions()
list conditions ilToolbar
getTargetType()
get target type
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.
setValue($a_value)
Set Value.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
setBackButtons($a_btn_arr)
static lookupHiddenStatusByTarget($a_target_ref_id)
Lookup hidden status type $ilDB.
static translateOperator($a_obj_id, $a_operator)
Translate operator.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
initFormCondition($a_source_id, $a_condition_id=0, $a_mode='add')
Init form for condition table.
setTargetId($a_target_id)
set target id
__getConditionsOfTarget()
static _lookupTitle($a_id)
lookup object title
assign()
assign new trigger condition to target
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static lookupObligatoryConditionsOfTarget($a_target_ref_id, $a_target_obj_id)
Lookup obligatory conditions of 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
getTargetRefId()
get target ref id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct($gui_obj, $a_ref_id=null)
Constructor <type> $lng <type> $tpl <type> $tree <type> $ilCtrl.
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)
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
Create styles array
The data for the language used.
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.
setAutomaticValidation($a_status)
saveObligatorySettings()
Save obligatory settings.
static _isReferenceHandlingOptional($a_type)
is reference handling optional
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)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getCondition($a_id)
getTargetId()
get target id
getTargetTitle()
get target title
setTargetType($a_target_type)
set target type
isTargetReferenced()
Check if target has refernce id.
static getInstance($a_obj_id)
showObligatoryForm($opt=array())
Show obligatory form.
Confirmation screen class.
static _mode2Text($a_mode)